c# - How to tell Automapper to check if all source properties have destination properties -
we have 2 classes:
public class foo { public int { get; set; } public int b { get; set; } public int c { get; set; } } public class bar { public int { get; set; } public int b { get; set; } } and mapping configuration
mapper.createmap<foo, bar>; is there possibility automapper check automatically source properties have corresponding destination properties, in example throwing exception notifies foo.c property not mapped anything. mapper.assertconfigurationisvalid() checks other way round - destination properties have source properties doesn't in case.
maybe can use hack , test mapping in other direction. like:
mapper.createmap<bar, foo>; // swap direction of mapping mapper.assertconfigurationisvalid() i know isn't ideal quick solution.
Comments
Post a Comment