WCF with multiple services and namespace issues

I created several WCF services, for arguments they are called Service1 and Service2 .

Both services return (at some point, possibly through a relationship within the object) the Client object .

For testing, I added the GetCustomer () method for both Service1 and Service2, and I added a link to the services for both services in the base WinForms application.

Service1Client proxy1 = new Service1Client ();

Customer customer1 = proxy1.GetCustomer (); //

^^^^^^ An ambiguous reference requires me to be called WcfTestClient.Service1.Customer

Service2Client proxy2 = new Service2Client ();

Customer customer2 = proxy2.GetCustomer ();

  

^^^^^ An ambiguous reference requires me to be called WcfTestClient.Service2.Customer

The problem is that the Customer object returned by Service1 and Service2 is a type of the same client (WcfTestService.Customer). To fix this, I need to include the full name of the assembly, not just the client.

I read several stack overflow reports stating that you can compile Data Contracts into a separate assembly, I especially dislike this idea, as it can still cause problems with clients using other languages ​​such as Java.

Another solution that I saw was the SvcUtil.exe method, but from what I saw, this solution does not affect my namespace problem, since I need to run Util for each service separately?

- , , !

+3
1

( - , , ) Customer.

, . WCF , REST , SOAP . .

, -, Visual Studio - , , . , - , , -.

, , , , , . , , -, .

+4

Source: https://habr.com/ru/post/1730054/


All Articles