In general, the “Model” part of the MVC should be interpreted as the “View Model” or “View Model,” that is, the class that encapsulates all the data and behavior required for the view. This may or may not be equivalent to a domain model.
Domain models must be developed independently of the user interface. This means that such Models should not be contaminated with data and behavior specific to the user interface — for example, to determine whether a particular button is enabled or not.
You can also show the same domain objects in several different views (for example, "Master / Detail" or "Screen / Edit"), and if these views are sufficiently different, using a view model for each view will be useful.
So, in general, you must independently create your own domain layer and your presentation level.
At the domain level, you can select three tables for three classes. Books like Fowler Patterns Enterprise Application Architecture and Evans Domain-Driven Design contain many recommendations on how to model relational data as domain models.
When it comes to modeling representations in MVC, it makes sense to create one model per view. Such a view model can simply encapsulate one domain object, but it can also encapsulate and aggregate several different domain objects.
That way you can ensure that problems are shared and that your classes follow the principle of shared responsibility.
For very simple scenarios, it may make sense to collapse the domain model and model representation into one layer, but you should understand that this essentially means that there is no model domain in the solution - all models would not be purely Presentational models.
source share