1
votes

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

2

2 Answers

0
votes

Try using the AllowNullCollections configuration option:

Mapper.Configuration.AllowNullCollections = true;
0
votes

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.