2020-08-08 08:53:35 +02:00
|
|
|
|
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>();
|
2020-08-10 09:22:33 +02:00
|
|
|
|
cfg.CreateMap<Services.VersionInfo, DataContract.VersionInfo>();
|
2020-08-08 08:53:35 +02:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
Instance = new AutoMapper.Mapper(config);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return Instance;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|