Ask Visual Studio to share a namespace with multiple service links

Is there any way to shorten the encoding of the Reference.cs file so that Visual Studio allows multiple service links to distribute the namespace?

I am developing a client application that uses several services that are part of the same solution. Something in line with Microsoft Project Service Interface (PSI) API for MS-Project Server. Instead of having a different namespace for each individual service link, for example:

MyProject.ProjectService.ProjectServiceClient MyProject.ResourceService.ResourceServiceClient MyProject.TimesheetService.TimesheetServiceClient 

it would be nice if we could throw them all in one namespace, for example:

 MyProject.Services.ProjectServiceClient MyProject.Services.ResourceServiceClient MyProject.Services.TimesheetServiceClient 

Along with this, the possibility of sharing common code. For example, if any of these services has opened the same data contract. Right now, if I want to write code that my client can use, I need to create a separate version for each service proxy, because a common contract exists in three different namespaces. See where I'm going?

Maybe?

UPDATE

Suppose I don’t have access to utility code (because I don’t do this), which means the shared class library is not an option. What are my options in this case?

+4
source share
1 answer

You can put these common classes in a class library that is shared by both services and clients. Then Visual Studio will not generate classes for each service link, but instead will use a common class library.

+1
source

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


All Articles