Click here to Skip to main content
15,902,189 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi Guys
I've studying the nice MVVM pattern and going to use it in my application.
But I've found some obscurer thing which i need to somebody make them clear for me:

1-what is the benefit of using Action in RelayCommand Class?
2-Why the Validation Applied in the Model Class instead Of ViewModel Classes?

wait Your valuable answers,
Thanks indeed my dear Friends.
Posted
Updated 15-Jun-12 20:12pm
v2

Why the Validation Applied in the Model Class instead Of ViewModel Classes?

This is the classes that handles data.
This is also the class that has INotifyProperty implemented. So it makes sense to have validations here.

However, there is nothing stopping you from implementing validations in the view model as well.

IMO, there is no one rule or the other, just choose a way you are comfortable with.
 
Share this answer
 
Comments
SteveAdey 20-Jun-12 16:40pm    
I sincerely hope you don't have INotifyProperty on your model. The model should be light weight and free from knowing anything about business logic or property changes. Validation should be done with a separate class or service that is used by the view model. That service will use the model in its validation, but at no stage should the validation logic be inside the model. This will hamper reuse.
thanks abhinav,
so whats about Using the ACTION?
 
Share this answer
 

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