251029
This commit is contained in:
41
FATrace.WPLApp/Services/MapperProvidere.cs
Normal file
41
FATrace.WPLApp/Services/MapperProvidere.cs
Normal file
@@ -0,0 +1,41 @@
|
||||
using AutoMapper;
|
||||
using Prism.Ioc;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace FATrace.WPLApp.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// 配置服务
|
||||
/// </summary>
|
||||
public class MapperProvidere : IMapperProvider
|
||||
{
|
||||
private readonly MapperConfiguration _Configuration;
|
||||
|
||||
/// <summary>
|
||||
/// 构造函数
|
||||
/// </summary>
|
||||
/// <param name="container"></param>
|
||||
public MapperProvidere(IContainerProvider container)
|
||||
{
|
||||
_Configuration = new MapperConfiguration(configure =>
|
||||
{
|
||||
//var assemblys = AppDomain.CurrentDomain.GetAssemblies();
|
||||
//configure.AddMaps(assemblys);
|
||||
|
||||
configure.ConstructServicesUsing(container.Resolve);
|
||||
|
||||
//扫描profile文件
|
||||
configure.AddMaps(AppDomain.CurrentDomain.GetAssemblies());
|
||||
});
|
||||
}
|
||||
|
||||
public IMapper GetMapper()
|
||||
{
|
||||
return _Configuration.CreateMapper();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user