Table of Contents

Method CreateMapper

Namespace
Mapperion
Assembly
Mapperion.dll

CreateMapper()

Builds the mapper. Plans are compiled the first time each type pair is mapped and kept afterwards, so the first call for a pair is slower than the rest.

[RequiresUnreferencedCode("Mapping resolves members by reflection.")]
[RequiresDynamicCode("Mapping compiles plans at run time.")]
public IMapper CreateMapper()

Returns

IMapper

An immutable mapper safe to share between threads.

CreateMapper(IServiceProvider)

Builds a mapper that takes its converters, resolvers and mapping actions from the given container, falling back to construction for the ones it does not know. Mappers built from the same configuration share their compiled plans, so one per scope is cheap.

[RequiresUnreferencedCode("Mapping resolves members by reflection.")]
[RequiresDynamicCode("Mapping compiles plans at run time.")]
public IMapper CreateMapper(IServiceProvider services)

Parameters

services IServiceProvider

The container to ask.

Returns

IMapper

An immutable mapper bound to that container.

Exceptions

ArgumentNullException

services is null.