Custom mappers, async mappers, matchers and projectors can be created by implementing the appropriate interface:

  • IMapper
  • IAsyncMapper
  • IMatcher
  • IProjector
public class MyCustomMapper : IMapper{
    ...
}

The methods of the interfaces should be thread-safe.

The custom classes then should be registered in the DI container to allow injecting them into the default instance of the service.

services.AddNeatMapper();
services.Configure<CompositeMapperOptions>(o => o.Mappers.Insert(0, new MyCustomMapper()));

The options which can be configured this way are the following:

  • CompositeMapperOptions
  • CompositeMatcherOptions
  • AsyncCompositeMapperOptions
  • CompositeProjectorOptions

See also Advanced options > Configuration.