Re: How can i serialize a TreeNode object
From: Serg (serg_N0__SPAM__at_alef.ru)
Date: 04/15/04
- Next message: chr: "problem reading containers from webservice"
- Previous message: MR: "basic remtoing question"
- In reply to: Nick Grape: "Re: How can i serialize a TreeNode object"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 15 Apr 2004 12:13:52 +0400
Hi, Nick
thanks for replay
I did exactly as you said.
I did not register object in config file. And i have a function that returns
TreeNode object.
But it does not work. On the clients side returned TreeNode is visible as
proxy. And according to MSDN this is correct.
that is the cite from MSDN
"
When an object derives from MarshalByRefObject, an object reference is
passed from one application domain to another, rather than the object
itself. You can also mark an object that derives from MarshalByRefObject as
Serializable. When this object is used with remoting, the formatter
responsible for serialization, which has been preconfigured with a surrogate
selector (SurrogateSelector), takes control of the serialization process,
and replaces all objects derived from MarshalByRefObject with a proxy.
Without the SurrogateSelector in place, the serialization architecture
follows the standard serialization rules described in Steps in the
Serialization Process.
"
Suppose i should override default behaviour using SurrogateSelector or
RemotingSurrogateSelector. But i can`t find any example or detailed doc.
Is there any other ideas?
"Nick Grape" <ngrape@nospam> сообщил/сообщила в новостях следующее:
news:%23f%23FdWjIEHA.3220@TK2MSFTNGP12.phx.gbl...
> Hello Serg,
>
> Please don't register a tree node as a server object. Instead, create a
> "NodeProvider" remote class, which will return a node to clients via a
> method. Here is the code to illustrate the idea:
>
> // Remote object
> public class NodeProvider : MarshalByRefObject {
> TreeNode GetNode(int id) {
> ...
> }
> }
>
> // Client side:
> RemotingConfiguration.Configure("myapp.exe.config");
> NodeProvider nodeProvider = new NodeProvider();
> TreeNode node = nodeProvider.GetNode(0);
>
> Regards
> Nick
>
>
- Next message: chr: "problem reading containers from webservice"
- Previous message: MR: "basic remtoing question"
- In reply to: Nick Grape: "Re: How can i serialize a TreeNode object"
- Messages sorted by: [ date ] [ thread ]