Custom ObjRef class

  • Thread starter Thread starter Matt Osborne
  • Start date Start date
M

Matt Osborne

Hello:

I have a client server application that I am currently developing and have
some issues that I feel can be best resolved using a custom ObjRef child
class. I have created the class OK, and have overridden my
MarshalByRefObject child class so that the CreateObjRef returns an instance
of my new custom ObjRef derivative.

I can see the server create my ObjRef class and I can also see my ObjRef
class being serialized by the server, but It appears that my ObjRef class is
never deserialize by the client. Does anybody else have experience with
custom ObjRef classes and if so, is there something that I need to be doing
to get my MarshalByRefObjects to be marshaled using my ObjRef class?

Thank you for your help

Matt Osborne
 
HI,
When your MBRO marshal to client site,the CreateObjRef would never be
called at client site because the real MBRO is at server site.

When the client get the info of the MBRO of server,dotnet will
deserialize it to the normal ObjRef class. And then, dotnet will create a
RealProxy and use RemotingService.Unmarshal to combine the ObjRef and
RealProxy into TransparentProxy.

What you get the object at the client site is just the TransparentProxy.
When you invoke methods on the TransparentProxy, the RealProxy.PrivateInvoke
will be called, and the methodcall information will be send to the server
and invoke the real object.

The child class of ObjRef is not important. you should set the
ObjRef.ChannelInfo/EnvoyInfo/TypeInfo as your custom info class. these infos
would be serialize at server and deserialize at client, these would be more
helpful.

--


Thanks.

Lostinet (MS .NET MVP)
(e-mail address removed)
 
Back
Top