Entity Framework 4.1 DbSet Reload

前端 未结 4 1559
抹茶落季
抹茶落季 2020-12-03 11:49

I\'m using a single instance of DbContext scenario to shadow entire copy of the database locally in a WPF app. I\'ve heard this is bad practice, but my database

4条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-03 12:23

    With Entity Framework 4.1, the recommendation for WPF data binding has changed to use .Local and a persistent DbContext.

    http://blogs.msdn.com/b/efdesign/archive/2010/09/08/data-binding-with-dbcontext.aspx

    It's, of course, possible to dispose of it whenever you need to, but it can negatively impact the UI if you do.

    Here's another method, but I'm not sure that it takes EF4.1's features into account:

    http://msdn.microsoft.com/en-us/library/cc716735.aspx

提交回复
热议问题