I need to map domain objects to DTO objects in my SPA, built on Angular and WebAPI. For this feature I have decided to use some auto-mapping tool. During my mapping I need to provide some contextual information which extends me global mapping settings. In fact I want to implement this:
int i = 10;
var mapper = config.CreateMapper();
mapper.Map<Source, Dest>(src, opt => {
opt.BeforeMap((src, dest) => src.Value = src.Value + i);
opt.AfterMap((src, dest) => dest.Name = HttpContext.Current.Identity.Name);
});
This is Automapper code. But I do not want to use Atomapper because it is very slow.
I have looked through other tools like (Mapster, ExpressMapper). This tools are cool and quick, but they do not support inline settings as far as I know.
Can somebody advice me some other automapping tool, which supports this feature. Or maybe somebody gove me advice, how to implement this with one of the mentioned tools?