tri_inn

tri_inn

  • NA
  • 1.2k
  • 234.3k

DI in ASP.Net MVC6 view does braeking the MVC pattern

Apr 26 2017 5:00 AM

Today I came across a article which showed how we can call DalService class functionality from the view directly. Here is the article: http://www.dotnetcurry.com/aspnet-mvc/1315/aspnet-mvc-6-dependency-injection-views

The article shows that we can inject DalService by default DI and then we can call DalService functionality from the view directly.

Doesn't this break the MVC pattern ?

Was it possible in MVC 4/5 because in MVC 4/5 we can use unity DI and then we can call DalService from the view as shown in the linked article?

One new keyword has been introduced named @inject DalService dService

I'm looking for other suggestions.


Answers (2)