Vaccano
Vaccano

Reputation: 82507

Is there a way to get datasvcutil to generate code with a custom namespace?

When you generate client Service code using the Visual Studio UI you can select a namespace that you want to use.

However if you are generating client code using datasvcutil I can't seem to find a similar option. (It creates the namespace based on the service it is accessing.)

Is there a way to ask datasvcutil to generate the client code with a different namespace?

For example:

If you run this from the Visual Studio Command Line Prompt:

datasvcutil /out:"C:\temp\datasvc.cs" /uri:https://data.stackexchange.com/stackoverflow/atom /language:CSharp /version:2.0

Then the resulting file has a namespace of MetaModel.

However, if I do the same thing from the UI:

Add Service Reference Dialog

Then the resulting file has the namespace MyProject.StackOverflow.

Is there a way I can mimic what the UI does from the command line?

Upvotes: 3

Views: 658

Answers (1)

SalientBrain
SalientBrain

Reputation: 2551

Write powershell script with .net reflection methods to get namespace to generate appropriate command line and run datasvcutil with generated parameters

Upvotes: -1

Related Questions