question about Serialization

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Bjorn

    #1

    question about Serialization

    Hi,

    I read a lot of things about Serialization but i'm not sure i understand
    what it is really doing.
    Anyway, i use in my application the 'Profiles' which must contain things
    like name of customers, address... and a kind of shoppinglist.
    Therefore i created a class with "<Serializable( )" and i created the
    profiles in web.config and added "serializeAs="B inary", just like i read in
    some doc. Everything works perfectly.

    Now i removed "<Serializable( )" from the class file and
    "serializeAs="B inary" from web.config and it still works.

    Could somebody explain me the difference between the two situations: with
    "<Serializable( )" and without "<Serializable( )" ? What does that do and is
    it recommended?

    Thanks in advance
    Bjorn


    in App_Code:
    <Serializable() _
    Public Class myClass
    Private _name As string
    .....
    end class


    in web.config:
    <profile>
    <properties>
    ...........
    <add shoppinglist="e Comm" serializeAs="Bi nary" .../>
    </properties>
    </profile>



  • Phill W.

    #2
    Re: question about Serialization

    Bjorn wrote:
    I read a lot of things about Serialization but i'm not sure i understand
    what it is really doing.
    A Serializable object has code either in it or provided for it by the
    Framework that allows it to be "written" out to and "read" back in from
    an alternative, "portable" format (commonly Xml).

    Typically, I use this to throw objects back and forth across the "Great
    ..Net Remoting Divide"; the client serializes an object to be passed,
    hurls the serialized form across a socket connection to the server,
    which dutifully "unpacks" it at the other end into [the same] object,
    ready for use there.
    Anyway, i use in my application the 'Profiles' which must contain things
    like name of customers, address... and a kind of shoppinglist.
    Therefore i created a class with "<Serializable( )" and i created the
    profiles in web.config and added "serializeAs="B inary", just like i read in
    some doc. Everything works perfectly.
    Does "everything " include any calls to [formatter].Serialize()?
    Or putting an object into, say, the ASPNET Session object?

    If you don't use the Serialization methods on the object then it doesn't
    matter whether the object is Serializable or not.

    HTH,
    Phill W.

    Comment

    • Bjorn

      #3
      Re: question about Serialization

      Hi thanks for helping..

      The global.asax is empty (so no session object).
      About "calls to [formatter].Serialize()", i have no such a thing ...
      I suppose the object you mean to be serialised is the shoppinglist?
      Can you give an example of code with c"alls to [formatter].Serialize()" and
      where it should be placed? Or an example of in the session object?

      And, i still don't understand the advantage of this (transforming data in
      xml format) in the context of my application. Will it run faster?
      Thanks



      "Phill W." <p-.-a-.-w-a-r-d-@-o-p-e-n-.-a-c-.-u-kschreef in bericht
      news:erumg5$82e $1@south.jnrs.j a.net...
      Bjorn wrote:
      >
      >I read a lot of things about Serialization but i'm not sure i understand
      >what it is really doing.
      >
      A Serializable object has code either in it or provided for it by the
      Framework that allows it to be "written" out to and "read" back in from an
      alternative, "portable" format (commonly Xml).
      >
      Typically, I use this to throw objects back and forth across the "Great
      .Net Remoting Divide"; the client serializes an object to be passed, hurls
      the serialized form across a socket connection to the server, which
      dutifully "unpacks" it at the other end into [the same] object, ready for
      use there.
      >
      >Anyway, i use in my application the 'Profiles' which must contain things
      >like name of customers, address... and a kind of shoppinglist.
      >Therefore i created a class with "<Serializable( )" and i created the
      >profiles in web.config and added "serializeAs="B inary", just like i read
      >in
      >some doc. Everything works perfectly.
      >
      Does "everything " include any calls to [formatter].Serialize()?
      Or putting an object into, say, the ASPNET Session object?
      >
      If you don't use the Serialization methods on the object then it doesn't
      matter whether the object is Serializable or not.
      >
      HTH,
      Phill W.

      Comment

      • Bjorn

        #4
        Re: question about Serialization

        Does "serializeAs="B inary" in web.config not replacethe Serialization
        method ?
        In the whole project, i couldn't find any [formatter].Serialize().



        "Phill W." <p-.-a-.-w-a-r-d-@-o-p-e-n-.-a-c-.-u-kschreef in bericht
        news:erumg5$82e $1@south.jnrs.j a.net...
        Bjorn wrote:
        >
        >I read a lot of things about Serialization but i'm not sure i understand
        >what it is really doing.
        >
        A Serializable object has code either in it or provided for it by the
        Framework that allows it to be "written" out to and "read" back in from an
        alternative, "portable" format (commonly Xml).
        >
        Typically, I use this to throw objects back and forth across the "Great
        .Net Remoting Divide"; the client serializes an object to be passed, hurls
        the serialized form across a socket connection to the server, which
        dutifully "unpacks" it at the other end into [the same] object, ready for
        use there.
        >
        >Anyway, i use in my application the 'Profiles' which must contain things
        >like name of customers, address... and a kind of shoppinglist.
        >Therefore i created a class with "<Serializable( )" and i created the
        >profiles in web.config and added "serializeAs="B inary", just like i read
        >in
        >some doc. Everything works perfectly.
        >
        Does "everything " include any calls to [formatter].Serialize()?
        Or putting an object into, say, the ASPNET Session object?
        >
        If you don't use the Serialization methods on the object then it doesn't
        matter whether the object is Serializable or not.
        >
        HTH,
        Phill W.

        Comment

        Working...