0 out of 1 rated this helpful - Rate this topic

DbSet Class

Entity Framework

Represents an entity set that is used to perform create, read, update, and delete operations. A non-generic version of DbSet<TEntity> which can be used when the type of entity is not known at build time.

System.Object
  System.Data.Entity.Infrastructure.DbQuery
    System.Data.Entity.DbSet

Namespace:  System.Data.Entity
Assembly:  EntityFramework (in EntityFramework.dll)
public abstract class DbSet : DbQuery

The DbSet type exposes the following members.

  Name Description
Public property ElementType The IQueryable element type. (Inherited from DbQuery.)
Public property Local 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.
Top
  Name Description
Public method Add Adds the given entity to the context the Added state. When the changes are being saved, the entities in the Added states are inserted into the database. After the changes are saved, the object state changes to Unchanged.
Public method AsNoTracking Returns a new query where the entities returned will not be cached in the DbContext. (Inherited from DbQuery.)
Public method Attach Attaches the given entity to the context in the Unchanged
Public method Cast<TEntity> Returns the equivalent generic DbSet<TEntity> object.
Public method Create() Creates a new instance of an entity for the type of this set. This instance is not added or attached to the set. The instance returned will be a proxy if the underlying context is configured to create proxies and the entity type meets the requirements for creating a proxy.
Public method Create(Type) Creates a new instance of an entity for the type of this set or for a type derived from the type of this set. This instance is not added or attached to the set. The instance returned will be a proxy if the underlying context is configured to create proxies and the entity type meets the requirements for creating a proxy.
Public method Equals Returns whether the specified set is equal to the current set. (Overrides DbQuery.Equals(Object).)
Protected method Finalize (Inherited from Object.)
Public method Find Uses the primary key value to attempt to find an entity tracked by the context. If the entity is not in the context then a query will be executed and evaluated against the data in the data source, and null is returned if the entity is not found in the context or in the data source. Note that the Find also returns entities that have been added to the context but have not yet been saved to the database.
Public method GetHashCode Returns the hash function for the specified set. (Overrides DbQuery.GetHashCode().)
Public method GetType Gets the type for the current set.
Public method Include Returns the included non generic LINQ to Entities query against a DbContext. (Inherited from DbQuery.)
Protected method MemberwiseClone (Inherited from Object.)
Public method Remove Marks the given entity as Deleted. When the changes are saved, the entity is deleted from the database. The entity must exist in the context in some other state before this method is called.
Public method SqlQuery Creates a raw SQL query that will return entities in this set. By default, the entities returned are tracked by the context; this can be changed by calling AsNoTracking on the DbSqlQuery<TEntity> returned from this method.
Public method ToString Returns a String representation of the underlying query. (Inherited from DbQuery.)
Top
  Name Description
Explicit interface implemetation Private property IListSource.ContainsListCollection Returns false. (Inherited from DbQuery.)
Explicit interface implemetation Private property IQueryable.Expression The IQueryable LINQ Expression. (Inherited from DbQuery.)
Explicit interface implemetation Private method IEnumerable.GetEnumerator Gets the enumeration of this query causing it to be executed against the store. (Inherited from DbQuery.)
Explicit interface implemetation Private method IListSource.GetList Throws an exception indicating that binding directly to a store query is not supported. (Inherited from DbQuery.)
Explicit interface implemetation Private property IQueryable.Provider The IQueryable provider. (Inherited from DbQuery.)
Top
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Did you find this helpful?
(1500 characters remaining)