35 lines
908 B
C#
35 lines
908 B
C#
using AutoMapper;
|
|
using Prism.Ioc;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace CapMachine.Wpf.MapperProfile
|
|
{
|
|
public class MapperConfig : IMapperProvider
|
|
{
|
|
private readonly MapperConfiguration _Configuration;
|
|
|
|
public MapperConfig(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();
|
|
}
|
|
}
|
|
}
|