View model
A view model is a data structure that supplies a user-interface view with the data required to render a particular output.
.NET MAUI in Action
A view model is a data transfer object that aggregates the data required to render a particular view, without providing application functionality.
- How it is used
- Aggregates all data needed to render a web view into one API response.
- How deep it goes
- Defines the DTO role and contrasts it with an MVVM ViewModel, without detailing API implementation.
- Examples
- Uses a sales leaderboard containing salesperson, monthly-total, and monthly-average data.
- What you can do after
- Evaluate/understand whether a view-specific aggregate DTO can replace multiple web-view API calls.
Pro ASP.NET Core 7, Tenth Edition
A view model is the data supplied to a view for incorporation into its rendered output.
- How it is used
- Supplies controller-selected data to Razor views so actions can produce dynamic HTML responses.
- How deep it goes
- Works from a string through objects, collections, and composite classes, including typed access and nullable model handling.
- Examples
- Uses a time-dependent greeting, RSVP form and response, paged product catalog, and login form.
- What you can do after
- Build it from scratch by passing typed data from an MVC action and rendering its properties or collections in a Razor view.
Read how Pro ASP.NET Core 7, Tenth Edition explains view model →
ASP.NET Core in Action, 3e
A view model is an object or data structure containing the information a user-interface view requires to render a response.
- How it is used
- Supplies Razor views with UI-ready data after a handler or controller obtains application data.
- How deep it goes
- Defines rendering data and works through PageModel properties, ViewResult delivery, and an EF Core projection.
- Examples
- Uses an error page’s request ID and a projected list of recipe summaries.
- What you can do after
- Apply it via MVC’s View(model) or Razor Pages’ PageModel properties to provide rendering data to a Razor view.
Related concepts
- data bindingused by · Data binding is a technique that connects application data or state to user-interface elements or component properties so values or behavior can be represented or synchronized.
- data transfer objectcontrasts with · A data transfer object is a data-carrying structure that conveys defined information between software components or across application boundaries without encapsulating substantial domain behavior.
- for attributeconfigured by · The For attribute is a ValidationMessage component parameter that identifies the model property whose validation errors are displayed.
- razor expressionused by · A Razor expression is an inline construct that evaluates an embedded C# expression and inserts its result into generated output.
- subtemplateused by · A subtemplate is a reusable template fragment that can be rendered independently or included within another template to produce part of an output.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.


