.Net Remoting store serialization file
-
Hi there, Wondering if anyone knows how to send an object that is already serialized in .Net remoting. And listen and read the serialized object that is being received. I want to be able to send a serialized object and recieve and store it in a database, as well as pull a serialized object out of the database and send it through .net remoting. Right now, I send an object that gets serialized and then deserialized at the other end. Then serialize it again to put it in the database. Then to send it, I pull it out of the database deserialize it and the send the object through .net remoting where it gets serialized again before it is sent. This is alot of overhead that should not be required. I'm sure there is probably an easy way to do this??? Thanks alot, I could easily see this being covered in another article but I have searched and can not find anything. thanks again.
-
Hi there, Wondering if anyone knows how to send an object that is already serialized in .Net remoting. And listen and read the serialized object that is being received. I want to be able to send a serialized object and recieve and store it in a database, as well as pull a serialized object out of the database and send it through .net remoting. Right now, I send an object that gets serialized and then deserialized at the other end. Then serialize it again to put it in the database. Then to send it, I pull it out of the database deserialize it and the send the object through .net remoting where it gets serialized again before it is sent. This is alot of overhead that should not be required. I'm sure there is probably an easy way to do this??? Thanks alot, I could easily see this being covered in another article but I have searched and can not find anything. thanks again.
Another way, yes. Easier, perhaps not. The trick is to use the SOAP in the
SoapServerFormatterSink
without serializing and deserializing the object. You could overrideProcessMessage
to intercept the request and response streams appropriately and save these as text (since it is SOAP) to a database. You could then use this server formatter sink in your remoting configuration instead of the defaultSoapServerFormatterSink
which would serialize and deserialize the object. You could also use a regular sink in the chain to grab the SOAP and put it in a database, but the default formatter sink would still serialize and deserialize the object.-----BEGIN GEEK CODE BLOCK----- Version: 3.21 GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++ -----END GEEK CODE BLOCK-----
-
Hi there, Wondering if anyone knows how to send an object that is already serialized in .Net remoting. And listen and read the serialized object that is being received. I want to be able to send a serialized object and recieve and store it in a database, as well as pull a serialized object out of the database and send it through .net remoting. Right now, I send an object that gets serialized and then deserialized at the other end. Then serialize it again to put it in the database. Then to send it, I pull it out of the database deserialize it and the send the object through .net remoting where it gets serialized again before it is sent. This is alot of overhead that should not be required. I'm sure there is probably an easy way to do this??? Thanks alot, I could easily see this being covered in another article but I have searched and can not find anything. thanks again.
Oh, and you might consider configuring the formatter sink in your configuration file or through the
Properties
dictionary to useincludeVersions="false"
since your objects are being persisted and might change over the lifetime of the persisted data, meaning that (if you version your assemblies correctly) it would be valid because the Types would be different (even by simply changing the version). This could save you a lot of headaches down the road.-----BEGIN GEEK CODE BLOCK----- Version: 3.21 GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++ -----END GEEK CODE BLOCK-----
-
Another way, yes. Easier, perhaps not. The trick is to use the SOAP in the
SoapServerFormatterSink
without serializing and deserializing the object. You could overrideProcessMessage
to intercept the request and response streams appropriately and save these as text (since it is SOAP) to a database. You could then use this server formatter sink in your remoting configuration instead of the defaultSoapServerFormatterSink
which would serialize and deserialize the object. You could also use a regular sink in the chain to grab the SOAP and put it in a database, but the default formatter sink would still serialize and deserialize the object.-----BEGIN GEEK CODE BLOCK----- Version: 3.21 GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++ -----END GEEK CODE BLOCK-----
But how do I call the method to begin with. I would call the method on the client, but it would require an object to pass in, which it would then serialize, then i use a formatter and replace its serializing with mine from the database? This is the best I could come up with. How would I call a blank method for invoking the method, and then in the formatter chain input my serialized object in the formatter i make? I actually haven't done any remoting only read and looked at code samples. Thanks very much for the help. Ya, so all i need is to invoke the client proxy method, with blank info some how? and then add my serialized object in the formatter? Thanks again.
-
But how do I call the method to begin with. I would call the method on the client, but it would require an object to pass in, which it would then serialize, then i use a formatter and replace its serializing with mine from the database? This is the best I could come up with. How would I call a blank method for invoking the method, and then in the formatter chain input my serialized object in the formatter i make? I actually haven't done any remoting only read and looked at code samples. Thanks very much for the help. Ya, so all i need is to invoke the client proxy method, with blank info some how? and then add my serialized object in the formatter? Thanks again.
Everything in this case (if I understand your problem correctly) happens on the server. The client would be none-the-wiser what's going on at the server (as is typically the case anyway). The Remoting server is configured to use a derivative
SoapServerFormatterSink
- the sink in the chain that actually performs the serialization. This formatter sink merely saves the SOAP that represents the object to the database, and retrieves the SOAP from the database to send back to the client, so no serialization is actually performed. The implementation depends upon many things. For example, you could use a get and set method (don't use a property, though, because you'll incur an additional round trip to get the accessor). The client passes an object to the set method that gets serialized. It goes to the server in the form of anIMethodCallMessage
which you store the parameter in the database. For anIMethodReturnMessage
you get the stream from the database (for instance, using aTextReader
) and pass that back to the client. I hope this explains the concept a little better. As I mentioned the first time, this isn't necessarily an easy thing. It's just something you're going to have to try. It should work based on what I know and my experiences with .NET Remoting.-----BEGIN GEEK CODE BLOCK----- Version: 3.21 GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++ -----END GEEK CODE BLOCK-----
-
Everything in this case (if I understand your problem correctly) happens on the server. The client would be none-the-wiser what's going on at the server (as is typically the case anyway). The Remoting server is configured to use a derivative
SoapServerFormatterSink
- the sink in the chain that actually performs the serialization. This formatter sink merely saves the SOAP that represents the object to the database, and retrieves the SOAP from the database to send back to the client, so no serialization is actually performed. The implementation depends upon many things. For example, you could use a get and set method (don't use a property, though, because you'll incur an additional round trip to get the accessor). The client passes an object to the set method that gets serialized. It goes to the server in the form of anIMethodCallMessage
which you store the parameter in the database. For anIMethodReturnMessage
you get the stream from the database (for instance, using aTextReader
) and pass that back to the client. I hope this explains the concept a little better. As I mentioned the first time, this isn't necessarily an easy thing. It's just something you're going to have to try. It should work based on what I know and my experiences with .NET Remoting.-----BEGIN GEEK CODE BLOCK----- Version: 3.21 GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++ -----END GEEK CODE BLOCK-----