2

I'm calling Autofac.mvc.integration extension method registercontrollers in the global.asax startup

builder.RegisterControllers(Assembly.GetExecutingAssembly());

Notice propertiesAutowired is not being applied. I need to enable property injection on a single controller type. How can I do that? Do I re-register the type? Unregister and reregister? I'm fearful of breaking something if I apply prop injection to all controllers at once. Any tips, tricks, code, links, etc.. are always appreciated. Cheers!

4

2 回答 2

3

来自 Autofac wiki:如果多个组件公开相同的服务,Autofac 将使用最后注册的组件作为该服务的默认提供者。

所以我认为您可以随时使用 propertiesAutowired 重新注册控制器以覆盖。

于 2012-10-21T05:31:01.000 回答
0

您可以在自动注册后手动注册该控制器。

于 2012-07-20T16:34:33.353 回答