In MVC 3 you can find some big improvements in simplifying more sophisticated application-level tasks with support for dependency resolution and global action filters.
ASP.NET MVC 3 introduces a new concept called a dependency resolver, which greatly simplifies the use of dependency injection in your applications. This makes it easier to decouple application components, which makes them more configurable and easier to test. Support has been added for the following scenarios in MVC 3:
– Controllers (registering and injecting controller factories, injecting controllers)
– Views (registering and injecting view engines, injecting dependencies into view pages)
– Action filters (locating and injecting filters)
– Model binders (registering and injecting)
– Model validation providers (registering and injecting)
– Model metadata providers (registering and injecting)
– Value providers (registering and injecting)
Global action filters
In MVC 2 by using action filters you can execute code before or after an action method ran. They were implemented as custom attributes that could be applied to controller actions or to an entire controller. MVC 2 included some filters in the box, like the Authorize attribute.
MVC 3 extends this with global action filters, which apply to all action methods in your application.This is especially useful for application infrastructure concerns like error handling and logging.