Share via


PropertyBuilder.HasConversion Method

Definition

Overloads

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(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(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)

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(ValueConverter)

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<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>(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<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(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 HasConversion (Type conversionType, Type? comparerType, Type? providerComparerType);
abstract member HasConversion : Type * Type * Type -> Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder
override this.HasConversion : Type * Type * Type -> Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder
Public Overridable Function HasConversion (conversionType As Type, comparerType As Type, providerComparerType As Type) As PropertyBuilder

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(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 HasConversion (Type providerClrType, Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer valueComparer);
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder HasConversion (Type conversionType, Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer? valueComparer);
abstract member HasConversion : Type * Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer -> Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder
override this.HasConversion : Type * Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer -> Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder
abstract member HasConversion : Type * Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer -> Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder
override this.HasConversion : Type * Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer -> Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder
Public Overridable Function HasConversion (providerClrType As Type, valueComparer As ValueComparer) As PropertyBuilder
Public Overridable Function HasConversion (conversionType As Type, valueComparer As ValueComparer) As PropertyBuilder

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(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 HasConversion (Microsoft.EntityFrameworkCore.Storage.ValueConversion.ValueConverter? converter, Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer? valueComparer, Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer? providerComparer);
abstract member HasConversion : Microsoft.EntityFrameworkCore.Storage.ValueConversion.ValueConverter * Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer * Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer -> Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder
override this.HasConversion : Microsoft.EntityFrameworkCore.Storage.ValueConversion.ValueConverter * Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer * Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer -> Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder
Public Overridable Function HasConversion (converter As ValueConverter, valueComparer As ValueComparer, providerComparer As ValueComparer) As PropertyBuilder

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 HasConversion (Type conversionType, Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer? valueComparer, Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer? providerComparer);
abstract member HasConversion : Type * Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer * Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer -> Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder
override this.HasConversion : Type * Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer * Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer -> Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder
Public Overridable Function HasConversion (conversionType As Type, valueComparer As ValueComparer, providerComparer As ValueComparer) As PropertyBuilder

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)

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 HasConversion (Type providerClrType);
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder HasConversion (Type? conversionType);
abstract member HasConversion : Type -> Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder
override this.HasConversion : Type -> Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder
abstract member HasConversion : Type -> Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder
override this.HasConversion : Type -> Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder
Public Overridable Function HasConversion (providerClrType As Type) As PropertyBuilder
Public Overridable Function HasConversion (conversionType As Type) As PropertyBuilder

Parameters

providerClrTypeconversionType
Type

The type to convert to and from.

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 HasConversion (Microsoft.EntityFrameworkCore.Storage.ValueConversion.ValueConverter converter, Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer valueComparer);
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder HasConversion (Microsoft.EntityFrameworkCore.Storage.ValueConversion.ValueConverter? converter, Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer? valueComparer);
abstract member HasConversion : Microsoft.EntityFrameworkCore.Storage.ValueConversion.ValueConverter * Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer -> Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder
override this.HasConversion : Microsoft.EntityFrameworkCore.Storage.ValueConversion.ValueConverter * Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer -> Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder
Public Overridable Function HasConversion (converter As ValueConverter, valueComparer As ValueComparer) As PropertyBuilder

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(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 HasConversion (Microsoft.EntityFrameworkCore.Storage.ValueConversion.ValueConverter converter);
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder HasConversion (Microsoft.EntityFrameworkCore.Storage.ValueConversion.ValueConverter? converter);
abstract member HasConversion : Microsoft.EntityFrameworkCore.Storage.ValueConversion.ValueConverter -> Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder
override this.HasConversion : Microsoft.EntityFrameworkCore.Storage.ValueConversion.ValueConverter -> Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder
Public Overridable Function HasConversion (converter As ValueConverter) As PropertyBuilder

Parameters

converter
ValueConverter

The converter to use.

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 HasConversion (Type conversionType, Type? comparerType);
abstract member HasConversion : Type * Type -> Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder
override this.HasConversion : Type * Type -> Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder
Public Overridable Function HasConversion (conversionType As Type, comparerType As Type) As PropertyBuilder

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<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 HasConversion<TConversion,TComparer,TProviderComparer> () where TComparer : Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer where TProviderComparer : Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer;
abstract member HasConversion : unit -> Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder (requires 'Comparer :> Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer and 'ProviderComparer :> Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer)
override this.HasConversion : unit -> Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder (requires 'Comparer :> Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer and 'ProviderComparer :> Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer)
Public Overridable Function HasConversion(Of TConversion, TComparer, TProviderComparer) () As PropertyBuilder

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 HasConversion<TConversion,TComparer> () where TComparer : Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer;
abstract member HasConversion : unit -> Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder (requires 'Comparer :> Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer)
override this.HasConversion : unit -> Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder (requires 'Comparer :> Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer)
Public Overridable Function HasConversion(Of TConversion, TComparer) () As PropertyBuilder

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>(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 HasConversion<TConversion> (Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer? valueComparer, Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer? providerComparer);
abstract member HasConversion : Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer * Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer -> Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder
override this.HasConversion : Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer * Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer -> Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder
Public Overridable Function HasConversion(Of TConversion) (valueComparer As ValueComparer, providerComparer As ValueComparer) As PropertyBuilder

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<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 HasConversion<TProvider> ();
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder HasConversion<TConversion> ();
abstract member HasConversion : unit -> Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder
override this.HasConversion : unit -> Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder
Public Overridable Function HasConversion(Of TProvider) () As PropertyBuilder
Public Overridable Function HasConversion(Of TConversion) () As PropertyBuilder

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 HasConversion<TProvider> (Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer valueComparer);
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder HasConversion<TConversion> (Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer? valueComparer);
abstract member HasConversion : Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer -> Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder
override this.HasConversion : Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer -> Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder
Public Overridable Function HasConversion(Of TProvider) (valueComparer As ValueComparer) As PropertyBuilder
Public Overridable Function HasConversion(Of TConversion) (valueComparer As ValueComparer) As PropertyBuilder

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