October 2, 2012
@ 11:27 PM

Base on MVC definition from msdn http://msdn.microsoft.com/en-us/gg592073:

  • Models: Model objects are the parts of the application that implement the domain logic. Often, model objects also retrieve and store model state in a database.
  • Views: Views are the components that display the application's user interface (UI). Typically, this UI is created from the model data. An example would be the edit view of Albums that displays text boxes and a drop-down list based on the current state of an Album object.
  • Controllers: Controllers are the components that handle user interaction, manipulate the model, and ultimately select a view to render the UI. In an MVC application, the view only displays information; the controller handles and responds to user input and interaction.

So Create a ViewModel for each Views, ViewModels should be a DTO or Plain Object.   and Models are Factories to Generate ViewModels.

The MVVMC should be like this:

for example UserContacts page:

UserContactsController ->UserContactsModel->UserContactsViewModel->UserContactsView

Controller ask UserContactModel for UserContactsViewModel and fill the UserContactsView and return it.

and there is another View Model or domain object UserContact.

UserContactsViewModel is Model of UserContactsView,

UserContactsViewModel has something like List<UserContact>

there should be couple of helpers can be called by UserContractsModel.

Comments are closed.