Click here to Skip to main content
15,892,674 members
Please Sign up or sign in to vote.
2.00/5 (2 votes)
See more:
I'm working a C# winForm project and I'm applying MVP-VM...I'm not understanding the benefit(s) of binding my UI widgets to my "ViewModel" which is actually just a reflection of my Model. Seems to me like I'm just adding another layer of abstraction unnecessarily. Why not just pass my Model(businessObj) to my View(Form) and bind it to the appropriate UI widget(s) instead of binding the ViewModel?
Posted

1 solution

Often your view model will contain all the data pertaining to a specific task, which will cross boundaries of different Model objects. I find that with MVC all the time, I have my model class, plus a few bits of info I need in just this one page to know how I am dealing with that data.
 
Share this answer
 
Comments
d.allen101 23-Jul-12 19:31pm    
not sure I understand what you are saying. let's say I have two different models: 1)Customer 2)Product. are you saying that my viewModel would contain the attributes of both of these models?
Christian Graus 23-Jul-12 19:32pm    
A viewmodel for a page that shows a list of products that have been ordered by a customer would probably have elements of both, yes. My models in MVC all come from our Entity Framework classes for the DB, so whenever data I need crosses two tables, my viewmodel will contain data from more than one model.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900