'Asp.Net MVC - ViewModel vs Domain Model vs Entity Model [closed]

Have been through many artciles, but didn't get enough clarity on the usage of the 3 different models mentioned. As we know,

View Model - is used to bind the data to specific view

Domain Model - used in the Business layer class to frame the required data and pass it to Action / Controller

Entity Model - Entities provided by EntityFramework (replica of tables in Database)

Now the question is, can we use the Domain model to directly bind the data to the Views?

In case we have to explilcity build the View Model, we need to write the logic in the Action / Controller. I.e., get the data from Business layer using Domain Model and using that, build the View Model. Is this a good practice?

Also, can I use some of Domain models in View Model? Example, my View needs data from Two Domain Models, can I create a View Model and wrap these two Domain models in that View Model?



Solution 1:[1]

From my view I will never use Domain model to bind data to view as it not good in maintainability and will introduce maintainability complexities.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1