我已经将Ninject用于我的应用程序.Ninject非常简单易学,但速度很慢,我尝试使用另一个IoC进行比较,如果它比Ninject更快.
MVC3和Simple Injector有很多IoC容器看起来对我很好,但是我用Simple Injector替换Ninject有很多问题.
尤其是与AutoMapper.我尝试将这些行转换为Simple Injector代码.
Bind<ITypeMapFactory>().To<TypeMapFactory>();
foreach (var mapper in MapperRegistry.AllMappers())
{
Bind<IObjectMapper>().ToConstant(mapper);
}
Bind<ConfigurationStore>().ToSelf().InSingletonScope()
.WithConstructorArgument("mappers",
ctx => ctx.Kernel.GetAll<IObjectMapper>());
Bind<IConfiguration>()
.ToMethod(ctx => ctx.Kernel.Get<ConfigurationStore>());
Bind<IConfigurationProvider>().ToMethod(ctx =>
ctx.Kernel.Get<ConfigurationStore>());
Bind<IMappingEngine>().To<MappingEngine>()
Run Code Online (Sandbox Code Playgroud)
你能帮帮我吗?我已经阅读了文档和googled,但到目前为止还没有解决方案.