Xaisoft
Xaisoft

Reputation: 46591

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 proxy 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.

Upvotes: 1

Views: 676

Answers (1)

tomasr
tomasr

Reputation: 13849

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)

Upvotes: 2

Related Questions