views:

245

answers:

1

As the title says...

I found this solution http://stackoverflow.com/questions/1526813/automapper-setting-destination-string-to-null-actually-makes-it-string-empty

but It uses the Initialize method so all the mappings behavior would change along the app : O

And I just need do it for a specific mapping.

Thanks in advance.

A: 

Found a solution:

Mapper.Initialize( Conf =>
  {
    Conf.ForSourceType<MyGreatViewModel>().AllowNullDestinationValues = true;
  } );

Thanks guys : )

Take care of your destination field types (remember you need nullable types. e.g. 'Byte?' )

SDReyes