(ASP.NET) MVC View Models
Concepts
* What is a Viewmodel?
* What are Viewmodels used for?
* Viewmodel vs DTO
Motivations
* Decoupling
* Differentiated output (HTML, JSON, XML, etc)
* Progressive enhancement (render on server side, then on client side, with same shared HTML template and data structure)
* Nice tie-in with ASP.NET MVC2 templated helpers
Implementation
Types of viewmodels
[ 1) Domain entity in view ]
2) Viewmodel per domain entity
3) Viewmodel per domain entity + metadata (like property ACLs)
5) Viewmodel per form
4) Viewmodel per page
Implementation patterns
* AutoMapper for plumbing
* http://automapper.codeplex.com/
* "Who Can Help Me" style IMapper class setup on the controller level
* http://whocanhelpme.codeplex.com/
Questions, Concerns
Validation
Complexity
Layer of indirection
Amount of code
Comments (0)
You don't have permission to comment on this page.