When developing my service, I decided that I wanted to customize the namespaces resulting from WSDL.
For DataContracts, I came across a ContractNamespace attribute, which seemed like a good alternative to shortcuts, allowing you to uniquely set the same namespace for each DataContract. My initial attempt looked like this:
[assembly:ContractNamespace("http://types.mycompany.com/2010/08/03")] namespace MyCompany.MyContracts { [DataContract]
To my surprise, this did not work. After much mastering, I was successful when I finally set the attribute's ClrNamespace property equal to my CLR namespace (MyCompany.MyContracts in the example). So something like this
[assembly:ContractNamespace("http://types.mycompany.com/2010/08/03", ClrNamespace="MyCompany.MyContracts")]
My question is: why didn't this work the first way? My assumption was that without specifying the CLR firmware name, this attribute will affect all data types in the collection.
source share