Note that there are some explanatory texts on larger screens.

plurals
  1. POnamespace dilemma in generating WCF proxies
    primarykey
    data
    text
    <p>I have several message contracts that use an external library to standardize a particular functionality between several services. Their code looks somewhat like this...</p> <pre><code>using System.ServiceModel; using Query.Search; [MessageContract(WrapperName = "MyMessageContract")] public partial class MyMessageContract { [MessageBodyMember(Name = "Search")] public SearchTerms Search { get; set; } } </code></pre> <p>The SearchTerms class is in the Query.Search DLL and looks like so...</p> <pre><code>public class SearchTerms : List&lt;SearchTerm&gt; { } </code></pre> <p>... with the SearchTerm class also in the same DLL. It works just fine in the service and knows that I'm addressing the Query.Search classes, but when I generate the proxies, these classes are reassigned to the wrong namespace and make it very difficult to build a service adapter in the UI. I'm using svcutil with the following arguments...</p> <pre><code>/t:code /mc /n:*,MyProject.UI.Proxies /ct:System.Collections.Generic.List`1 /l:cs /o:WSProxies.cs /config:output.config http://localhost:49207/Service1.svc?wsdl http://localhost:49207/Service2.svc?wsdl http://localhost:49207/Service3.svc?wsdl </code></pre> <p>Now, I understand that the namespace argument as it's defined here is basically assigning all my proxy namespaces to MyProject.UI.Proxies and if I remove it, the namespaces for my Query.Search class are set correctly. However, this means that all the other proxies now fall under the default "MyService.DataContracts" namespace in which they're defined. So I tried using...</p> <pre><code>/n:MyService.DataContracts,MyProject.UI.Proxies </code></pre> <p>... but had no luck as the output reverts to "MyService.DataContracts" after it's generated. What I'd like to be able to do is for my proxies to have the UI namespace of "MyProject.UI.Proxies" while maintaining the namespace for the SearchTerms class as "Query.Search" without manually modifying the output file so a new run of svcutil doesn't wipe out the manual changes. Is this possible and am I just using the /namespace argument wrong, or will I have to manually modify the output file every time I generate proxies?</p> <p><strong>EDIT:</strong> After a fruitless day of trying to get this working, I simply created a workaround, creating a set of similar classes in the services and translating them to the Query.Search ones. Would still be interested to know if what I wanted can be done but form what I've gathered, using these classes in a message contract sort of dooms it to be listed under the same namespace as the MC.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload