我看到一些类似的问题,但没有确切的答案。Autofac:通过扫描获取注册
如果我扫描组件:
containerBuilder.RegisterAssemblyTypes(...)
我可以再调整已注册这样一个特定类型的?,即登记:
containerBuilder.RegisterAssemblyTypes(...)
containerBuilder.GetRegistration<MyType>().WithParameter("param", paramValue);
有没有办法实现的东西这种Autofac?
有多少种类型有特殊参数(1,10,100等)?所有你的特殊类型需要相同的参数('paramValue')还是辅助者不同(所以MyType需要paramValue但MyOtherType需要其他参数值? – nemesv
有几种需要特殊处理的类型,它们需要不同的参数 –
如果你只有几种类型,那么最简单的解决方案将是手动注册它们,并使用它们的'RegisterAssemblyTypes'功能... – nemesv