1
0
mirror of https://github.com/ncblakely/GiantsTools synced 2024-11-24 23:25:37 +01:00
GiantsTools/Giants.Services/Mapper/Mapper.cs

35 lines
1.1 KiB
C#
Raw Normal View History

namespace Giants.Services
{
using AutoMapper;
public static class Mapper
{
public static IMapper Instance { get; private set; }
private static readonly object LockObject = new object();
public static IMapper GetMapper()
{
if (Instance == null)
{
lock(LockObject)
{
if (Instance == null)
{
var config = new MapperConfiguration(cfg => {
cfg.CreateMap<DataContract.ServerInfo, Services.ServerInfo>();
cfg.CreateMap<Services.ServerInfo, DataContract.ServerInfo>();
2020-08-08 09:07:11 +02:00
cfg.CreateMap<Services.ServerInfo, DataContract.ServerInfoWithHostAddress>();
cfg.CreateMap<Services.VersionInfo, DataContract.VersionInfo>();
});
Instance = new AutoMapper.Mapper(config);
}
}
}
return Instance;
}
}
}