Wcf generated classes and attributes of the validator application block

I am new to validator app box and am trying to use it with wcf ...

I have a wcf service that has data objects with validation rules defined with attributes using a validation app block .

On my client side (WPF) I have a service reference. When I update the service reference, the generated classes do not have validation rule attributes in them.

How can I get rules from the service? Am I missing a step or is it not possible?

+2


a source to share


1 answer


Using Add Service Reference creates proxy classes for this service. However, this will not preserve all of your validation attributes, it will simply create properties that match the service metadata. To preserve the validation rules, you need to separate service contracts and data between WCF and WPF.

To do this, move all of your service contracts and data to an assembly. WCF and WPF must reference this assembly. Then you can create your own proxy class using ClientBase or ChannelFactory .



Since both WCF and WPF refer to the same classes annotated with VAB attributes, you can invoke validation in both WCF and WPF using the Enterprise Library.

+3


a source







All Articles