Files
FATrace/FATrace.WPLApp/Services/MapperProvidere.cs
2025-10-29 11:42:58 +08:00

42 lines
1.1 KiB
C#

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();
}
}
}