locked
Detect entity changes without context RRS feed

  • Question

  • Hi    ,

     

    We have a client - server application with DAL on the server side    .

     

    We expose service to get some EF object .

     

    We are changing some stuff on the client side and send the updated EF object to the server.

     

    On the client side I want to Enable some features if the user has made some changes to the EF object , some changes are made directly on the object some are on its navigation properties.

     

    How can I Query the EF object if changes were made in it or inside all of its navigation properties?

     

    Regards

     

    E

     

     

     


    Coder
    Wednesday, August 3, 2011 11:47 AM

Answers

All replies

  • On 8/3/2011 7:47 AM, Equilibrium wrote:
    > Hi,
    >
    > We have a client - server application with DAL on the server side.
    >
    > We expose service to get some EF object.
    >
    > We are changing some stuff on the client side and send the updated EF
    > object to the server.
    >
    > On the client side I want to Enable some features if the user has made
    > some changes to the EF object , some changes are made directly on the
    > object some are on its navigation properties.
    >
    > How can I Query the EF object if changes were made in it or inside all
    > of its navigation properties?
    >
     
    Myself I would be using Data Transfer Object that was smart, mapping
    data out of the entity into the DTO and send it to the client. Client
    makes a change to an existing DTO or creates a new DTO, changes it and
    put it into a List<DTO> and sends them back. I would the check the state
    of the DTO to find out what is suppose to happen to it mapping it back
    to an entity and going back into context to persist the entity.
     
     
     
    Wednesday, August 3, 2011 6:18 PM
  • Hi,

    EF4 has suport for Self Tracking Entities were the entities track their changes with an ObjectTracker object that is built in inside the entity.
    Here is some data about STE: http://msdn.microsoft.com/en-us/library/ff407090.aspx 


    Gil Fink
    Thursday, August 4, 2011 8:03 AM