Class BoolToTwoValuesConverter<TProvider>
- Assembly
- Microsoft.EntityFrameworkCore.dll
Converts bool values to and from two different values.
public class BoolToTwoValuesConverter<TProvider> : ValueConverter<bool, TProvider>
Type Parameters
TProvider
- Inheritance
-
ValueConverter<bool, TProvider>BoolToTwoValuesConverter<TProvider>
- Derived
-
BoolToZeroOneConverter<TProvider>
- Inherited Members
Remarks
See EF Core value converters for more information and examples.
Constructors
BoolToTwoValuesConverter(TProvider, TProvider, Expression<Func<TProvider, bool>>?, ConverterMappingHints?)
Creates a new instance of this converter that will convert a false false to one value and a true to another.
public BoolToTwoValuesConverter(TProvider falseValue, TProvider trueValue, Expression<Func<TProvider, bool>>? fromProvider = null, ConverterMappingHints? mappingHints = null)
Parameters
falseValue
TProviderThe value to convert to for false.
trueValue
TProviderThe value to convert to for true.
fromProvider
Expression<Func<TProvider, bool>>Optional custom translator from store.
mappingHints
ConverterMappingHintsHints that can be used by the ITypeMappingSource to create data types with appropriate facets for the converted data.
Remarks
Use BoolToZeroOneConverter<TProvider> for converting a bool to zero/one.
See EF Core value converters for more information and examples.