-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathClassMetadataAutoMapperExtensions.cs
More file actions
27 lines (26 loc) · 1023 Bytes
/
ClassMetadataAutoMapperExtensions.cs
File metadata and controls
27 lines (26 loc) · 1023 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
using System;
namespace FluentMetadata.AutoMapper
{
/// <summary>
/// AutoMapper extensions to <see cref="FluentMetadata.ClassMetadata<T>"/>
/// </summary>
public static class ClassMetadataAutoMapperExtensions
{
/// <summary>
/// Copies the the source type's metadata to the destination type's metadata
/// using the mapping information provided by AutoMapper.
/// </summary>
/// <typeparam name="TDestination">The type of the destination.</typeparam>
/// <param name="to">The destination metadata.</param>
/// <param name="from">The source type.</param>
public static void CopyAutoMappedMetadataFrom<TDestination>(this ClassMetadata<TDestination> to, Type from)
{
var destinationType = typeof(TDestination);
MetadataHelper.CopyMappedMetadata(
from,
destinationType,
AutoMapperHelper.GetMemberMapsOf(from, destinationType)
);
}
}
}