| 
  • If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • You already know Dokkio is an AI-powered assistant to organize & manage your digital files & messages. Very soon, Dokkio will support Outlook as well as One Drive. Check it out today!

View
 

MVC Viewmodels

Page history last edited by Martin Aatmaa 14 years ago

(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.