Skip to Content
ModulesMapster

Mapster

Griffin.Mapster registers Mapster mapping configuration and a singleton mapper.

Installation

dotnet add package Griffin.Mapster

Register Mappings

using Griffin.Mapster; var builder = WebApplication.CreateBuilder(args); builder.Services.AddCustomMapster(typeof(Program).Assembly);

AddCustomMapster scans the supplied assemblies into the global TypeAdapterConfig and registers Mapster’s IMapper as a singleton. Inject IMapper from MapsterMapper into application services.

Define mappings with IRegister implementations in scanned assemblies, or use Mapster’s conventions. Pass all assemblies containing mapping registrations; unscanned assemblies are not configured.