Skip null values with custom resolver

UPDATE: IsSourceValueNull is not available starting from V5.

If you want all source properties with null values to be ignored you could use:

Mapper.CreateMap<SourceType, DestinationType>()
  .ForAllMembers(opt => opt.Condition(srs => !srs.IsSourceValueNull));

Otherwise, you can do something similar for each member.

Read this.

Leave a Comment