AutoMapper Exclude Fields

2019-03-22 17:54发布

问题:

I'm trying to map one object to another but the object is quite complex. During development, I'd like the ability to either exclude a bunch of fields and get to them one by one or be able to specify to map only fields I want and increase that as each test succeeds.

So:

class    
    string field1    
    string field2    
    string field3

Now I'd like to map field1, test, fix and then move onto field2 then field3.

Is this possible?

回答1:

.ForMember(dto => dto.field1, opt => opt.Ignore());


标签: c# AutoMapper