AutoMapper issue

后端 未结 3 430
臣服心动
臣服心动 2020-12-18 07:48

Trying to automap some objects.
Source objects has properties with _ before name, destination objects - have not. Is it possible to implement ONE map creation, that auto

3条回答
  •  失恋的感觉
    2020-12-18 08:08

    This is how I'm doing it

    Mapper.Initialize(cfg =>
            {
                cfg.RecognizeDestinationPrefixes(new []{"_"});
                cfg.RecognizePrefixes(new[] { "_" });
    
                cfg.CreateMap().ReverseMap();
            });
    

提交回复
热议问题