WCF Data Contract Versioning
One of the greatest challenges when building any Webservice especially if it involves various clients connected is the issue of versioning. Following is possible version changes that WCF can handle by default:
Adding new Parameters to an Operation | Client unaffected. New parameters initialize to default values at the service |
Removing parameters from an operation | Client Unaffected. WCF ignores old parameters, data lost at the service |
Modifying Parameter types | Exception will occur if the incoming type from client is different from server |
Modifying return value types | Exception will occur |
Adding new operations | Client unaffected. Will not invoke operations it knows nothing about |
Removing operations | Exception. It would be unknown action header |
Operation contract changes possible solutions:
1) Service contract Inheritance
2) Brand new service contract with new namespace
Data contract changes
1) Adding IExtensibleDataObject
* ExtensibleDataObject is basically Key-Value dictionary
* This dictionary holds properties that old or future code contracts don’t have
* Basically it preserves the properties that don’t exists in the request or response
* Need to use svcutil.exe or visual studio reference to utilize this.
- By default all proxy class’s have this
Example:
<< Home