PropertyBuilder<TProperty>.HasConversion Method

Definition

Overloads

HasConversion(ValueConverter)

Configures the property so that the property value is converted to and from the database using the given ValueConverter.

HasConversion(Type)

Configures the property so that the property value is converted before writing to the database and converted back when reading from the database.

HasConversion(ValueConverter, ValueComparer)

Configures the property so that the property value is converted to and from the database using the given ValueConverter.

HasConversion(Type, Type)

Configures the property so that the property value is converted before writing to the database and converted back when reading from the database.

HasConversion(ValueConverter, ValueComparer, ValueComparer)

Configures the property so that the property value is converted to and from the database using the given ValueConverter.

HasConversion(Type, ValueComparer, ValueComparer)

Configures the property so that the property value is converted before writing to the database and converted back when reading from the database.

HasConversion(Type, ValueComparer)

Configures the property so that the property value is converted before writing to the database and converted back when reading from the database.

HasConversion(Type, Type, Type)

Configures the property so that the property value is converted before writing to the database and converted back when reading from the database.

HasConversion<TConversion,TComparer,TProviderComparer>()

Configures the property so that the property value is converted before writing to the database and converted back when reading from the database.

HasConversion<TConversion,TComparer>()

Configures the property so that the property value is converted before writing to the database and converted back when reading from the database.

HasConversion<TConversion>()

Configures the property so that the property value is converted before writing to the database and converted back when reading from the database.

HasConversion<TConversion>(ValueComparer)

Configures the property so that the property value is converted before writing to the database and converted back when reading from the database.

HasConversion<TConversion>(ValueComparer, ValueComparer)

Configures the property so that the property value is converted before writing to the database and converted back when reading from the database.

HasConversion<TProvider>(ValueConverter<TProperty,TProvider>)

Configures the property so that the property value is converted to and from the database using the given ValueConverter<TModel,TProvider>.

HasConversion<TProvider>(ValueConverter<TProperty,TProvider>, ValueComparer)

Configures the property so that the property value is converted to and from the database using the given ValueConverter<TModel,TProvider>.

HasConversion<TProvider>(Expression<Func<TProperty,TProvider>>, Expression<Func<TProvider,TProperty>>)

Configures the property so that the property value is converted to and from the database using the given conversion expressions.

HasConversion<TProvider>(ValueConverter<TProperty,TProvider>, ValueComparer, ValueComparer)

Configures the property so that the property value is converted to and from the database using the given ValueConverter<TModel,TProvider>.

HasConversion<TProvider>(Expression<Func<TProperty,TProvider>>, Expression<Func<TProvider,TProperty>>, ValueComparer)

Configures the property so that the property value is converted to and from the database using the given conversion expressions.

HasConversion<TProvider>(Expression<Func<TProperty,TProvider>>, Expression<Func<TProvider,TProperty>>, ValueComparer, ValueComparer)

Configures the property so that the property value is converted to and from the database using the given conversion expressions.

HasConversion(ValueConverter)

Configures the property so that the property value is converted to and from the database using the given ValueConverter.

public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder<TProperty> HasConversion (Microsoft.EntityFrameworkCore.Storage.ValueConversion.ValueConverter converter);
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder<TProperty> HasConversion (Microsoft.EntityFrameworkCore.Storage.ValueConversion.ValueConverter? converter);
override this.HasConversion : Microsoft.EntityFrameworkCore.Storage.ValueConversion.ValueConverter -> Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder<'Property>
Public Overridable Function HasConversion (converter As ValueConverter) As PropertyBuilder(Of TProperty)

Parameters

converter
ValueConverter

The converter to use.

Returns

The same builder instance so that multiple configuration calls can be chained.

Applies to

HasConversion(Type)

Configures the property so that the property value is converted before writing to the database and converted back when reading from the database.

public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder<TProperty> HasConversion (Type providerClrType);
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder<TProperty> HasConversion (Type? providerClrType);
override this.HasConversion : Type -> Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder<'Property>
Public Overridable Function HasConversion (providerClrType As Type) As PropertyBuilder(Of TProperty)

Parameters

providerClrType
Type

The type to convert to and from or a type that inherits from ValueConverter.

Returns

The same builder instance so that multiple configuration calls can be chained.

Applies to

HasConversion(ValueConverter, ValueComparer)

Configures the property so that the property value is converted to and from the database using the given ValueConverter.

public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder<TProperty> HasConversion (Microsoft.EntityFrameworkCore.Storage.ValueConversion.ValueConverter converter, Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer valueComparer);
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder<TProperty> HasConversion (Microsoft.EntityFrameworkCore.Storage.ValueConversion.ValueConverter? converter, Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer? valueComparer);
override this.HasConversion : Microsoft.EntityFrameworkCore.Storage.ValueConversion.ValueConverter * Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer -> Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder<'Property>
Public Overridable Function HasConversion (converter As ValueConverter, valueComparer As ValueComparer) As PropertyBuilder(Of TProperty)

Parameters

converter
ValueConverter

The converter to use.

valueComparer
ValueComparer

The comparer to use for values before conversion.

Returns

The same builder instance so that multiple configuration calls can be chained.

Applies to

HasConversion(Type, Type)

Configures the property so that the property value is converted before writing to the database and converted back when reading from the database.

public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder<TProperty> HasConversion (Type conversionType, Type? comparerType);
override this.HasConversion : Type * Type -> Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder<'Property>
Public Overridable Function HasConversion (conversionType As Type, comparerType As Type) As PropertyBuilder(Of TProperty)

Parameters

conversionType
Type

The type to convert to and from or a type that inherits from ValueConverter.

comparerType
Type

A type that inherits from ValueComparer.

Returns

The same builder instance so that multiple configuration calls can be chained.

Applies to

HasConversion(ValueConverter, ValueComparer, ValueComparer)

Configures the property so that the property value is converted to and from the database using the given ValueConverter.

public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder<TProperty> HasConversion (Microsoft.EntityFrameworkCore.Storage.ValueConversion.ValueConverter? converter, Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer? valueComparer, Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer? providerComparer);
override this.HasConversion : Microsoft.EntityFrameworkCore.Storage.ValueConversion.ValueConverter * Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer * Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer -> Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder<'Property>
Public Overridable Function HasConversion (converter As ValueConverter, valueComparer As ValueComparer, providerComparer As ValueComparer) As PropertyBuilder(Of TProperty)

Parameters

converter
ValueConverter

The converter to use.

valueComparer
ValueComparer

The comparer to use for values before conversion.

providerComparer
ValueComparer

The comparer to use for the provider values.

Returns

The same builder instance so that multiple configuration calls can be chained.

Applies to

HasConversion(Type, ValueComparer, ValueComparer)

Configures the property so that the property value is converted before writing to the database and converted back when reading from the database.

public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder<TProperty> HasConversion (Type conversionType, Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer? valueComparer, Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer? providerComparer);
override this.HasConversion : Type * Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer * Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer -> Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder<'Property>
Public Overridable Function HasConversion (conversionType As Type, valueComparer As ValueComparer, providerComparer As ValueComparer) As PropertyBuilder(Of TProperty)

Parameters

conversionType
Type

The type to convert to and from or a type that inherits from ValueConverter.

valueComparer
ValueComparer

The comparer to use for values before conversion.

providerComparer
ValueComparer

The comparer to use for the provider values.

Returns

The same builder instance so that multiple configuration calls can be chained.

Applies to

HasConversion(Type, ValueComparer)

Configures the property so that the property value is converted before writing to the database and converted back when reading from the database.

public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder<TProperty> HasConversion (Type providerClrType, Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer valueComparer);
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder<TProperty> HasConversion (Type conversionType, Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer? valueComparer);
override this.HasConversion : Type * Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer -> Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder<'Property>
override this.HasConversion : Type * Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer -> Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder<'Property>
Public Overridable Function HasConversion (providerClrType As Type, valueComparer As ValueComparer) As PropertyBuilder(Of TProperty)
Public Overridable Function HasConversion (conversionType As Type, valueComparer As ValueComparer) As PropertyBuilder(Of TProperty)

Parameters

providerClrTypeconversionType
Type

The type to convert to and from.

valueComparer
ValueComparer

The comparer to use for values before conversion.

Returns

The same builder instance so that multiple configuration calls can be chained.

Applies to

HasConversion(Type, Type, Type)

Configures the property so that the property value is converted before writing to the database and converted back when reading from the database.

public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder<TProperty> HasConversion (Type conversionType, Type? comparerType, Type? providerComparerType);
override this.HasConversion : Type * Type * Type -> Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder<'Property>
Public Overridable Function HasConversion (conversionType As Type, comparerType As Type, providerComparerType As Type) As PropertyBuilder(Of TProperty)

Parameters

conversionType
Type

The type to convert to and from or a type that inherits from ValueConverter.

comparerType
Type

A type that inherits from ValueComparer.

providerComparerType
Type

A type that inherits from ValueComparer to use for the provider values.

Returns

The same builder instance so that multiple configuration calls can be chained.

Applies to

HasConversion<TConversion,TComparer,TProviderComparer>()

Configures the property so that the property value is converted before writing to the database and converted back when reading from the database.

public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder<TProperty> HasConversion<TConversion,TComparer,TProviderComparer> () where TComparer : Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer where TProviderComparer : Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer;
override this.HasConversion : unit -> Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder<'Property> (requires 'Comparer :> Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer and 'ProviderComparer :> Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer)
Public Overridable Function HasConversion(Of TConversion, TComparer, TProviderComparer) () As PropertyBuilder(Of TProperty)

Type Parameters

TConversion

The type to convert to and from or a type that inherits from ValueConverter.

TComparer

A type that inherits from ValueComparer.

TProviderComparer

A type that inherits from ValueComparer to use for the provider values.

Returns

The same builder instance so that multiple configuration calls can be chained.

Applies to

HasConversion<TConversion,TComparer>()

Configures the property so that the property value is converted before writing to the database and converted back when reading from the database.

public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder<TProperty> HasConversion<TConversion,TComparer> () where TComparer : Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer;
override this.HasConversion : unit -> Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder<'Property> (requires 'Comparer :> Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer)
Public Overridable Function HasConversion(Of TConversion, TComparer) () As PropertyBuilder(Of TProperty)

Type Parameters

TConversion

The type to convert to and from or a type that inherits from ValueConverter.

TComparer

A type that inherits from ValueComparer.

Returns

The same builder instance so that multiple configuration calls can be chained.

Applies to

HasConversion<TConversion>()

Configures the property so that the property value is converted before writing to the database and converted back when reading from the database.

public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder<TProperty> HasConversion<TProvider> ();
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder<TProperty> HasConversion<TConversion> ();
override this.HasConversion : unit -> Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder<'Property>
Public Overridable Function HasConversion(Of TProvider) () As PropertyBuilder(Of TProperty)
Public Overridable Function HasConversion(Of TConversion) () As PropertyBuilder(Of TProperty)

Type Parameters

TProvider TConversion

The type to convert to and from or a type that inherits from ValueConverter.

Returns

The same builder instance so that multiple configuration calls can be chained.

Applies to

HasConversion<TConversion>(ValueComparer)

Configures the property so that the property value is converted before writing to the database and converted back when reading from the database.

public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder<TProperty> HasConversion<TProvider> (Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer valueComparer);
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder<TProperty> HasConversion<TConversion> (Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer? valueComparer);
override this.HasConversion : Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer -> Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder<'Property>
Public Overridable Function HasConversion(Of TProvider) (valueComparer As ValueComparer) As PropertyBuilder(Of TProperty)
Public Overridable Function HasConversion(Of TConversion) (valueComparer As ValueComparer) As PropertyBuilder(Of TProperty)

Type Parameters

TProvider TConversion

The type to convert to and from or a type that inherits from ValueConverter.

Parameters

valueComparer
ValueComparer

The comparer to use for values before conversion.

Returns

The same builder instance so that multiple configuration calls can be chained.

Applies to

HasConversion<TConversion>(ValueComparer, ValueComparer)

Configures the property so that the property value is converted before writing to the database and converted back when reading from the database.

public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder<TProperty> HasConversion<TConversion> (Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer? valueComparer, Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer? providerComparer);
override this.HasConversion : Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer * Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer -> Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder<'Property>
Public Overridable Function HasConversion(Of TConversion) (valueComparer As ValueComparer, providerComparer As ValueComparer) As PropertyBuilder(Of TProperty)

Type Parameters

TConversion

The type to convert to and from or a type that inherits from ValueConverter.

Parameters

valueComparer
ValueComparer

The comparer to use for values before conversion.

providerComparer
ValueComparer

The comparer to use for the provider values.

Returns

The same builder instance so that multiple configuration calls can be chained.

Applies to

HasConversion<TProvider>(ValueConverter<TProperty,TProvider>)

Configures the property so that the property value is converted to and from the database using the given ValueConverter<TModel,TProvider>.

public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder<TProperty> HasConversion<TProvider> (Microsoft.EntityFrameworkCore.Storage.ValueConversion.ValueConverter<TProperty,TProvider> converter);
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder<TProperty> HasConversion<TProvider> (Microsoft.EntityFrameworkCore.Storage.ValueConversion.ValueConverter<TProperty,TProvider>? converter);
override this.HasConversion : Microsoft.EntityFrameworkCore.Storage.ValueConversion.ValueConverter<'Property, 'Provider> -> Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder<'Property>
Public Overridable Function HasConversion(Of TProvider) (converter As ValueConverter(Of TProperty, TProvider)) As PropertyBuilder(Of TProperty)

Type Parameters

TProvider

The store type generated by the converter.

Parameters

converter
ValueConverter<TProperty,TProvider>

The converter to use.

Returns

The same builder instance so that multiple configuration calls can be chained.

Applies to

HasConversion<TProvider>(ValueConverter<TProperty,TProvider>, ValueComparer)

Configures the property so that the property value is converted to and from the database using the given ValueConverter<TModel,TProvider>.

public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder<TProperty> HasConversion<TProvider> (Microsoft.EntityFrameworkCore.Storage.ValueConversion.ValueConverter<TProperty,TProvider> converter, Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer valueComparer);
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder<TProperty> HasConversion<TProvider> (Microsoft.EntityFrameworkCore.Storage.ValueConversion.ValueConverter<TProperty,TProvider>? converter, Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer? valueComparer);
override this.HasConversion : Microsoft.EntityFrameworkCore.Storage.ValueConversion.ValueConverter<'Property, 'Provider> * Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer -> Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder<'Property>
Public Overridable Function HasConversion(Of TProvider) (converter As ValueConverter(Of TProperty, TProvider), valueComparer As ValueComparer) As PropertyBuilder(Of TProperty)

Type Parameters

TProvider

The store type generated by the converter.

Parameters

converter
ValueConverter<TProperty,TProvider>

The converter to use.

valueComparer
ValueComparer

The comparer to use for values before conversion.

Returns

The same builder instance so that multiple configuration calls can be chained.

Applies to

HasConversion<TProvider>(Expression<Func<TProperty,TProvider>>, Expression<Func<TProvider,TProperty>>)

Configures the property so that the property value is converted to and from the database using the given conversion expressions.

public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder<TProperty> HasConversion<TProvider> (System.Linq.Expressions.Expression<Func<TProperty,TProvider>> convertToProviderExpression, System.Linq.Expressions.Expression<Func<TProvider,TProperty>> convertFromProviderExpression);
override this.HasConversion : System.Linq.Expressions.Expression<Func<'Property, 'Provider>> * System.Linq.Expressions.Expression<Func<'Provider, 'Property>> -> Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder<'Property>
Public Overridable Function HasConversion(Of TProvider) (convertToProviderExpression As Expression(Of Func(Of TProperty, TProvider)), convertFromProviderExpression As Expression(Of Func(Of TProvider, TProperty))) As PropertyBuilder(Of TProperty)

Type Parameters

TProvider

The store type generated by the conversions.

Parameters

convertToProviderExpression
Expression<Func<TProperty,TProvider>>

An expression to convert objects when writing data to the store.

convertFromProviderExpression
Expression<Func<TProvider,TProperty>>

An expression to convert objects when reading data from the store.

Returns

The same builder instance so that multiple configuration calls can be chained.

Applies to

HasConversion<TProvider>(ValueConverter<TProperty,TProvider>, ValueComparer, ValueComparer)

Configures the property so that the property value is converted to and from the database using the given ValueConverter<TModel,TProvider>.

public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder<TProperty> HasConversion<TProvider> (Microsoft.EntityFrameworkCore.Storage.ValueConversion.ValueConverter<TProperty,TProvider>? converter, Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer? valueComparer, Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer? providerComparer);
override this.HasConversion : Microsoft.EntityFrameworkCore.Storage.ValueConversion.ValueConverter<'Property, 'Provider> * Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer * Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer -> Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder<'Property>
Public Overridable Function HasConversion(Of TProvider) (converter As ValueConverter(Of TProperty, TProvider), valueComparer As ValueComparer, providerComparer As ValueComparer) As PropertyBuilder(Of TProperty)

Type Parameters

TProvider

The store type generated by the converter.

Parameters

converter
ValueConverter<TProperty,TProvider>

The converter to use.

valueComparer
ValueComparer

The comparer to use for values before conversion.

providerComparer
ValueComparer

The comparer to use for the provider values.

Returns

The same builder instance so that multiple configuration calls can be chained.

Applies to

HasConversion<TProvider>(Expression<Func<TProperty,TProvider>>, Expression<Func<TProvider,TProperty>>, ValueComparer)

Configures the property so that the property value is converted to and from the database using the given conversion expressions.

public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder<TProperty> HasConversion<TProvider> (System.Linq.Expressions.Expression<Func<TProperty,TProvider>> convertToProviderExpression, System.Linq.Expressions.Expression<Func<TProvider,TProperty>> convertFromProviderExpression, Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer valueComparer);
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder<TProperty> HasConversion<TProvider> (System.Linq.Expressions.Expression<Func<TProperty,TProvider>> convertToProviderExpression, System.Linq.Expressions.Expression<Func<TProvider,TProperty>> convertFromProviderExpression, Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer? valueComparer);
override this.HasConversion : System.Linq.Expressions.Expression<Func<'Property, 'Provider>> * System.Linq.Expressions.Expression<Func<'Provider, 'Property>> * Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer -> Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder<'Property>
Public Overridable Function HasConversion(Of TProvider) (convertToProviderExpression As Expression(Of Func(Of TProperty, TProvider)), convertFromProviderExpression As Expression(Of Func(Of TProvider, TProperty)), valueComparer As ValueComparer) As PropertyBuilder(Of TProperty)

Type Parameters

TProvider

The store type generated by the conversions.

Parameters

convertToProviderExpression
Expression<Func<TProperty,TProvider>>

An expression to convert objects when writing data to the store.

convertFromProviderExpression
Expression<Func<TProvider,TProperty>>

An expression to convert objects when reading data from the store.

valueComparer
ValueComparer

The comparer to use for values before conversion.

Returns

The same builder instance so that multiple configuration calls can be chained.

Applies to

HasConversion<TProvider>(Expression<Func<TProperty,TProvider>>, Expression<Func<TProvider,TProperty>>, ValueComparer, ValueComparer)

Configures the property so that the property value is converted to and from the database using the given conversion expressions.

public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder<TProperty> HasConversion<TProvider> (System.Linq.Expressions.Expression<Func<TProperty,TProvider>> convertToProviderExpression, System.Linq.Expressions.Expression<Func<TProvider,TProperty>> convertFromProviderExpression, Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer? valueComparer, Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer? providerComparer);
override this.HasConversion : System.Linq.Expressions.Expression<Func<'Property, 'Provider>> * System.Linq.Expressions.Expression<Func<'Provider, 'Property>> * Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer * Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer -> Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder<'Property>
Public Overridable Function HasConversion(Of TProvider) (convertToProviderExpression As Expression(Of Func(Of TProperty, TProvider)), convertFromProviderExpression As Expression(Of Func(Of TProvider, TProperty)), valueComparer As ValueComparer, providerComparer As ValueComparer) As PropertyBuilder(Of TProperty)

Type Parameters

TProvider

The store type generated by the conversions.

Parameters

convertToProviderExpression
Expression<Func<TProperty,TProvider>>

An expression to convert objects when writing data to the store.

convertFromProviderExpression
Expression<Func<TProvider,TProperty>>

An expression to convert objects when reading data from the store.

valueComparer
ValueComparer

The comparer to use for values before conversion.

providerComparer
ValueComparer

The comparer to use for the provider values.

Returns

The same builder instance so that multiple configuration calls can be chained.

Applies to