Make WCF services to help use the same namespace when called from WCF Clients

We have two services, that can be called independently, but also can be used together. They have some common types, and if they called together, default Visual Studio proxy generation will create the same types in different namespaces.
There are multiple articles, that recommend to use command line SvcUtil instead of Visual Studio IDE.
The article How to reuse types across service endpoints suggests on client side manually update Reference.svcmap to include multiple <MetadataSources> and NamespaceMappings
Alternatively svcutil does allow you to specify multiple endpoints at a single time and utilize /r(/reference)  and /n(/namespace) parameters
.Another commonly discussing solution is to  Share Types Between WCF Service and Client., but client not always has access to served data types.

If you are writing services and wish to simplify coding by your clients, consider to create additional “wrapper” service, that will include implementations of both interfaces, that are implemented by original services.
The approach is mentioned in  Generating Proxy class file for webservices with sharing TYPES and Meineck.Net: WCF: Hosting multiple WCF services as one single service.
Note that wrapper service will describe methods from both services, but the actual methods are trivial- just redirect to individual services implementation.

posted @ Sunday, July 24, 2011 7:21 AM
Print

Comments on this entry:

No comments posted yet.

Your comment:



(not displayed)


 
 
 
 
 

Live Comment Preview:

 
«May»
SunMonTueWedThuFriSat
293012345
6789101112
13141516171819
20212223242526
272829303112
3456789