using System.Collections.Generic; using Volo.Abp.Data; using Volo.Abp.ObjectExtending; namespace AutoMapper { public static class AbpAutoMapperExtensibleDtoExtensions { public static IMappingExpression MapExtraProperties( this IMappingExpression mappingExpression, MappingPropertyDefinitionChecks? definitionChecks = null) where TDestination : IHasExtraProperties where TSource : IHasExtraProperties { return mappingExpression .ForMember( x => x.ExtraProperties, y => y.MapFrom( (source, destination, extraProps) => { var result = extraProps.IsNullOrEmpty() ? new Dictionary() : new Dictionary(extraProps); HasExtraPropertiesObjectExtendingExtensions .MapExtraPropertiesTo( source.ExtraProperties, result, definitionChecks ); return result; }) ); } } }