【发布时间】:2010-11-29 16:03:56
【问题描述】:
我正在使用以下统一注册自动映射器:
container
.RegisterType<AutoMapper.Configuration, AutoMapper.Configuration>(new PerThreadLifetimeManager(),
new InjectionConstructor(typeof (ITypeMapFactory), AutoMapper.Mappers.MapperRegistry.AllMappers()))
.RegisterType<ITypeMapFactory, TypeMapFactory>()
.RegisterType<IConfiguration, AutoMapper.Configuration>()
.RegisterType<IConfigurationProvider, AutoMapper.Configuration>()
.RegisterType<IMappingEngine, MappingEngine>();
这很好用,但我应该把我的 Mapper.CreateMap 的等价物放在哪里?
另外,如果我有一些自定义解析器,我应该如何以及在哪里注册这些解析器,因为它们依赖于我通过 Unity 注册的其他对象?
【问题讨论】:
标签: c# unity-container automapper