Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Problem with WCF and multiple namespaces - sharing object types across multiple service references

i have two web services. One with user functionality, one with admin functionality.

Both services effectively work with the same object types, for instance:

  • AdminService provides functionality for deleting/modifying Customer objects
  • UserService provides functionality for listing/reading Customer objects

Now in the client i have two service references, Webservices.Admin and Webservices.User.

If i use the UserService to retrieve Customer objects, i cannot manipulate those via the AdminService, since the UserService retrieves objects of type Webservices.User.Customer, however the AdminService works with objects of type Webservices.Admin.Customer.

On the server side both types are identical, just belong to different namespaces in the client.

Now the question: How can i share types across different service references?

like image 297
Roasted Battle Squirrel Avatar asked Oct 15 '22 11:10

Roasted Battle Squirrel


1 Answers

Check out https://github.com/geersch/WcfSvcMap By tweaking the Reference.svcmap file you can make sure only one class is generated for each DataContract used by the different service references.

Note: Remember to delete the content of the node before pressing 'Update Service Reference'

like image 88
Andreas Willadsen Avatar answered Oct 19 '22 03:10

Andreas Willadsen