Comparing Object Values

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

    Comparing Object Values

    I have a WebService method that sends to the client an object array received
    from the server as a collection. Each element in the object array is a class
    entity object. I would like to cache each of these class entities on the
    client which is a windows forms. When ready to send back, I would like to
    check if any of the class entity field values have changes.

    I tried to implement .Equals but does not work. Since the Web Service
    stripped the methods. What is the best way I can compare if the class entity
    field values have changed?
  • Dilip Krishnan

    #2
    Re: Comparing Object Values

    Hello GBR,
    Create a helper class that does the comparison. Anything that involves
    generated classes will be lost when they are regenerated

    HTH
    Regards,
    Dilip Krishnan
    MCAD, MCSD.net
    dkrishnan at geniant dot com
    Experience is the advantage. AI is the multiplier.

    [color=blue]
    > I have a WebService method that sends to the client an object array
    > received from the server as a collection. Each element in the object
    > array is a class entity object. I would like to cache each of these
    > class entities on the client which is a windows forms. When ready to
    > send back, I would like to check if any of the class entity field
    > values have changes.
    >
    > I tried to implement .Equals but does not work. Since the Web Service
    > stripped the methods. What is the best way I can compare if the class
    > entity field values have changed?
    >[/color]



    Comment

    • GBR

      #3
      Re: Comparing Object Values

      Hi Dilip,

      Could you please explain what you mean by Helper Class?

      For now, I have implemented an alternate solution. I wanted to write
      something generic to compare the object entity values received on the client
      through web services. Since none of the object enetity methods cannot be
      accesses on the client, I wrote a small function that uses reflection to peep
      into the object entity class and compare the values associated with the
      object entity fields.

      I am not sure if this is a good way of doing it but it works. I pass 2
      objects into this new function and it does the rest of the comparison.

      Thanks,

      "Dilip Krishnan" wrote:
      [color=blue]
      > Hello GBR,
      > Create a helper class that does the comparison. Anything that involves
      > generated classes will be lost when they are regenerated
      >
      > HTH
      > Regards,
      > Dilip Krishnan
      > MCAD, MCSD.net
      > dkrishnan at geniant dot com
      > http://www.geniant.com
      >[color=green]
      > > I have a WebService method that sends to the client an object array
      > > received from the server as a collection. Each element in the object
      > > array is a class entity object. I would like to cache each of these
      > > class entities on the client which is a windows forms. When ready to
      > > send back, I would like to check if any of the class entity field
      > > values have changes.
      > >
      > > I tried to implement .Equals but does not work. Since the Web Service
      > > stripped the methods. What is the best way I can compare if the class
      > > entity field values have changed?
      > >[/color]
      >
      >
      >
      >[/color]

      Comment

      • Dilip Krishnan

        #4
        Re: Comparing Object Values

        Hello GBR,[color=blue]
        > I am not sure if this is a good way of doing it but it works. I pass 2
        > objects into this new function and it does the rest of the comparison.[/color]

        Exactly what I meant by a Helper class.

        HTH
        Regards,
        Dilip Krishnan
        MCAD, MCSD.net
        dkrishnan at geniant dot com
        Experience is the advantage. AI is the multiplier.






        Comment

        Working...