Simple question but cant seem to find the answer. Can I apply .ForAllMembers(options => options.Condition(c => !c.IsSourceValueNull));
globally in the configuration so I dont have to apply it to all of my objects?
Thanks!
Simple question but cant seem to find the answer. Can I apply .ForAllMembers(options => options.Condition(c => !c.IsSourceValueNull));
globally in the configuration so I dont have to apply it to all of my objects?
Thanks!
Create a global mapper configuration:
new MapperConfiguration(cfg =>
{
Func<object, object, object, bool> condition = (src, dest, sourceMember) => sourceMember != null;
cfg.ForAllMaps(((map, expression) => expression.ForAllMembers(opt => opt.Condition(condition))));
});
Tested with Automapper 9.