IConventionPropertyBuilder.HasConversion Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
HasConversion(ValueConverter, Boolean) |
Configures the property so that the property value is converted to and from the database using the given ValueConverter. |
HasConversion(Type, Boolean) |
Configures the property so that the property value is converted to the given type before writing to the database and converted back when reading from the database. |
HasConversion(ValueConverter, Boolean)
Configures the property so that the property value is converted to and from the database using the given ValueConverter.
public Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionPropertyBuilder HasConversion (Microsoft.EntityFrameworkCore.Storage.ValueConversion.ValueConverter converter, bool fromDataAnnotation = false);
public Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionPropertyBuilder? HasConversion (Microsoft.EntityFrameworkCore.Storage.ValueConversion.ValueConverter? converter, bool fromDataAnnotation = false);
abstract member HasConversion : Microsoft.EntityFrameworkCore.Storage.ValueConversion.ValueConverter * bool -> Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionPropertyBuilder
Public Function HasConversion (converter As ValueConverter, Optional fromDataAnnotation As Boolean = false) As IConventionPropertyBuilder
Parameters
- converter
- ValueConverter
The converter to use.
- fromDataAnnotation
- Boolean
Indicates whether the configuration was specified using a data annotation.
Returns
The same builder instance if the configuration was applied,
null
otherwise.
Applies to
HasConversion(Type, Boolean)
Configures the property so that the property value is converted to the given type before writing to the database and converted back when reading from the database.
public Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionPropertyBuilder HasConversion (Type providerClrType, bool fromDataAnnotation = false);
public Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionPropertyBuilder? HasConversion (Type? providerClrType, bool fromDataAnnotation = false);
abstract member HasConversion : Type * bool -> Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionPropertyBuilder
Public Function HasConversion (providerClrType As Type, Optional fromDataAnnotation As Boolean = false) As IConventionPropertyBuilder
Parameters
- providerClrType
- Type
The type to convert to and from.
- fromDataAnnotation
- Boolean
Indicates whether the configuration was specified using a data annotation.
Returns
The same builder instance if the configuration was applied,
null
otherwise.
Applies to
Entity Framework