WCF logical parameter validation using VAB

Topics: Validation Application Block
Nov 12, 2008 at 7:25 PM
As of now  I was able to validate each WCF parameter individually.( using  Microsoft.Practices.EnterpriseLibrary.Validation.Integration.WCF namespace methods/properties)

ex:  Parameter1 - check that length is not greater than 80 [ trows validation error if validation failes]
      Parameter 2- check that length is not greater than 80 [ trows validation error if validation failes]
      Parameter 3 - check that length is not greater than 80 [ trows validation error if validation failes]

Now I am trying to validate based on business rule which requires checking of values based on a logic
ex: Parameter 2 and Parameter 3 can not be of value other than null when parameter 1 is of type null. [ trows validation error if validation failes]

I looked in to propertycomparer validation, if i understand it correctly, this is not flexible enough to handle logical validation ( if ...else..)

Is this possible to accomplish this validation while validation WCF parameters???
I would appriciage if any one could share thier experiences on this.

Nov 13, 2008 at 9:54 AM

Hi,

I dont think its possible, Validators are meant to validate only single object.

One possible thing that you could try is to:

1. Combine the 3 param in a class.
2. Implement your own Custom Validator or SelfValidation in your class with your own validation logic.

Tutorial for SelfValidation:
http://davidhayden.com/blog/dave/archive/2007/01/24/BusinessObjectValidationEnterpriseLibrary.aspx


Valiant Dudan
Global Technology and Solutions
Avanade, Inc.
entlib.support@avanade.com