Pinzi
Pinzi

Reputation: 293

WCF Service Reference and Reference to same project

I have a server-client legacy system which uses Microsofts WCF. In a ServiceClient project there is a service reference to the Service project. But the ServiceClient also has a "normal" reference to the Service project. In my opionen this destroys the complete server-client architecture, because the client has a reference to the Service class, but me colleague means it must be done this way. Is there any reason for having a Service Reference and Reference to the same project?

Upvotes: 0

Views: 302

Answers (1)

Sasha
Sasha

Reputation: 8860

You are right, there is no good reason for doing this. But I'm sure there are "reasons" for adding such reference (most likely due to poor solution structuring).

Classes which are really needed both on client side and server side should be extracted into a separate project (usually it contains data-transfer objects and service interface). Service class (which implements service interface) remains in special server-side project. Client shouldn't care about it's implementation or dependencies - it just needs interface.

So I would recommend refactoring your Service project to split it.

Upvotes: 1

Related Questions