简体   繁体   中英

AutoMapper context values in AfterMap?

i know you can do this

Mapper.CreateMap<Source, Dest>()
    .ForMember(d => d.Foo, opt => opt.ResolveUsing(res => res.Context.Options.Items["Foo"])

Mapper.Map<Source, Dest>(src, opt => opt.Items["Foo"] = "Bar");

but how do you access contextual data in AfterMap() ?

Right now you can't. But that's an easy fix, open a GitHub issue and we'll add it in (for BeforeMap and AfterMap).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM