Share via


BoolToTwoValuesConverter<TProvider> Constructor

Definition

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, System.Linq.Expressions.Expression<Func<TProvider,bool>> fromProvider = default, Microsoft.EntityFrameworkCore.Storage.ValueConversion.ConverterMappingHints mappingHints = default);
public BoolToTwoValuesConverter (TProvider falseValue, TProvider trueValue, System.Linq.Expressions.Expression<Func<TProvider,bool>>? fromProvider = default, Microsoft.EntityFrameworkCore.Storage.ValueConversion.ConverterMappingHints? mappingHints = default);
new Microsoft.EntityFrameworkCore.Storage.ValueConversion.BoolToTwoValuesConverter<'Provider> : 'Provider * 'Provider * System.Linq.Expressions.Expression<Func<'Provider, bool>> * Microsoft.EntityFrameworkCore.Storage.ValueConversion.ConverterMappingHints -> Microsoft.EntityFrameworkCore.Storage.ValueConversion.BoolToTwoValuesConverter<'Provider>
Public Sub New (falseValue As TProvider, trueValue As TProvider, Optional fromProvider As Expression(Of Func(Of TProvider, Boolean)) = Nothing, Optional mappingHints As ConverterMappingHints = Nothing)

Parameters

falseValue
TProvider

The value to convert to for false.

trueValue
TProvider

The value to convert to for true.

fromProvider
Expression<Func<TProvider,Boolean>>

Optional custom translator from store.

mappingHints
ConverterMappingHints

Hints 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 Boolean to zero/one.

See EF Core value converters for more information and examples.

Applies to