[英]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.