Following MSDN documentation we can use Local property to get local/cached data directly from the context without additional requests to a data source:
Gets an ObservableCollection that represents a local view of all Added, Unchanged, and Modified entities in this set.
(...)
This property can be used for data binding by populating the set with data, for example by using the Load extension method, and then binding to the local data through this property.
The problem is, that code is not working (Local is empty):
context.SampleEntities.Select(x => new { x.A, x.B }).Load();
// context.SampleEntities.Local.Count is 0
But in this case, it seems working correctly:
context.SampleEntities.Load();
// context.SampleEntities.Local.Count is not 0
Maybe someone can explain what is the correct way to use Local property?
What is more, how to use it with partially loaded entities, like in the case above?