ValueConverter Constructors
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
ValueConverter(LambdaExpression, LambdaExpression, ConverterMappingHints) |
Initializes a new instance of the ValueConverter class. |
ValueConverter(LambdaExpression, LambdaExpression, Boolean, ConverterMappingHints) |
Initializes a new instance of the ValueConverter class, allowing conversion of nulls. Warning: this is currently an internal API since converting nulls to and from the database can lead to broken queries and other issues. See GitHub issue #26230 for more information and examples. |
ValueConverter(LambdaExpression, LambdaExpression, ConverterMappingHints)
Initializes a new instance of the ValueConverter class.
protected ValueConverter (System.Linq.Expressions.LambdaExpression convertToProviderExpression, System.Linq.Expressions.LambdaExpression convertFromProviderExpression, Microsoft.EntityFrameworkCore.Storage.ValueConversion.ConverterMappingHints mappingHints = default);
protected ValueConverter (System.Linq.Expressions.LambdaExpression convertToProviderExpression, System.Linq.Expressions.LambdaExpression convertFromProviderExpression, Microsoft.EntityFrameworkCore.Storage.ValueConversion.ConverterMappingHints? mappingHints = default);
new Microsoft.EntityFrameworkCore.Storage.ValueConversion.ValueConverter : System.Linq.Expressions.LambdaExpression * System.Linq.Expressions.LambdaExpression * Microsoft.EntityFrameworkCore.Storage.ValueConversion.ConverterMappingHints -> Microsoft.EntityFrameworkCore.Storage.ValueConversion.ValueConverter
Protected Sub New (convertToProviderExpression As LambdaExpression, convertFromProviderExpression As LambdaExpression, Optional mappingHints As ConverterMappingHints = Nothing)
Parameters
- convertToProviderExpression
- LambdaExpression
The expression to convert objects when writing data to the store, exactly as supplied and may not handle nulls, boxing, and non-exact matches of simple types.
- convertFromProviderExpression
- LambdaExpression
The expression to convert objects when reading data from the store, exactly as supplied and may not handle nulls, boxing, and non-exact matches of simple types.
- mappingHints
- ConverterMappingHints
Hints that can be used by the ITypeMappingSource to create data types with appropriate facets for the converted data.
Remarks
See EF Core value converters for more information and examples.
Applies to
ValueConverter(LambdaExpression, LambdaExpression, Boolean, ConverterMappingHints)
Initializes a new instance of the ValueConverter class, allowing conversion of nulls.
Warning: this is currently an internal API since converting nulls to and from the database can lead to broken queries and other issues. See GitHub issue #26230 for more information and examples.
[Microsoft.EntityFrameworkCore.Infrastructure.EntityFrameworkInternal]
protected ValueConverter (System.Linq.Expressions.LambdaExpression convertToProviderExpression, System.Linq.Expressions.LambdaExpression convertFromProviderExpression, bool convertsNulls, Microsoft.EntityFrameworkCore.Storage.ValueConversion.ConverterMappingHints? mappingHints = default);
[<Microsoft.EntityFrameworkCore.Infrastructure.EntityFrameworkInternal>]
new Microsoft.EntityFrameworkCore.Storage.ValueConversion.ValueConverter : System.Linq.Expressions.LambdaExpression * System.Linq.Expressions.LambdaExpression * bool * Microsoft.EntityFrameworkCore.Storage.ValueConversion.ConverterMappingHints -> Microsoft.EntityFrameworkCore.Storage.ValueConversion.ValueConverter
Protected Sub New (convertToProviderExpression As LambdaExpression, convertFromProviderExpression As LambdaExpression, convertsNulls As Boolean, Optional mappingHints As ConverterMappingHints = Nothing)
Parameters
- convertToProviderExpression
- LambdaExpression
The expression to convert objects when writing data to the store, exactly as supplied and may not handle nulls, boxing, and non-exact matches of simple types.
- convertFromProviderExpression
- LambdaExpression
The expression to convert objects when reading data from the store, exactly as supplied and may not handle nulls, boxing, and non-exact matches of simple types.
- convertsNulls
- Boolean
If true
, then the nulls will be passed to the converter for conversion. Otherwise null
values always remain null.
- mappingHints
- ConverterMappingHints
Hints that can be used by the ITypeMappingSource to create data types with appropriate facets for the converted data.
- Attributes
Remarks
See EF Core value converters for more information and examples.
Applies to
Entity Framework