Validation with Simple MVVM Toolkit

May 23, 2011 at 2:40 PM

Hi Tony

Just wondering if you were planning to update your toolkit with any validation features any time soon? I was watching Zoltan Arvai's MIX 11 "Effective Validation Techniques with MVVM in Silverlight" video recently and it seems like there is quite a lot to getting this right.

Cheers - Graham


Coordinator
May 23, 2011 at 3:32 PM

@Graham: I will make a point to watch Zoltan's MIX talk.  However, WCF RIA Services includes a powerful validation framework.  Because it is built into WCF RIA Services, there's no need to duplicate those features in the Simple MVVM Toolkit.  When you create a new project by selecting the SimpleMvvmRiaServices Visual Studio project template, you get end-to-end validation right out of the box.  For more information on how to do this, see my webinar on WCF RIA Services: http://blog.tonysneed.com/2011/04/20/wcf-ria-services-webinar. Here I demonstrate incorporating validation at the property and entity level, as well as async server-side validation.  Check it out and let me know if this is what you're looking for.

Cheers,

Tony

Jun 16, 2011 at 6:37 AM

Hi Tony,

First, Thanks for the great tool. What I am trying to do is create a UI where a user can enter bunch of values. I need to store these values in a object class (Model). I will use this to do some calculation and use the property of this class for reporting purpose. I am NOT using any database as such. I have started a RIA service project so that I could get the validation out-of-the-box. What is the process of performing validation in this case? Should I create a model in the web folder with .shared.cs extension? If so, how do I create a view model? (Client/Server side?) I think I am a bit confused with the use of MVVM pattern here.

Could you incorporate data validation (INotifyDataErrorInfo) on your models/viewmodels in your next release?

Your guidance is appreciated.

Coordinator
Jun 21, 2011 at 5:35 PM

@shakyad: There is a way to get validation without using using RIA Services, which is for n-tier development. As you suggested, you would need to implement INotifyDataErrorInfo and use Data Annotations.  I am planning to do this in the very next release of the Simple MVVM Toolkit, which I plan to put out this summer.  Thanks for your patience. :-)

Tony

Jan 13, 2012 at 5:35 AM

Hi Tony,

Thanks for incorporating the Validation feature in the ModelBase. It works like a charm. This is great for property level validation. Is it possible to incorporate Object-level validation? I want to validate the whole model as I have to validate between properties. I watched Zoltan's presentation in MIX11 and loved it. I was wondering if you could provide us with similar concepts in object validation by using IEditable in ModelBase as you have used in the ViewModelBase but that does validation as well. This is one feature I would really like to see in the toolkit and think would help everybody a lot.

Can't wait for next release! :)