![](/img/trans.png)
[英]Why do I have to Ignore all other properties in AutoMapper when using records?
[英]Do I need to write all the properties explicitly when I am using AutoMapper, if these properties have the same name?
我一直在尝试这样做,但是当我调试测试时,对象返回 null。 我想做复杂的对象到对象映射,但我无法让它工作。
代替:
cfg.CreateMap<Payments, Customer.Payments>()
.ForMember(to => to.SomeName, opts => opts.MapFrom(from => from.SomeName))
.ForMember(to => to.SomeDate, opts => opts.MapFrom(from => from.SomeDate));
我们想做:
cfg.CreateMap<Payments, Customer.Payments>();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.