Why does the ChangeTracker.State not change to "unchanged" if I SaveChanges for a navigation property? RRS feed

  • Question

  • Hi

    Following problem I have when working with STE in Entity Framework 4.1 and ChangeTracking enabled on all entities.

    "Employee" has a navigation property "ContactFacilities". If I add a "ContactFacility" to an Employee the ChangeTracker.State of the "ContactFacility" is "Added". This is correct so far.

    Then I do a context.SaveChanges() and the "ContactFacility" is stored in the database. But unfortunately the ChangeTracker.State of the "ContactFacility" remains on "Added"!

    If I add a completely new Employee, also the ChangeTracker.State of the "Employee" is on "Added". But when I do a context.SaveChanges() the ChangeTracker.State does change to "Unchanged".

    This does not make sense to me.

    Could anyone help what I have to do that the ChangeTracker.State on "ContactFacility" is also changed when I do context.SaveChanges()?

    Thank you very much for help!



    Beat Wuethrich
    Thursday, October 6, 2011 4:02 PM


All replies