mirror of https://github.com/abpframework/abp.git
2 changed files with 26 additions and 1 deletions
@ -0,0 +1,22 @@ |
|||
using Volo.Abp.Data; |
|||
|
|||
namespace Volo.Abp.ObjectExtending |
|||
{ |
|||
public static class HasExtraPropertiesObjectExtendingExtensions |
|||
{ |
|||
public static void MapExtraPropertiesTo<TSource, TDestination>(this TSource source, TDestination destination) |
|||
where TSource : IHasExtraProperties |
|||
where TDestination : IHasExtraProperties |
|||
{ |
|||
var extensionPropertyInfos = ObjectExtensionManager.Instance.GetProperties<TSource>(); |
|||
|
|||
foreach (var extensionPropertyInfo in extensionPropertyInfos) |
|||
{ |
|||
if (source.ExtraProperties.ContainsKey(extensionPropertyInfo.Name)) |
|||
{ |
|||
destination.ExtraProperties[extensionPropertyInfo.Name] = source.ExtraProperties[extensionPropertyInfo.Name]; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|||
Loading…
Reference in new issue