Table of Contents

Class ValueConverter<TModel, TProvider>

Namespace
NextORM.Core
Assembly
nextorm.core.dll

Base class for a strongly typed property value converter. Subclasses override the typed ConvertToProvider(TModel?) and ConvertFromProvider(TProvider?) methods; the IPropertyValueConverter members are implemented here through a cached typed invoker so value types are not boxed on every row.

public abstract class ValueConverter<TModel, TProvider> : IPropertyValueConverter

Type Parameters

TModel

The CLR model type of the property.

TProvider

The provider-side type stored in the column.

Inheritance
ValueConverter<TModel, TProvider>
Implements
Derived
Inherited Members
Extension Methods

Constructors

ValueConverter()

Initializes the converter and caches its typed invokers.

protected ValueConverter()

Properties

ConvertsNulls

Whether a SQL NULL is passed through the converter instead of being mapped to a null model value. Defaults to false.

public virtual bool ConvertsNulls { get; }

Property Value

bool

ProviderType

The provider-side type produced by ConvertToProvider(object?) and consumed by ConvertFromProvider(object?). The reader uses it to select the typed accessor and the write path uses it to type the bound parameter.

public Type ProviderType { get; }

Property Value

Type

Methods

ConvertFromProvider(TProvider?)

Converts a provider value back to the model representation.

public abstract TModel? ConvertFromProvider(TProvider? provider)

Parameters

provider TProvider

The provider value, or null.

Returns

TModel

The model value.

ConvertToProvider(TModel?)

Converts a model value to the provider representation.

public abstract TProvider? ConvertToProvider(TModel? model)

Parameters

model TModel

The model value, or null.

Returns

TProvider

The provider value.