I have a WSDL-fisrt approach to generating Web Services. Basically, this means, I have a hand-crafted version of how I want my service to look, and then generate the WCF service by using svcutil.
This WSDL contains a lot of useful information such as minOccurs, maxOccurs, restrictions (regexp), etc. However, this information is completely lost when I get my auto-generated classes.
Is there any way I can capture this information in annotations (whether “standard” .net provided, or custom) on the properties so that I can perform validation on the objects after they’ve been deserialized?
Note: I know you can perform validation on the incoming stream through service behaviors and message inspectors, but I’m looking for a solution where I can perform validation on the generated code without having to write complex validation rules that I’ve already defined elsewhere. (i.e., I don’t want duplication)
Yes, you can translate any information from the WSDL into code, but not necessarily using svcutil. If you’re running up against the limitations of what svcutil supports, you might want to consider another code generation mechanism, such as T4 templates.