Adding WSDL scheme restrictions based on data annotations.

WCF

 .NET WCF does not support natively imposing schema restrictions such as string length, value range e.t.c

By using Data Annotations and this very useful example of implementing WSDL export extension, we can add the missing restrictions:

https://github.com/Independer/wcfdataannotations/issues/8

Several things to keep in mind:

1. The example uses SyncMethod which is empty when the operation is asynchronous, so test for TaskMethod as well.

 2. When importing the WSDL in a client, there is no special code generated to enforce these schema restrictions.

Post a Comment

Previous Post Next Post