Remoting with Interfaces
-
Hello, I'm using .NET 2.0 and setting up a remoting interface for a Windows Service. I like to be in control of how other applications use the service so I wanted to specify that client applications should only use the remoted object via an interface. My question is - Can I setup a client activated object so that clients don't have to know about the object class type (beyond the interface)? So far I have made this work for the server activated (singleton) styled remoted object. This works fine using (ISomeInterface) Activator.GetObject( SomeInterfaceType, ....), but when I try something similar with Activator.CreateInstance( SomeInterfaceType, ... ) the system complains I need a MarshalByRefObject type :( . I understand why it's refusing to activate the object, but I'm wondering if there is a way around this. BTW: If you are wondering why I want to use Client activated, it's because there is a future possibility of per client session information that needs to be evaluated per call. If each client has it's own object, then the instance can contain the session information. If I had to store per client session information in a singleton it would involve a lot more management complexity (add more code to maintain, slow things down at runtime, etc..).
Assert(this);