Fork me on GitHub
Blog
The journal that this archive was targeting has been deleted. Please update your configuration.
« View | Main
Friday
Oct052012

ViewModel

A ViewModel (VM) is a specialized representation of data that a View can use for data binding. You can think of a View Model as a lightweight domain entity that contains closely related properties that Views can consume to display a consolidation or subset of the data. ViewModels are used across the application as Data Transfer Objects (DTOs) and most times contain almost no business logic. Similar to Martin Fowler’s Presentation Model (PM).

 


    public partial class StudentViewModel
    {
        public string Id { get; set; } 
        public string FirstName { get; set; } // data 
        public string LastName { get; set; } 
        public string Email { get; set; } 
        public bool IsEditable { get; set; } // logic
    }

Reader Comments

There are no comments for this journal entry. To create a new comment, use the form below.

PostPost a New Comment

Enter your information below to add a new comment.

My response is on my own website »
Author Email (optional):
Author URL (optional):
Post:
 
Some HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>