From the course: ASP.NET MVC: HTTP Request Life Cycle

Unlock the full course today

Join today to access over 22,400 courses taught by industry experts or purchase this course individually.

Explore the role of dependency resolvers

Explore the role of dependency resolvers

From the course: ASP.NET MVC: HTTP Request Life Cycle

Start my 1-month free trial

Explore the role of dependency resolvers

- [Instructor] The MVC framework includes an interface called IDependencyResolver. Its goal is to simplify the process of resolving dependencies and locating services. It reduces coupling between components, and it supports integrating third-party dependency injection frameworks. Here's the methods it defines. GetService resolves a singly registered service for the requested type. This is for cases where there's a single instance of a service registered. An example is the MVC controller factory, where there's a single factory used for the entire application. If you implement this interface, GetService should always return null if there's no registered service matching the type. ASP.NET MVC will fall back to the default factory class to create the interface object. You would resolve multiply registered services using the GetServices method. This applies to services where multiple instances might be registered, like the MVC view engine, which implements IView engine. When you're…

Contents