A problem with .NET 2.0 project, using a 3.0 DLL which implements WCF services.

Posted by avance70 on Stack Overflow See other posts from Stack Overflow or by avance70
Published on 2010-06-14T13:47:51Z Indexed on 2010/06/14 13:52 UTC
Read the original article Hit count: 189

Filed under:
|
|
|
|

I made a client for accessing my WCF services in one project, and all classes that work with services inherit from this class:

public abstract class ServiceClient<TServiceClient> : IDisposable where TServiceClient : ICommunicationObject

This class is where I do stuff like disposing, logging when the client was called, etc. some common stuff which all service classes would normally do.

Everything worked fine, until I got the task to implement this on an old system. I got into a problem when I used this project (DLL) in an other project which cannot reference System.ServiceModel (since it's an old .NET 2.0 software that I still maintain, and upgrading it to 3.0 is out of the question). Here, if I omit where TServiceClient : ICommunicationObject then the project can build, but the ServiceClient cannot use, for example, client.Close() or client.State

So, is my only solution to drop the where statement, and rewrite the service classes?

© Stack Overflow or respective owner

Related posts about c#

Related posts about wcf