I'm trying to map an Entity Framework model to view model and back again so that if the view model has changes to a field it is mapped back to the entity but if the view model field is null it doesn't change the entities field value. My map config is currently this:
cfg.CreateMap<Order, OrderVM>()
.MaxDepth(4)
.ReverseMap()
.ForMember(d => d.BestTimeToCall,opt=>opt.Condition(src=>src.BestTimeToCall!=null));
In the above I want the BestTimeToCall field to always map from the order to the orderVM but I only want the BestTimeToCall value to map from the orderVM back to the order if the BestTimeToCall value is not null.
The mapping above does not work. What is the correct syntax to accomplish this?
Thanks
John
Thanks
John