Well-known server activated object and IDisposable
From: Hani Atassi (hani_at_community.nospam)
Date: 06/17/04
- Next message: Robert Duan: "How to know in code it is debug mode or release mode in C#?"
- Previous message: Robert Duan: "Re: AppUpdater not working"
- Next in thread: [MSFT]: "RE: Well-known server activated object and IDisposable"
- Reply: [MSFT]: "RE: Well-known server activated object and IDisposable"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 17 Jun 2004 09:51:06 -0700
I created a singleton object using .NET Remoting. The object is created in a .NET remoting server and the same instance is marshaled to the client when the client creates a new object of it.
This singleton object is hosted under NTService and I need to destroy it when the service is stopped and create it again when the service is started. So, I thought I would implement the IDisposable interface on the class using the Disposable Pattern to clean the resources that I am using inside it.
But, what if the client called Dispose() or the client uses the using(){} keyword? In this case the cleanup code in the server will be executed which will result in unpleasant behavior from the other connected clients.
So, is it OK to implement IDisposable in my scenario or how can I prevent the client code from calling Dispose()?.. Is there a way to know if the call to the function came from a client or came from the remoting server? I tried RemotingServices.IsObjectOutOfAppDomain(this) but it always returns false if it's executed in the server..!
Any help is appreciated..
Thanks,
- Next message: Robert Duan: "How to know in code it is debug mode or release mode in C#?"
- Previous message: Robert Duan: "Re: AppUpdater not working"
- Next in thread: [MSFT]: "RE: Well-known server activated object and IDisposable"
- Reply: [MSFT]: "RE: Well-known server activated object and IDisposable"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|