I have asked this question [here](https://entityframework.codeplex.com/discussions/569592), but got no response.
So, here's the problem. I have lots of tables and lots of columns in them. The program is used by many users, so that each of them must see the changes of each other. As I said in that post, when I need fresh data from database, EF takes data not from database, but from local cache. In [similar post](https://entityframework.codeplex.com/discussions/569761) it was insisted to use fresh context every time I need fresh data. So, it means that every time EF will initialize quadrillions of tables and columns? This is not an option, really. Please, add some "LoadDataFromDatabase" method to clear local cache and populate it with fresh data.
Also, disposing context after binding retrieved data to DataGrid doesn't let edit data in it and persist because, well, the context has been disposed! The actual error "System.InvalidOperationException: The operation cannot be completed because the DbContext has been disposed".
Comments: __EF Team Triage:__ Using a contexts with a small scope that can be easily thrown away is the correct way to solve this stale data problem. You mentioned that your concern with this approach is that "every time EF will initialize quadrillions of tables and columns". EF does a lot of caching of metadata etc. and we have done work to optimize the context creation code path so that it should be fast. If you have a context with a lot of data then it seems that the bulk of time would be spent re-loading data. Using a fresh context is still going to be faster because you would need to load the same amount of data to refresh the existing objects but with a fresh context you don't need to worry about merging etc.
So, here's the problem. I have lots of tables and lots of columns in them. The program is used by many users, so that each of them must see the changes of each other. As I said in that post, when I need fresh data from database, EF takes data not from database, but from local cache. In [similar post](https://entityframework.codeplex.com/discussions/569761) it was insisted to use fresh context every time I need fresh data. So, it means that every time EF will initialize quadrillions of tables and columns? This is not an option, really. Please, add some "LoadDataFromDatabase" method to clear local cache and populate it with fresh data.
Also, disposing context after binding retrieved data to DataGrid doesn't let edit data in it and persist because, well, the context has been disposed! The actual error "System.InvalidOperationException: The operation cannot be completed because the DbContext has been disposed".
Comments: __EF Team Triage:__ Using a contexts with a small scope that can be easily thrown away is the correct way to solve this stale data problem. You mentioned that your concern with this approach is that "every time EF will initialize quadrillions of tables and columns". EF does a lot of caching of metadata etc. and we have done work to optimize the context creation code path so that it should be fast. If you have a context with a lot of data then it seems that the bulk of time would be spent re-loading data. Using a fresh context is still going to be faster because you would need to load the same amount of data to refresh the existing objects but with a fresh context you don't need to worry about merging etc.