Welcome tag moderator AKA Unofficial DEV cheerleader. While most of my friends are found on SnapChat or Tic-Toc, you can find me here. And I OOP, but I’m not a VSCO girl.
What you are missing are the service and repository layers. Don't go directly to the database from your controllers, go through a service layer and have that service work with the database though a repository layer. Then, multiple controllers can share that service.
Welcome tag moderator AKA Unofficial DEV cheerleader. While most of my friends are found on SnapChat or Tic-Toc, you can find me here. And I OOP, but I’m not a VSCO girl.
Yes, through DI. The repository layer has the LINQ queries that interact with Entity Framework. The service layer can map the query data with your view models.
Do the default Data and Areas folders already represent the repository and services layers?
My guess would be that the Data would represent the repository layer, and the Area folder would represent the Service layer. Does that seem about right?
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
What you are missing are the service and repository layers. Don't go directly to the database from your controllers, go through a service layer and have that service work with the database though a repository layer. Then, multiple controllers can share that service.
So, then would I connect my service layer to my controllers through dependency injection? Just like the SignInManager?
What actually goes into the repository layers? Methods to call specific database info?
Yes, through DI. The repository layer has the LINQ queries that interact with Entity Framework. The service layer can map the query data with your view models.
This is insightful, thank you. I will give it a go, and see what happens!
Is this still technically considered MVC? Seems like it would be MVCSR
Do the default Data and Areas folders already represent the repository and services layers?
My guess would be that the Data would represent the repository layer, and the Area folder would represent the Service layer. Does that seem about right?