Akhil
Akhil

Reputation: 2030

Dependecy Injection with MVC other than controllers

I am trying to understand dependency injection in MVC. I got some idea and implemented successfully with Controllers using extending DefaultControllerFactory and using ninject. But i read something like DI in views , Actions etc.

I didn't get DI in Views or my understanding is wrong. If yes, please tell me use and how to do that. I didn't understand other DI areas in MVC. Please explain the areas where DI is used in MVC other than Controllers

Upvotes: 1

Views: 60

Answers (1)

haim770
haim770

Reputation: 49095

In MVC, you should try and make your Views as independent as possible. Ideally, the only dependency it rely on is the ViewModel (other view services and helpers are available through the WebPageBase class that all views inherit by default).

Upvotes: 1

Related Questions