ASP.NET MVC 3 Dependency Injection - Controllers, Views & Action Filters
问题 I'm trying to get dependency injection working in an ASP.NET MVC 3 application using Microsoft Unity. First i have implemented my own IDependencyResolver and activated it in my Global.asax file like so: DependencyResolver.SetResolver(new UnityDependencyResolver(container)); I found that i don't need to do anything else to get controller injection (via both the constructor and [Dependency] attribute) to work. With the default view engine i also found i could get the [Dependency] attribute to