Search code examples
wcfnamespacesdatacontractservicecontract

What is the format of the DataContractAttribute.Namespace Property?


This MSDN article recommends always to provide a namespace to a ServiceContract and DataContract.

Examples usually have a "schema" prefix and a URI type pattern for the namespace such as

Namespace="urn:WCFEssentials/Samples/2008/12"

instead of a traditional C# namespace with dot-notation such as

Namespace="MyNamespace.MyDataClasses"

What is the suggested format the namespace property? Do we need the schema prefix? Why is this format suggested?


Solution

  • It's an XML Namespace. Those can either be in the urn: format or they can be URLs.