Validation with Prism Converged build

Jul 3, 2014 at 5:42 AM
I have went through the Adventure Works Shopper app and can't seem to see how you guys are validating the shipping/billing info. From looking at the source code, you have the Data Annotations part of the code commented out, yet the app still performs validation.

Where in the app are you specifying this? I was working on validation in my Universal app today and wasn't really successful in trying to follow the example used in the AWS app.

Any guidance on this would be appreciated!
Jul 3, 2014 at 1:00 PM
Jul 3, 2014 at 9:39 PM
Thanks, I will give this a shot. I had seen this but it said it applies to Windows 8.1; it did not mention Windows Phone 8 so I wasn't sure it applied to Universal Apps.
Jul 3, 2014 at 10:29 PM
Edited Jul 3, 2014 at 10:30 PM
Your documentation appears to be incorrect. The following statement is made under Validation in AdventureWorks Shopper
Model classes must derive from the ValidatableBindableBase class, provided by the Microsoft.Practices.Prism.StoreApps library, in order to participate in validation. This class provides an error container (an instance of the BindableValidator class that is the type of the Errors property) whose contents are updated whenever a model class property value changes.
The StoreApps library only contains BindableBase but not ValidatableBindableBase. Within the AdventureWorks Shopper app, the ValidatableBindableBase is actually within the AdventureWorks.UILogic project (at least in the converged branch). It's not that big of a deal for me to just add this file to my project, but I thought I would let you know that the docs don't match the framework.
Jul 3, 2014 at 11:01 PM
After reading the guide you posted, it appears that this approach can not be used when building a Universal Windows 8.1/Windows Phone 8.1 app using the Converged branch of Prism. The data annotations framework does not appeared to be supported by Universal apps. This would explain why in the Converged branch, the ValidatableBindableBase class is not within the StoreApps library.

Having worked through this exercise, I still don't see how the AdventureWorks Shopper app is performing its validation. When I set break-points within the app, at the DelegateCommand methods, they never get hit. All of the data annotation code is commented out along with the TryValidateProperty method.

Can you please provide some guidance on the best approach to take with validation in the Converged branch? Is this something I should just handle on my own for now?

Thanks.
Jul 5, 2014 at 5:17 PM
Edited Jul 5, 2014 at 5:18 PM
I was able to just write my own validation base class that worked on both devices, it's similar to how INotifyDataErrorInfo works, but runs on Windows Phone and WIndows 8 Universal.

https://github.com/scionwest/ValidatableBase

It's more verbose than just using Data Annotations, but until those become available on Windows Phone, I'll just continue to use this.
Jul 8, 2014 at 10:32 AM
Validation always has been a big plus for PRISM... so please add something for it in the converged model.
Jul 14, 2014 at 10:08 PM
Data Annotations is currently not available on Windows Phone 8.1 so we removed client-side validation support from the Prism library. The AdventureWorks reference implementation performs validation server side and the validation error messages are sent to the client for display. Please look at the CheckoutHubPageViewModel ProcessFormAsync method.