Is there a way to selectively skip checking the Silverlight field when using wcf ria?

I have a (likely common) case where I would like to reuse the same class to add a new object and edit an existing object in my silverlight application (SL4, WCF RIA, EF4, Linq-to-Entities). When adding a new one, I would like my custom validator to check for uniqueness and fail if it is not unique. However, when editing, I do not want the same validator to prevent editing. Is there a way to temporarily disable validation for one field (ideally by type of verification, so that other validators can still work in the same field)?

+2
source share
1 answer

You might want to check the ValidationContext attributes here. You may have validation attributes that make decisions based on the properties of the object or any other state that you want to provide.

Check out my blog posts about providing a ValidationContext and using a ValidationContext:

http://jeffhandley.com/archive/2010/10/25/RiaServicesValidationContext.aspx

http://jeffhandley.com/archive/2010/10/25/CrossEntityValidation.aspx

Hope this helps,

Jeff

+1
source

All Articles