ITypeMappingSource Interface

Definition

The core type mapping source. Type mappings describe how a provider maps CLR types/values to database types/values.

Warning: do not implement this interface directly. Instead, derive from TypeMappingSourceBase for non-relational providers, or 'RelationalTypeMappingSource' for relational providers.

This type is typically used by database providers (and other extensions). It is generally not used in application code.

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.

public interface ITypeMappingSource
type ITypeMappingSource = interface
Public Interface ITypeMappingSource
Derived

Remarks

See Implementation of database providers and extensions for more information.

Methods

FindMapping(IProperty)

Finds the type mapping for a given IProperty.

FindMapping(MemberInfo)

Finds the type mapping for a given MemberInfo representing a field or a property of a CLR type.

Note: Only call this method if there is no IProperty available, otherwise call FindMapping(IProperty)

FindMapping(Type)

Finds the type mapping for a given Type.

Note: Only call this method if there is no IProperty or IModel available, otherwise call FindMapping(IProperty) or FindMapping(Type, IModel)

FindMapping(Type, IModel)

Finds the type mapping for a given Type, taking pre-convention configuration into the account.

Note: Only call this method if there is no IProperty, otherwise call FindMapping(IProperty).

Applies to