Class ValueConverterSelector
- Assembly
- Microsoft.EntityFrameworkCore.dll
A registry of ValueConverter instances that can be used to find the preferred converter to use to convert to and from a given model type to a type that the database provider supports.
public class ValueConverterSelector : IValueConverterSelector
- Inheritance
-
ValueConverterSelector
- Implements
- Inherited Members
Remarks
The service lifetime is Singleton. This means a single instance is used by many DbContext instances. The implementation must be thread-safe. This service cannot depend on services registered as Scoped.
See EF Core value converters for more information and examples.
Constructors
ValueConverterSelector(ValueConverterSelectorDependencies)
Initializes a new instance of the ValueConverterSelector class.
public ValueConverterSelector(ValueConverterSelectorDependencies dependencies)
Parameters
dependencies
ValueConverterSelectorDependenciesParameter object containing dependencies for this service.
Properties
Dependencies
Dependencies for this service.
protected virtual ValueConverterSelectorDependencies Dependencies { get; }
Property Value
Methods
Select(Type, Type?)
Returns the list of ValueConverter instances that can be used to convert the given model type. Converters nearer the front of the list should be used in preference to converters nearer the end.
public virtual IEnumerable<ValueConverterInfo> Select(Type modelClrType, Type? providerClrType = null)
Parameters
modelClrType
TypeThe type for which a converter is needed.
providerClrType
TypeThe database provider type to target, or null for any.
Returns
- IEnumerable<ValueConverterInfo>
The converters available.