Reputation: 732
I have a pretty straightforward POCO that contains a property called Image of type byte[]. I'm finding that if this field is set to null, and the Entity Framework object I'm mapping to already has a value for the Image property, the EF object value is not being set to null after I call Mapper.Map.
Is there something specific I should be doing to force AutoMapper to do this, or should I be doing this manually?
Using version 2.2.1 of AutoMapper.
Thanks, Gary
Upvotes: 2
Views: 2117
Reputation: 732
I realized I was actually on a pre-release version of 2.2.1. After upgrading to the latest version this issue appears to have disappeared. If anyone else finds this happening you may want to check this as a possible solution.
Upvotes: 1
Reputation: 7738
Try using the AllowNullCollections configuration option:
Mapper.Configuration.AllowNullCollections = true;
Upvotes: 0