Is my service contract namespace right?
I have doubts on my service contract namespace after what svcutil generated for the namespace.
It is setup like this:
[ServiceContract(Name="Colors", Namespace="http://colors.com/colors/2011/05")]
The pro开发者_JAVA百科xy code generated using svutil created the following namespace:
namespace colors.com.colors._2011._05
The issue I have with above is that I don't see many namespaces that look like the above especially with the date part of _2011._05 which makes me doubt if this is the proper way to set namespaces on service contracts.
That very much depends on what your service contract versioning scheme is, but many standard specs do include some date components in the namespace URI in some cases, and it's just fine.
I do agree the default generated code namespaces look ugly, but that will almost always be the case regardless of what scheme you choose :). And remember that you can override it when running svcutil by using the /namespace switch:
/namespace:<string,string> - A mapping from a WSDL or XML Schema
targetNamespace to a CLR namespace. Using
the '*' for the targetNamespace maps all
targetNamespaces without an explicit
mapping to that CLR namespace. Default:
derived from the target namespace of the
schema document for Data Contracts. The
default namespace is used for all other
generated types. (Short Form: /n)
精彩评论