AdHocMapper Class

Definition

Creates ad-hoc mappings of CLR types to entity types after the model has been built.

public class AdHocMapper : Microsoft.EntityFrameworkCore.Metadata.IAdHocMapper
type AdHocMapper = class
    interface IAdHocMapper
Public Class AdHocMapper
Implements IAdHocMapper
Inheritance
AdHocMapper
Derived
Implements

Remarks

The service lifetime is Scoped. This means that each DbContext instance will use its own instance of this service. The implementation may depend on other services registered with any lifetime. The implementation does not need to be thread-safe.

See Implementation of database providers and extensions for more information and examples.

Constructors

AdHocMapper(AdHocMapperDependencies)

Do not call this constructor directly from either provider or application code as it may change as new dependencies are added. Instead, use this type in your constructor so that an instance will be created and injected automatically by the dependency injection container. To create an instance with some dependent services replaced, first resolve the object from the dependency injection container, then replace selected services using the C# 'with' operator. Do not call the constructor at any point in this process.

Properties

Dependencies

Dependencies for this service.

Methods

BuildConventionSet()

Builds the convention set to be used by the ad-hoc mapper.

GetOrAddEntityType(Type)

Gets the ad-hoc entity type mapped for the given CLR type, or creates the mapping and returns it if it does not exist.

Applies to