开发者

Sharing classes between multiple WCF services

I have two WCF services, one for reading operations and the other one for writing operations.

Although they are doing different operations, both of them are sharing the same classes (through a DLL reference to other project wich supports the model of the problem).

My problem is that, when I try to add both services to my C# project I can't share the same namespace:

Cannot create a service reference with namespace 'X' because the name is already in use by an existing service reference, folder or file

If services are placed in different namespaces, classes are different and duplicated code grows a lot.

开发者_如何转开发

Is there any solution?

Edition: Very similar to: Two WCF services with different contracts but same business objects . No solution anyway.


If you use VS 2010 (probably works on 2008 also) click advanced button in "add service reference" window and use "reuse types in specified referenced assemblies". You may have to move generated types to other assembly depending on how your project look like.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜