user6296913
user6296913

Reputation:

What is DependencyResolver in asp.net mvc?

I have seen most of the DI libraries (like Unity, Autofac etc) are using this for dependency injection. I know the IOC & DI but not sure how they work practically & provide required instance.

I did lot's of research but could not find the proper answer for the same.

can someone let me know the in simple term what is DependencyResolver in asp.net mvc ? & How it is useful for DI ?

Upvotes: 2

Views: 3865

Answers (1)

Nick Polyderopoulos
Nick Polyderopoulos

Reputation: 909

Based on MSDN, this is the entry point for any dependency injection library. When a dependency resolver is set the Mvc will use this class to resolve any type when instantiates controllers or anything that passes through its life cycle. For example Action invocation, filter invocation(action filter, auth filters etc etc). Maybe data binders.

So basically the Dependency resolver is the middle man between the custom DI library, your custom code and anything that stands between the Mvc framework and your code.

Upvotes: 5

Related Questions