0

I create a client-server application in VB.NET 2010 with EF 4.x STEs.

If i change the Entity the State is setting correct. But I if I change a sub-item, then the Entity-State is not changed - only of the SubItem.

How I must modified the tt-Templates so "see" changes in the whole entity-graph?

Ladislav Mrnka
  • 360,892
  • 59
  • 660
  • 670

1 Answers1

0

That is the correct behavior. Otherwise any change in entity would propagate modification flag into whole entity graph if navigation properties are bidirectional. The State is not for you to understand if something has changed but for EF to understand what exactly has changed to generate correct SQL commands.

Ladislav Mrnka
  • 360,892
  • 59
  • 660
  • 670
  • thanks for this clarification. But I use the entity-state property direct to enable the "Save"-Button. Is a better way to do that? Is needed to check all state of subitems and save the result in an internal variable before i send the result back? – Michael - KM-F Mar 20 '13 at 15:01
  • In such case you can add your own non-mapped flag which will check state of children (which may check state of their children) etc. – Ladislav Mrnka Mar 20 '13 at 15:04