How to force Entity Framework to always get updated data from the database?

前端 未结 5 1885
[愿得一人]
[愿得一人] 2020-12-07 21:44

I am using EntityFramework.Extended library to perform batch updates. The only problem is EF does not keep track of the batch updates performed by the library. So when I que

5条回答
  •  天涯浪人
    2020-12-07 22:33

    Please try this to refresh a single entity:

    Context.Entry(entity).Reload()
    

    Edit: To get fresh data for a collection of entities is worth trying to dispose the DbContext instance after each request.

提交回复
热议问题