I understand your dillema.
By inheriting from MarshalByRefObject you are indeed marshaling using a proxy so that the "service" instance will reflect any
changes made on the client, however, any members of your class must also be serialized.
The members must also be serializable in order to serialize the container, so they can be marshalled by value or by reference. This
means that they too must inherit from MarshalByRefObject to be marshaled by reference.
Yes, it's a limitation because you can only inherit from one object. You can use the ISerializeable interface to provide your own
serialization implementation, but this does not allow the Marshaller to create a proxy for your object. This is a by-value
implementation only, if I understand it correctly.
I'm sorry I can't offer much more on remoting. You may want to start posting directly in the remoting forums to see if there are
other solutions which still reside within those realms, although the built-in remoting framework is not your only option.
You can use sockets on a lower level to provide "custom" marshalling. Maybe create your own ScriptingServiceMarshaler that can
handle sending data to another ScriptingServiceMarshaler instance and block the thread until a response is received with the
appropriate call-back values.
I'd like to hear from other forum readers/writers on this topic. I may have skipped information that can help you, so don't
consider my response the be-all and end-all of your project. Maybe remoting is more robust then I give it credit for?
I must say, that "eval" type-functionality, as can be used in scripting languages, has probably not been implemented inside the
framework due to performance and security issues. Although ASP.NET performs runtime-compilation, it's expected that the application
has been built by developers, not end-user code. If your using this for any purpose other than serializing code at runtime that
will NOT be know before hand and for some reason cannot be "plugged" in to the main application through runtime-loaded assemblies,
then I would consider this as an option, otherwise explore a different solution. If the issue is simply cross-AppDomain execution,
the remoting framework can solve your problem without the use of "dynamic" code.
Security is a big factor to consider. "dynamic" code may be subject to injection attacks and other misuses of the framework if you
let an end-user enter the code. You'll have to consider a potentially large amount of CAS and probably impersonation on your
dynamic assemblies in order to prevent end-users from entering malisious code that can be executed with the trust of the main
assembly. Just running them in their own AppDomain may not be enough. That may prevent your main app from crashing, but not
securing the system.
I don't mean to lecture you, I'm probably out of place... but I've mentioned it for the benefit of other forum readers so they are
aware of the potential side-effects.
--
Dave Sexton
dave@www..jwaonline..com
-----------------------------------------------------------------------
"MatthewRoberts" <mroberts_hm@hotmail.com> wrote in message news:1111691704.049708.213900@o13g2000cwo.googlegr oups.com...[color=blue]
> Thanks for the reply. Is that the only way to accomplish what I want?
> Will use of interfaces not do the trick for two-way communication?
>
> There are many objects referenced in my chain, so would all of them
> have to inherit from MarshalByRefObject, or only the top parent object?
> If so, that is going to be impossible, and therefore I will not be able
> to do what I want. Some of the objects already inherit from other
> objects, which means they would lose functionality if inheriting from
> anywhere else.
>
> Just to make sure we are on the same page, I do inherit from
> MarshalByRefObject for by RemoteLoaderFactory, which is basically the
> scripting "engine" that is CREATED in the secondary AppDomain, but that
> is USED in the primary AppDomain. A reference to my IRemoteLoader
> interface is returned by the factory to the primary AppDomain so that
> it can then control the scripting AppDomain. But, what you are saying
> is that even my parameters that are sent to my script in the secondary
> AppDomain should inherit from MarshalByRefObject?
>
> There must be an easier way to accomplish this type of scripting
> functionality. I wish ByRef would just do the trick. Any other
> suggestions?
>[/color]