none
Live data - Update from database - Entity Framework 4.2 RRS feed

  • Question

  • Hi,

    I'm using the Entity Framework 4.2 and the dbContext.

    I have a datagrid (wpf) that display data from a table in my database.

    When a change is done in the database, how can I update my datagrid without any click ?

    Thank you

    Friday, January 27, 2012 4:50 PM

Answers

  • From what I know the DbContext API has only calls to update individual entities - one by one - so you will have to iterate over the entities yourself; and then you still don't know which ones have been deleted in the DB...

    Generally, if you consider all possibilities and special cases of references between entities, synchronizing the context with the DB can get very complicated which makes a general/automated approach rather difficult. You can read about the caveats and a decent workaround for simple cases here:
    http://social.msdn.microsoft.com/Forums/en-US/adonetefx/thread/2cbe61f3-1e26-49d5-9ce9-82ae48b1cfbb


    Saturday, January 28, 2012 8:40 AM

All replies