Skip to content

@ChrisMissal /Mapper.cs
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
public class Mapper : IMapper
{
private static readonly bool initialized;
private static readonly object lockObject = new object();
static Mapper()
{
if(initialized)
return;
lock(lockObject)
{
if(initialized)
return;
Initialize();
initialized = true;
}
}
private static void Initialize()
{
AutoMapper.Mapper.CreateMap<AddressData, IAddress>()
.ForMember(x => x.AddressId, y => y.Ignore())
.ForMember(x => x.AddressType, y => y.Ignore());
// other mappings...
}
public TDestination Map<TSource, TDestination>(TSource source)
{
return AutoMapper.Mapper.Map<TSource, TDestination>(source);
}
public void AssertConfigurationIsValid()
{
AutoMapper.Mapper.AssertConfigurationIsValid();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.