asp.net MVC should a View-Model Encapsulate Domain-Model?
        Posted  
        
            by Myster
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Myster
        
        
        
        Published on 2010-04-08T03:19:29Z
        Indexed on 
            2010/04/08
            3:23 UTC
        
        
        Read the original article
        Hit count: 590
        
asp.net-mvc
|viewmodel
Hi all
I've see a lot of MVC examples where domain-objects are passed directly to views, this will work fine if your view is simple.
The common alternative is to have a view-model which has all the same properties as your domain-model + any extra properties your view may need (such as 'confirmPassword').
Before doing too much reading and before discovering AutoMapper I started creating my own variant of view-model where the domain-object (or multiple domain objects) are simply properties of the view-model.
Have I done a bad thing? What problems or benefits could be derived from this approach? Under what circumstances might this way of doing things work well?
© Stack Overflow or respective owner