[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

microsoft.public.dotnet.framework.remoting

How to use surrogate class for serialization?

Lord2702

10/7/2004 5:02:00 AM

Instead of writing [Serializable] and ISerializable, I want to write a
Surrogate class, now writing it is not very difficult, but how am I going to
use it in the .NET Remoting scenario ? C# code please.

Tia.


3 Answers

Ken Kolda

10/7/2004 3:13:00 PM

0

I don't believe it's possible to inject your own serialization surrogate
into the built-in remoting formatters. That would mean you'd have to write
your own formatter sink if this is really essential, but that is pretty
complicated to do correctly. What's the problem you're trying to solve via
the surrogate? Someone may be able to propose an alternate solution to the
one you're pursuing.

Ken


"Lord2702" <Lord2702@MSN.com> wrote in message
news:eXqpSrCrEHA.536@TK2MSFTNGP11.phx.gbl...
> Instead of writing [Serializable] and ISerializable, I want to write a
> Surrogate class, now writing it is not very difficult, but how am I going
to
> use it in the .NET Remoting scenario ? C# code please.
>
> Tia.
>
>


Lord2702

10/7/2004 7:00:00 PM

0

Thu. Oct. 07, 2004 11:55 AM PT

Hi Ken,

Thank you for your reply, and thanks for your guess that I want to do
something with serialization and surrogate issue. See the following article
in MSDN Magazine October 2004, by Dino Esposito.
http://msdn.microsoft.com/msdnmag/issues/04/10/Cu...
In the article he has specified how to improve the binary serialization in
remoting. I tried his DataTable class, but it is not working at all,
although, by just taking a FileStream and dump the object in to a file, is
really not a serialization, but I should be able to pass the object
(DataTable) to and from client and server. I also check Jeffrey Ritcher's
article on creating and using Surrogate class for serialization. If you see
the Guidelines in MSDN documentation how to serialize the object, then in
those steps the first step is, that dot net framework will check if
surrogate class is provided for the formatter, or not. then it goes for
serializable attrib, and ISerializable interface. Here is the Jeffrey's
article on surrogate: http://msdn.microsoft.com/msdnmag/issues/...
Also see this KB-829740 article http://support.microsoft.com/?k...
for Improving DataSet Serialization and Remoting Performance.
In this KB article a third party not Microsoft has given a class example how
to improve the DataSet serialization in remoting with Binary formatter. The
download files are available here:
http://download.microsoft.com/download/2/8/2/28275f15-5a26-41aa-9bd8-80972c699d17/Surrogate...
Now my sole intension is if I am able to improve this performance on
DataSet, DataTable, and DataView objects then I want to use it in my
remoting application. Of course in comming FCL library 2.0 MS has improved
this performance, but that still yet to come. I am still using Framework 1.1
with SP1.

That is it.

Thanks.


"Ken Kolda" <ken.kolda@elliemae-nospamplease.com> wrote in message
news:%23Hwt7AIrEHA.2732@TK2MSFTNGP09.phx.gbl...
> I don't believe it's possible to inject your own serialization surrogate
> into the built-in remoting formatters. That would mean you'd have to write
> your own formatter sink if this is really essential, but that is pretty
> complicated to do correctly. What's the problem you're trying to solve via
> the surrogate? Someone may be able to propose an alternate solution to the
> one you're pursuing.
>
> Ken
>
>
> "Lord2702" <Lord2702@MSN.com> wrote in message
> news:eXqpSrCrEHA.536@TK2MSFTNGP11.phx.gbl...
> > Instead of writing [Serializable] and ISerializable, I want to write a
> > Surrogate class, now writing it is not very difficult, but how am I
going
> to
> > use it in the .NET Remoting scenario ? C# code please.
> >
> > Tia.
> >
> >
>
>


Ken Kolda

10/7/2004 7:35:00 PM

0

I think your best bet is to use something like the DataSetSurrogate class
provided by the KB article you reference below. Essentially, this object
puts a wrapper around the DataSet that can be used to serialize/deserialize
it more efficiently. Note that even though they call this a "surrogate"
class, it's not used in the same way that other serialization surrogates
are. You would manually have to wrap your DataSet in an instance of the
DataSetSurrogate and then pass the surrogate to your client. The client
would receive the surrogate and extract the original DataSet from it.
Obviously, that's not as nice and transparent as it would be if you could
simply hook an ISurrogateSelector into the formatter sink, but I think it's
the best you've got.

Ken


"Lord2702" <Lord2702@MSN.com> wrote in message
news:ufzaO$JrEHA.1160@tk2msftngp13.phx.gbl...
> Thu. Oct. 07, 2004 11:55 AM PT
>
> Hi Ken,
>
> Thank you for your reply, and thanks for your guess that I want to do
> something with serialization and surrogate issue. See the following
article
> in MSDN Magazine October 2004, by Dino Esposito.
> http://msdn.microsoft.com/msdnmag/issues/04/10/Cu...
> In the article he has specified how to improve the binary serialization in
> remoting. I tried his DataTable class, but it is not working at all,
> although, by just taking a FileStream and dump the object in to a file, is
> really not a serialization, but I should be able to pass the object
> (DataTable) to and from client and server. I also check Jeffrey Ritcher's
> article on creating and using Surrogate class for serialization. If you
see
> the Guidelines in MSDN documentation how to serialize the object, then in
> those steps the first step is, that dot net framework will check if
> surrogate class is provided for the formatter, or not. then it goes for
> serializable attrib, and ISerializable interface. Here is the Jeffrey's
> article on surrogate: http://msdn.microsoft.com/msdnmag/issues/...
> Also see this KB-829740 article http://support.microsoft.com/?k...
> for Improving DataSet Serialization and Remoting Performance.
> In this KB article a third party not Microsoft has given a class example
how
> to improve the DataSet serialization in remoting with Binary formatter.
The
> download files are available here:
>
http://download.microsoft.com/download/2/8/2/28275f15-5a26-41aa-9bd8-80972c699d17/Surrogate...
> Now my sole intension is if I am able to improve this performance on
> DataSet, DataTable, and DataView objects then I want to use it in my
> remoting application. Of course in comming FCL library 2.0 MS has improved
> this performance, but that still yet to come. I am still using Framework
1.1
> with SP1.
>
> That is it.
>
> Thanks.
>
>
> "Ken Kolda" <ken.kolda@elliemae-nospamplease.com> wrote in message
> news:%23Hwt7AIrEHA.2732@TK2MSFTNGP09.phx.gbl...
> > I don't believe it's possible to inject your own serialization surrogate
> > into the built-in remoting formatters. That would mean you'd have to
write
> > your own formatter sink if this is really essential, but that is pretty
> > complicated to do correctly. What's the problem you're trying to solve
via
> > the surrogate? Someone may be able to propose an alternate solution to
the
> > one you're pursuing.
> >
> > Ken
> >
> >
> > "Lord2702" <Lord2702@MSN.com> wrote in message
> > news:eXqpSrCrEHA.536@TK2MSFTNGP11.phx.gbl...
> > > Instead of writing [Serializable] and ISerializable, I want to write a
> > > Surrogate class, now writing it is not very difficult, but how am I
> going
> > to
> > > use it in the .NET Remoting scenario ? C# code please.
> > >
> > > Tia.
> > >
> > >
> >
> >
>
>