I am specifying a Name and a Namespace for every contract in my WCF services, as outlined in Microsoft’s Service Versioning guidelines. However, in their example for each contract, Namespace is always suffixed with the Name value, like so:
[DataContract(
Name = "PurchaseOrder",
Namespace = "http://examples.microsoft.com/WCF/2005/10/PurchaseOrder")]
public class PurchaseOrderV1 : IPurchaseOrderV1
{
[DataMember(...)]
public string OrderId {...}
[DataMember(...)]
public string CustomerId {...}
}
Why is PurchaseOrder suffixed on the Namespace? Isn’t this redundant? Shouldn’t the Namespace be reflective of the whole immutable contract?
If I want my DataContracts and ServiceContracts to be strictly versioned together, shouldn’t the Namespace value be http://examples.microsoft.com/WCF/2005/10/ ?
This is natural.
http://examples.microsoft.com/WCF/2005/10/ defines a general product-version-like value. In the same way that you have more fine grained namespaces in your C# code, you would do the same with WCF namespaces.
At the end of the day, namespace is just a namespace and this kind of naming just a convention.