You can't use MarhalByRef in your example. The root of the object
inheritance chain would have to be MarshalByRef, and Control is not. That's
why you' have to implement ISerializable, in order to control the
serialization process.
Have a look at:
http://samples.gotdotnet.com/quickstart/howto/doc/ISerializable.aspx
for an example
> ok, after checking on MSDN, I found something about MarshalByReference and
> I
[quoted text clipped - 15 lines]
>> > > []'s
>> > > Sushi
ThunderMusic - 27 Feb 2005 12:22 GMT
ok, but the controls I use are always controls ? created, so can I make them
inherit from MarshalByRefObject? and then use them that way?
thanks a lot
> You can't use MarhalByRef in your example. The root of the object
> inheritance chain would have to be MarshalByRef, and Control is not. That's
[quoted text clipped - 24 lines]
> >> > > []'s
> >> > > Sushi
Sean Hederman - 28 Feb 2005 05:17 GMT
No you can't. The base Control class itself is not a MarshalByRef object. If
you inherit from MarshalByRefObject then your class is not a control. If you
inherit from Control (or any of it's child classes) you're root object is
Object not MarshalByRefObject.
> ok, but the controls I use are always controls ? created, so can I make
> them
[quoted text clipped - 37 lines]
>> >> > > []'s
>> >> > > Sushi
ThunderMusic - 28 Feb 2005 15:52 GMT
thanks a lot... now it's clear... ;)
> No you can't. The base Control class itself is not a MarshalByRef object. If
> you inherit from MarshalByRefObject then your class is not a control. If you
[quoted text clipped - 42 lines]
> >> >> > > []'s
> >> >> > > Sushi
ThunderMusic - 27 Feb 2005 15:15 GMT
Will this serialisation allow me to pass the control from my service to the
application or will I need to create an instance of the control in my app
and get the informations to display what I need to display from the service?
I mean, to get a reference to the existing control from the service would be
much more efficient, if it can be done.
I don't understand much about the serialisation in this case and/or
MarshalByRefObject. I don't know the differences and if one or the other can
be used considering all the controls used will be made by me, so they can
inherit from both (or can't they?)
> You can't use MarhalByRef in your example. The root of the object
> inheritance chain would have to be MarshalByRef, and Control is not. That's
[quoted text clipped - 24 lines]
> >> > > []'s
> >> > > Sushi
Joshua Flanagan - 28 Feb 2005 00:53 GMT
Serialization and MarshalByRef are two different ways to access objects
from a different AppDomain (or "process").
Serialization is like passing an object ByVal - the contents is copied
from one process to the other, so that the object can be re-created in
the calling process.
MarshalByRef is like passing an object ByVal - a reference is copied
from one process to the other, and a proxy object is created in the
calling process. The client application has a reference to the proxy
object. Any calls to methods/properties on the "proxy" object in the
client get serialized and passed to the "real" object running in the
server process. The server object performs the work and then serializes
any return value to pass back to the proxy and the calling client code.
I think for the application you are trying to create, you would be
better off using MarshalByRef. However, you do not necessarily have to
make your existing objects/controls MarshalByRef. It might be a better
design to create monitoring objects designed specifically for this
purpose. They will inherit from MarshalByRef, and their methods will be
designed not to chatty. They expose a simple interface that doesn't
require a lot of serialization for the method parameters or return
values. The implementation of the methods handles all of the
communication with the real controls you are trying to monitor, running
in the service.
Take a little time to familiarize yourself with remoting before diving
into a solution. Do a google search for ".net remoting" and you should
find a number of good articles that explain the hows and whys. If you
have the time for a book, check out Rocky Lhotka's "Expert One-on-One
Visual Basic .NET Business Objects".
-Joshua Flanagan
> Will this serialisation allow me to pass the control from my service to the
> application or will I need to create an instance of the control in my app
[quoted text clipped - 41 lines]
>>>>>>[]'s
>>>>>>Sushi
ThunderMusic - 28 Feb 2005 15:53 GMT
thanks a lot, I'll see what I can do with it... The difference you made
between the two makes things clearer.
> Serialization and MarshalByRef are two different ways to access objects
> from a different AppDomain (or "process").
[quoted text clipped - 66 lines]
> >>>
> >>>"ThunderMusic" <NOdanylat@sympatico.caSPAMATALL> a ?crit dans le
message
> >>>de
> >>>news:uam23MGHFHA.2156@TK2MSFTNGP09.phx.gbl...
[quoted text clipped - 9 lines]
> >>>>>>[]'s
> >>>>>>Sushi