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?