How to compare two wcf input parameters

Topics: Validation Application Block
Aug 29, 2013 at 1:31 PM
I'm using the enterprise validation block in a wcf project. There is an operation with two string parameters. I'd like to check that there are equal. It doesn't seem possible to do it with the builtin validators. Is there a way to implement it?

Here is an example :
    void Register(string login, string password, string confirmPassword);
How to check that the parameters password and confirmPassword are equal?

Thank you.
Sep 2, 2013 at 5:29 AM
There is no out of the box way to validate WCF parameters against one another. If you were dealing with an object then it would be possible to use the Property Comparison Validator. So, if your WCF interface accepted a request object that wrapped all of the properties then it would be possible.

Assuming that the interface is fixed, then you could still create a LoginInfo object (with the appropriate validation rules) and then manually run validation against that object.

Randy Levy
Enterprise Library support engineer
Support How-to