I've gone through a few tutorials in ASP.NET Core MVC, and I've built a little app (for looking at problems in old exams) that looks roughly like this:
Solution Project ... Models Exam.cs Problem.cs SubProblem.cs Views Exam Index.cshtml Problem.cshtml Shared Controllers ExamController.cs Data ExamsContext.cs DbInitializer.cs Migrations ...
Now I asked the question, Where to put methods in a .NET Core MVC Web app? and got a few answers. Mainly that The business logic should only be in the Model because this logic is technology-agnostic.
Now I asked if this means that I should add methods to my Models (
Problem.cs, etc.). Wheras I got an explanation of layers, what Data Access Layer and Business Model is and what they are for.
Apparently, the DAL should communicate with the database and not contain any logic methods. In C#, these classes often have the form of a POCO. Also, this layer is part of the Model (in the MVC sense).
To me, this sounds a lot like the classes I have in my Model-folder, they are POCO's without methods used to communicate with the database?
The Business model is apparently the thing that should reflect the business reality. This is where I should add my business logic, decoupled from the database and the UI. This layer is also part of the Model (in the MVC sense).
To me this sounds almost like the classes I have in my Model folder, though they aren't really decoupled from the database (are they) I mean they get connected to the database through the DbContext don't they?
I still don't really feel I've understood how I am to implement these things into my solution above. Though I didn't wish to bloat my previous question with repeated follow up questions so I thought I'd ask new questions:
What are the models I have in my project called? Are they some form of "model" connected to the DAL? Are they my "Business Models"? Are they some third kind of model? The tutorials described it like the models were only code-first representations of the tables in my relational database.
How would I go about implementing all of these layers and other models into my solution? What would that roughly even look like?