Print Page | Close Window

DevForce approach for validation of non entities.

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce 2010
Forum Discription: For .NET 4.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=2990
Printed Date: 26-Mar-2025 at 5:45am


Topic: DevForce approach for validation of non entities.
Posted By: Sleepy Hollow Ranch
Subject: DevForce approach for validation of non entities.
Date Posted: 05-Oct-2011 at 1:42pm
I would like to know what people are or should be using for validation of non-entities and what is the devforce way of doing this? I have not found documentation on this subject(I am assuming that there is no documentation at this point... I searched)
After researching for a bit I thought it best to see if there is a devforce way of doing this. Any help would be greatly appreciated.



Replies:
Posted By: kimj
Date Posted: 06-Oct-2011 at 11:55am
Although not particularly well-documented, you can use DevForce to validate non-entities. 
 
With entities you get built-in validation, so with non-entities you have to drive the validation yourself.  In your property setter you can call VerifierEngine.ExecuteBeforeSet and/or ExecuteAfterSet for the property in question.  To perform instance-level validation you call VerifierEngine.Execute.  A VerifierEngine can be created standalone, or you can use your EntityManager's.  You can use standard DevForce validation attributes on non-entities, and also create custom verifiers.
 
Although we don't have a sample, we do make use of non-entity validation in the DevForce Silverlight Business Application template.  If you've used that, the VerifiableObject class defined there serves as the base class for non-entity classes requiring verification.  The VerifiableObject also implements INotifyPropertyChanged and INotifyDataErrorInfo.  You can see this code in action if you create a new solution from this template, or I can upload the class if you're interested.
 
For the record, our validation documentation is here - http://drc.ideablade.com/xwiki/bin/view/Documentation/validate - http://drc.ideablade.com/xwiki/bin/view/Documentation/validate
 



Print Page | Close Window