添加项目文件。
This commit is contained in:
34
CapMachine.Wpf/MapperProfile/MapperConfig.cs
Normal file
34
CapMachine.Wpf/MapperProfile/MapperConfig.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user