ASP.NET MVC > ViewModel

ASP.NET MVC > ViewModel

View Model is a model class that can hold only those properties that is required for a view. It can also contains properties from more than one entities (tables) of the database. As the name suggests, this model is created specific to the View requirements. 

Few examples of View Models are below 

  • To list data from more than entities in a view page – we can create a View model and have properties of all the entities for which we want to list data. Join those database entities and set View model properties and return to the View to show properties of different entities in one table as one result set. 
  • View model may define only specific fields of a single entity that is required for the View.

Read posts under ASP.NET MVC > ViewModel

1 posts found
  1. List data using ViewModel

Write for us

Hosting Recommendations