[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.remoting

Passing XMLNodes from ServicedComponent to Client

M.Sameer

10/16/2004 9:32:00 AM

Hi everyone,
I made class hierarchy to represent the XML data as object tree at
runtime.
All classes inherit from XMLNode class which inherits from Object class.
I use ServicedComponent to read the XML and construct the object tree so the
ServicedComponent is the container of the XML document root object.

I want to be able to access the XMLNode objects from the client.

Does marking the classes with Serializable attribute will do the job?
Do I have to build my own classes which inherit from MarshalByRefObject?
Do I have to build my own classes which inherit from
MarshalByValueComponent?

Are there any ideas?

Thanks in advance
M.Sameer


14 Answers

Sam Santiago

10/16/2004 6:46:00 PM

0

This is no MarshalByValueComponent. Making your classes serializable and
not inherited from MarshalByRefObject effectively makes your objects
marshaled-by-value:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconmarshalb...

In your scenario, if you simply want to give the clients readonly access to
the data then marshal-by-value might be a good approach. If you want update
capabilities, then marhal-by-value might still be a better approach (pass
objects between client and server) than having the XMLNode objects being
derived from MarshalByRefObject and having all client calls cross app domain
(and perhaps network) boundaries.

Thanks,

Sam

--
_______________________________
Sam Santiago
ssantiago@n0spam-SoftiTechture.com
http://www.SoftiTe...
_______________________________
"M.Sameer" <msameer1 at hotmail dot com> wrote in message
news:OyMQDL2sEHA.1180@TK2MSFTNGP10.phx.gbl...
> Hi everyone,
> I made class hierarchy to represent the XML data as object tree at
> runtime.
> All classes inherit from XMLNode class which inherits from Object class.
> I use ServicedComponent to read the XML and construct the object tree so
the
> ServicedComponent is the container of the XML document root object.
>
> I want to be able to access the XMLNode objects from the client.
>
> Does marking the classes with Serializable attribute will do the job?
> Do I have to build my own classes which inherit from MarshalByRefObject?
> Do I have to build my own classes which inherit from
> MarshalByValueComponent?
>
> Are there any ideas?
>
> Thanks in advance
> M.Sameer
>
>


M.Sameer

10/17/2004 7:03:00 AM

0

Does marking classes Serializable will make it possible to access public
properties that are also objects?

M.Sameer


Robert Jordan

10/17/2004 10:55:00 AM

0

M.Sameer wrote:

> Does marking classes Serializable will make it possible to access public
> properties that are also objects?

Yes, but only when these objects are serializable, too.
Otherwise a SerializationException will be thrown.

Binary serialization always descends the whole object
graph following all references. That's very comfortable,
but it also implies, that *all* involved objects are
serializable.

You may control the serialization process by placing
[NonSerialized] attributes on fields that cannot be
serialized, but this doesn't make always sense (the
fields will be initialized with "null" in the other
process). You can reinitialize such fields by
implementing then IDeserializationCallback and/or
ISerializable interfaces.

bye
Rob

M.Sameer

10/18/2004 12:11:00 PM

0

Does the ancestor of all my classes have to be serializable too for the
classes to be serializable?

I marked the classes with the serializable attribute but I'm getting
SerializationException because TXMLNode which is the ancestor of all classes
is not serializable.

M.Sameer


Robert Jordan

10/18/2004 12:25:00 PM

0

M.Sameer wrote:

> Does the ancestor of all my classes have to be serializable too for the
> classes to be serializable?
>
> I marked the classes with the serializable attribute but I'm getting
> SerializationException because TXMLNode which is the ancestor of all classes
> is not serializable.

Yes, you have.

bye
Rob

M.Sameer

10/18/2004 1:01:00 PM

0

Then marking my classes as serializable is not the right approach because I
inherit from a ready-made classes like the XMLNode class wich is in
System.XML namespace.

Now how can I pass objects wich descend from XMLNode between client and
ServicedComponent?

Thanks in advance,
M.Sameer


Robert Jordan

10/18/2004 1:11:00 PM

0

M.Sameer wrote:

> Then marking my classes as serializable is not the right approach because I
> inherit from a ready-made classes like the XMLNode class wich is in
> System.XML namespace.
>
> Now how can I pass objects wich descend from XMLNode between client and
> ServicedComponent?

Well, XmlNodes have an inherent serialization representation:
the XML itself. Why not passing the XML text?

bye
Rob

Ken Kolda

10/18/2004 3:35:00 PM

0

If you use the default serialization, then the answer is yes, all base
classes would also have to be marked as Serializable. However, if you
implement the ISerializable interface on your derived class then the base
class does not have to be serializable. It would be up to your derived class
to essential determine how to serialize and deserialize the base class's
data.

Ken


"M.Sameer" <msameer1 at hotmail dot com> wrote in message
news:u0PuItQtEHA.2300@TK2MSFTNGP09.phx.gbl...
> Does the ancestor of all my classes have to be serializable too for the
> classes to be serializable?
>
> I marked the classes with the serializable attribute but I'm getting
> SerializationException because TXMLNode which is the ancestor of all
classes
> is not serializable.
>
> M.Sameer
>
>


Sam Santiago

10/18/2004 3:38:00 PM

0

You could also provide an implementation of the ISerializable interface for
your object:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemruntimeserializationiserializableclas...

Thanks,

Sam

--
_______________________________
Sam Santiago
ssantiago@n0spam-SoftiTechture.com
http://www.SoftiTe...
_______________________________
"M.Sameer" <msameer1 at hotmail dot com> wrote in message
news:%23odmBJRtEHA.2660@TK2MSFTNGP12.phx.gbl...
> Then marking my classes as serializable is not the right approach because
I
> inherit from a ready-made classes like the XMLNode class wich is in
> System.XML namespace.
>
> Now how can I pass objects wich descend from XMLNode between client and
> ServicedComponent?
>
> Thanks in advance,
> M.Sameer
>
>


M.Sameer

10/19/2004 7:09:00 AM

0


"Robert Jordan" <robertj@gmx.net> wrote in message
news:cl0fcj$ql1$03$1@news.t-online.com...
> Well, XmlNodes have an inherent serialization representation:
> the XML itself. Why not passing the XML text?

The XML text is big.
Actually the ServicedComponent reads the whole XML and construct the object
tree so the objects will be available for clients when they request any of
them. I intend to make the ServicedComponent singleton too to save memory.
The object tree construction is not a straight forward process neither
because objects reference other objects so we actually have object network.

M.Sameer