Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. .Net Remoting store serialization file

.Net Remoting store serialization file

Scheduled Pinned Locked Moved C#
csharpdatabasejsontutorialquestion
6 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    krisp
    wrote on last edited by
    #1

    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.

    H 2 Replies Last reply
    0
    • K krisp

      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.

      H Offline
      H Offline
      Heath Stewart
      wrote on last edited by
      #2

      Another way, yes. Easier, perhaps not. The trick is to use the SOAP in the SoapServerFormatterSink without serializing and deserializing the object. You could override ProcessMessage 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 default SoapServerFormatterSink 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-----

      K 1 Reply Last reply
      0
      • K krisp

        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.

        H Offline
        H Offline
        Heath Stewart
        wrote on last edited by
        #3

        Oh, and you might consider configuring the formatter sink in your configuration file or through the Properties dictionary to use includeVersions="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-----

        1 Reply Last reply
        0
        • H Heath Stewart

          Another way, yes. Easier, perhaps not. The trick is to use the SOAP in the SoapServerFormatterSink without serializing and deserializing the object. You could override ProcessMessage 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 default SoapServerFormatterSink 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-----

          K Offline
          K Offline
          krisp
          wrote on last edited by
          #4

          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.

          H 1 Reply Last reply
          0
          • K krisp

            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.

            H Offline
            H Offline
            Heath Stewart
            wrote on last edited by
            #5

            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 an IMethodCallMessage which you store the parameter in the database. For an IMethodReturnMessage you get the stream from the database (for instance, using a TextReader) 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-----

            K 1 Reply Last reply
            0
            • H Heath Stewart

              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 an IMethodCallMessage which you store the parameter in the database. For an IMethodReturnMessage you get the stream from the database (for instance, using a TextReader) 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-----

              K Offline
              K Offline
              krisp
              wrote on last edited by
              #6

              Ok, thanks very much for the help. That should help alot. :)

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups