DbSet<TEntity>.Local Property

Entity Framework 5.0

Returns ObservableCollection<T> that represents entities of the set that are currently being tracked by the context and have not been marked as Deleted. Accessing the Local property never causes a query to be sent to the database. This property is usually used after a query has already been executed.

Namespace:  System.Data.Entity
Assembly:  EntityFramework (in EntityFramework.dll)

public ObservableCollection<TEntity> Local { get; }



This property returns an ObservableCollection<T> that contains all Unchanged, Modified, and Added objects that are currently tracked by the context for the given DbSet. The returned observable collection stays in sync with the underlying DbSet collection and the contents of the context. This means that you can modify the observable collection or add/remove entities to/from the underlying DbSet collection (that includes adding entities by executing a query) and both collections will be synchronized.

This property is often used in data binding applications. For more information, see Binding Objects to Controls.