var mapper = config.CreateMapper();
// or
IMapper mapper = new Mapper(config);
var dest = mapper.Map<Source, Dest>(new Source());
Mapper.Initialize(cfg => {
cfg.CreateMap<QuoteOutputModel, QuoteSnapshot>()
.ForMember(dest => dest.Quote, opt => opt.MapFrom(src => src.CarrierQuotes))
.ForMember(dest => dest.Quote, opt => opt.MapFrom(src => src.CarrierQuotes)
);
});
var config = new MapperConfiguration(cfg => {
cfg.AddProfile<AppProfile>();
cfg.CreateMap<Source, Dest>();
});
时间: 2024-10-29 19:11:49