mirror of https://github.com/abpframework/abp.git
csharpabpc-sharpframeworkblazoraspnet-coredotnet-coreaspnetcorearchitecturesaasdomain-driven-designangularmulti-tenancy
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
1.4 KiB
37 lines
1.4 KiB
using System.Collections.Generic;
|
|
using Volo.Abp.Data;
|
|
using Volo.Abp.ObjectExtending;
|
|
|
|
namespace AutoMapper
|
|
{
|
|
public static class AbpAutoMapperExtensibleDtoExtensions
|
|
{
|
|
public static IMappingExpression<TSource, TDestination> MapExtraProperties<TSource, TDestination>(
|
|
this IMappingExpression<TSource, TDestination> 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<string, object>()
|
|
: new Dictionary<string, object>(extraProps);
|
|
|
|
HasExtraPropertiesObjectExtendingExtensions
|
|
.MapExtraPropertiesTo<TSource, TDestination>(
|
|
source.ExtraProperties,
|
|
result,
|
|
definitionChecks
|
|
);
|
|
|
|
return result;
|
|
})
|
|
);
|
|
}
|
|
}
|
|
}
|