We are loading data from db:
var somethings = Context.SomethingSet.ToList();
Then someone deletes or adds rows outside of context. Out context still has caches deleted object, because it doesn't know they were deleted. Even if I call Context.SomethingSet.ToList(), our context still contains deleted objects and navigation properties are not correct.
What is the best method to refresh whole set from database?
Context.Refresh(RefreshMode.StoreWins, somethings)
first andvar somethings = Context.SomethingSet.ToList()
to get added rows, because refresh won't add them. I just noticed in profiler that refresh goes in one query, so performance is quite good. Thanks. – Bartholomew