I have a wcf contract that works with client v1.
Now I'm working on service v2, and i want to mark some of the fields as deprecated, So client v1 will see and use them, and client v2 will ignore them.
Are there any best practices for this issue? Are there any existing attributes in WCF that i should use?
thanks.
You can decorate your old properties as [Obsolete]
but the client will only see them if they use a DLL reference and not service/web reference (WSDL). [Obsolete]
decoration will not be passed to the client that uses WSDL to generate the proxy.
In terms of WCF versioning, once you have published an interface, you cannot remove any methods or in terms of contract you should really not remove any properties. You can publish a new interface and create a separate DTO class if you want new clients to use them.
Ref: Obsolete Attribute.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With