My scenerio is like this:
On the server there is an application which exposes a COM object allowing to interact with this application programaticaly. However I can connect only once through COM due to licence restrictions. So, after initialization a COM object will return me a more specified ConnectionObject.
I need an advice what management model I schould chose for my service which will be interacting with the ConnectionObject:
Per-Call Service:
I have two options here:
I can log through COM, perform operation and Logout releasing the connection. But this logging process is somewhat time consuming.
I could create some sort of singleton class which could keep reference to the ConnectionObject. The problem is that I do not know how to share the same instance of object through different instances of the service? Is it possible?
Singleton Service:
The problem of sharing ConnectionObject does not exists. Object will be created at the begining of life of the service and freed when service will be shut down. However I've read that using this kind of service is not recommended.
Thanks for any advices.