Entity vs Model vs View Model

asp.net-mvc c# entity-framework mvvm


Since we don't have any MVC applications and I typically just say "model," I recently spent some time reading about these concepts, but I get the impression that they mean different things depending on the context:


Simple enough; there is only one row in the database.

2) In relation to a database , an entity is a single person, place, or thing about which data can be stored.


I frequently read that this simply entails combining different entities to describe a complete set of data. For example, an Addresslist-model of a customer would mix the entities customer, address, and most likely individual.


A model, often known as an MVVM or MVC pattern, is a term that precisely represents the data displayed on the view. The application tier's viewmodel provides properties for validation, such as ViewModel vs. Model in ASP.NET MVC

These phrases appear quite repetitive to me: The Viewmodel serves a purpose, otherwise the View would have to put in all the effort to display the appropriate information. Since the entity is merely a representation, as we know from the EF, where does the model come into play when you mix the two?

The ViewModel must be given validation, security, and other considerations. Would you utilize the model to add even another abstraction between the entities and the viewmodel if you have hundreds of little tables? Or are entities and models in terms of MVC and MVVM typically the same?

As always, thanks and have a good weekend.


5/23/2017 12:34:50 PM

Accepted Answer

Although different people have slightly varying understandings of these concepts, here is how I understand them:

An entity is an object with an identity (ID) and typically originates from a database. Quite an easy class.

Model is a somewhat broad phrase that refers to any business object. It could be an entity, a special class you developed for your project, etc. Basically everything that isn't a view, controller, or viewmodel is included.

A view and a model are connected through something called a viewmodel. For the sake of interacting with the particular view, it modifies the communication between the model and the view, applying validation, combining multiple models into a single larger object, etc. The view you bind to receives commands from the ViewModel, which also handles events (such as button and mouse clicks) (WPF).

10/26/2014 12:47:45 PM

Popular Answer


Related Questions


Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow