Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

DbSet<TEntity> Class

[This page is specific to the Entity Framework version 6. The latest version is available as the 'Entity Framework' NuGet package. For more information about Entity Framework, see msdn.com/data/ef.]

A DbSet represents the collection of all entities in the context, or that can be queried from the database, of a given type. DbSet objects are created from a DbContext using the DbContext.Set method.

System.Object
  System.Data.Entity.Infrastructure.DbQuery<TEntity>
    System.Data.Entity.DbSet<TEntity>

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

[SuppressMessageAttribute("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix", Justification = "Name is intentional")]
public class DbSet<TEntity> : DbQuery<TEntity>, 
	IDbSet<TEntity>, IQueryable<TEntity>, IEnumerable<TEntity>, 
	IQueryable, IEnumerable 
where TEntity : class

Type Parameters

TEntity

The type that defines the set.

The DbSet<TEntity> type exposes the following members.

  NameDescription
Protected methodDbSet<TEntity>Creates an instance of a DbSet<TEntity> when called from the constructor of a derived type that will be used as a test double for DbSets. Methods and properties that will be used by the test double must be implemented by the test double except AsNoTracking, AsStreaming, an Include where the default implementation is a no-op.
Top

  NameDescription
Public propertyLocalGets an ObservableCollection<T> that represents a local view of all Added, Unchanged, and Modified entities in this set. This local view will stay in sync as entities are added or removed from the context. Likewise, entities added to or removed from the local view will automatically be added to or removed from the context.
Top

  NameDescription
Public methodAddAdds the given entity to the context underlying the set in the Added state such that it will be inserted into the database when SaveChanges is called.
Public methodAddRangeAdds the given collection of entities into context underlying the set with each entity being put into the Added state such that it will be inserted into the database when SaveChanges is called.
Public methodAsNoTrackingReturns a new query where the entities returned will not be cached in the DbContext. (Inherited from DbQuery<TResult>.)
Public methodAsStreaming Obsolete. Returns a new query that will stream the results instead of buffering. (Inherited from DbQuery<TResult>.)
Public methodAttachAttaches the given entity to the context underlying the set. That is, the entity is placed into the context in the Unchanged state, just as if it had been read from the database.
Public methodCreate()Creates a new instance of an entity for the type of this set. Note that 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 methodCreate<TDerivedEntity>()Creates a new instance of an entity for the type of this set or for a type derived from the type of this set. Note that 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 methodEqualsDetermines whether the specified DbSet is equal to the current DbSet. (Overrides DbQuery<TResult>.Equals(Object).)
Protected methodFinalize (Inherited from Object.)
Public methodFindFinds an entity with the given primary key values. If an entity with the given primary key values exists in the context, then it is returned immediately without making a request to the store. Otherwise, a request is made to the store for an entity with the given primary key values and this entity, if found, is attached to the context and returned. If no entity is found in the context or the store, then null is returned.
Public methodFindAsync(Object[])Asynchronously finds an entity with the given primary key values. If an entity with the given primary key values exists in the context, then it is returned immediately without making a request to the store. Otherwise, a request is made to the store for an entity with the given primary key values and this entity, if found, is attached to the context and returned. If no entity is found in the context or the store, then null is returned.
Public methodFindAsync(CancellationToken, Object[])Asynchronously finds an entity with the given primary key values. If an entity with the given primary key values exists in the context, then it is returned immediately without making a request to the store. Otherwise, a request is made to the store for an entity with the given primary key values and this entity, if found, is attached to the context and returned. If no entity is found in the context or the store, then null is returned.
Public methodGetHashCodeReturns the hash function for this DbSet. (Overrides DbQuery<TResult>.GetHashCode().)
Public methodGetTypeReturns the type for the current DbSet.
Public methodIncludeSpecifies the related objects to include in the query results. (Inherited from DbQuery<TResult>.)
Protected methodMemberwiseClone (Inherited from Object.)
Public methodRemoveMarks the given entity as Deleted such that it will be deleted from the database when SaveChanges is called. Note that the entity must exist in the context in some other state before this method is called.
Public methodRemoveRangeRemoves the given collection of entities from the context underlying the set with each entity being put into the Deleted state such that it will be deleted from the database when SaveChanges is called.
Public methodSqlQueryCreates 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. Note that the entities returned are always of the type for this set and never of a derived type. If the table or tables queried may contain data for other entity types, then the SQL query must be written appropriately to ensure that only entities of the correct type are returned. As with any API that accepts SQL it is important to parameterize any user input to protect against a SQL injection attack. You can include parameter place holders in the SQL query string and then supply parameter values as additional arguments. Any parameter values you supply will automatically be converted to a DbParameter. context.Blogs.SqlQuery("SELECT * FROM dbo.Posts WHERE Author = @p0", userSuppliedAuthor); Alternatively, you can also construct a DbParameter and supply it to SqlQuery. This allows you to use named parameters in the SQL query string. context.Blogs.SqlQuery("SELECT * FROM dbo.Posts WHERE Author = @author", new SqlParameter("@author", userSuppliedAuthor));
Public methodToStringReturns a String representation of the underlying query. (Inherited from DbQuery<TResult>.)
Top

  NameDescription
Public operatorStatic memberImplicit(DbSet<TEntity> to DbSet)Returns the equivalent non-generic DbSet object.
Top

  NameDescription
Public Extension MethodAddOrUpdate<TEntity>(TEntity[])Overloaded. Adds or updates entities by key when SaveChanges is called. Equivalent to an "upsert" operation from database terminology. This method can useful when seeding data using Migrations. (Defined by DbSetMigrationsExtensions.)
Public Extension MethodAddOrUpdate<TEntity>(Expression<Func<TEntity, Object>>, TEntity[])Overloaded. Adds or updates entities by a custom identification expression when SaveChanges is called. Equivalent to an "upsert" operation from database terminology. This method can useful when seeding data using Migrations. (Defined by DbSetMigrationsExtensions.)
Public Extension MethodAllAsync<TEntity>(Expression<Func<TEntity, Boolean>>)Overloaded. Asynchronously determines whether all the elements of a sequence satisfy a condition. (Defined by QueryableExtensions.)
Public Extension MethodAllAsync<TEntity>(Expression<Func<TEntity, Boolean>>, CancellationToken)Overloaded. Asynchronously determines whether all the elements of a sequence satisfy a condition. (Defined by QueryableExtensions.)
Public Extension MethodAnyAsync<TEntity>()Overloaded. Asynchronously determines whether a sequence contains any elements. (Defined by QueryableExtensions.)
Public Extension MethodAnyAsync<TEntity>(CancellationToken)Overloaded. Asynchronously determines whether a sequence contains any elements. (Defined by QueryableExtensions.)
Public Extension MethodAnyAsync<TEntity>(Expression<Func<TEntity, Boolean>>)Overloaded. Asynchronously determines whether any element of a sequence satisfies a condition. (Defined by QueryableExtensions.)
Public Extension MethodAnyAsync<TEntity>(Expression<Func<TEntity, Boolean>>, CancellationToken)Overloaded. Asynchronously determines whether any element of a sequence satisfies a condition. (Defined by QueryableExtensions.)
Public Extension MethodAsNoTracking<TEntity>Returns a new query where the entities returned will not be cached in the DbContext or ObjectContext. This method works by calling the AsNoTracking method of the underlying query object. If the underlying query object does not have an AsNoTracking method, then calling this method will have no affect. (Defined by QueryableExtensions.)
Public Extension MethodAsStreaming<TEntity>Returns a new query that will stream the results instead of buffering. This method works by calling the AsStreaming method of the underlying query object. If the underlying query object does not have an AsStreaming method, then calling this method will have no affect. (Defined by QueryableExtensions.)
Public Extension MethodAverageAsync<TEntity>(Expression<Func<TEntity, Int32>>)Overloaded. Asynchronously computes the average of a sequence of Int32 values that is obtained by invoking a projection function on each element of the input sequence. (Defined by QueryableExtensions.)
Public Extension MethodAverageAsync<TEntity>(Expression<Func<TEntity, Nullable<Int32>>>)Overloaded. Asynchronously computes the average of a sequence of nullable Int32 values that is obtained by invoking a projection function on each element of the input sequence. (Defined by QueryableExtensions.)
Public Extension MethodAverageAsync<TEntity>(Expression<Func<TEntity, Int64>>)Overloaded. Asynchronously computes the average of a sequence of Int64 values that is obtained by invoking a projection function on each element of the input sequence. (Defined by QueryableExtensions.)
Public Extension MethodAverageAsync<TEntity>(Expression<Func<TEntity, Nullable<Int64>>>)Overloaded. Asynchronously computes the average of a sequence of nullable Int64 values that is obtained by invoking a projection function on each element of the input sequence. (Defined by QueryableExtensions.)
Public Extension MethodAverageAsync<TEntity>(Expression<Func<TEntity, Single>>)Overloaded. Asynchronously computes the average of a sequence of Single values that is obtained by invoking a projection function on each element of the input sequence. (Defined by QueryableExtensions.)
Public Extension MethodAverageAsync<TEntity>(Expression<Func<TEntity, Nullable<Single>>>)Overloaded. Asynchronously computes the average of a sequence of nullable Single values that is obtained by invoking a projection function on each element of the input sequence. (Defined by QueryableExtensions.)
Public Extension MethodAverageAsync<TEntity>(Expression<Func<TEntity, Double>>)Overloaded. Asynchronously computes the average of a sequence of Double values that is obtained by invoking a projection function on each element of the input sequence. (Defined by QueryableExtensions.)
Public Extension MethodAverageAsync<TEntity>(Expression<Func<TEntity, Nullable<Double>>>)Overloaded. Asynchronously computes the average of a sequence of nullable Double values that is obtained by invoking a projection function on each element of the input sequence. (Defined by QueryableExtensions.)
Public Extension MethodAverageAsync<TEntity>(Expression<Func<TEntity, Decimal>>)Overloaded. Asynchronously computes the average of a sequence of Decimal values that is obtained by invoking a projection function on each element of the input sequence. (Defined by QueryableExtensions.)
Public Extension MethodAverageAsync<TEntity>(Expression<Func<TEntity, Nullable<Decimal>>>)Overloaded. Asynchronously computes the average of a sequence of nullable Decimal values that is obtained by invoking a projection function on each element of the input sequence. (Defined by QueryableExtensions.)
Public Extension MethodAverageAsync<TEntity>(Expression<Func<TEntity, Int32>>, CancellationToken)Overloaded. Asynchronously computes the average of a sequence of Int32 values that is obtained by invoking a projection function on each element of the input sequence. (Defined by QueryableExtensions.)
Public Extension MethodAverageAsync<TEntity>(Expression<Func<TEntity, Nullable<Int32>>>, CancellationToken)Overloaded. Asynchronously computes the average of a sequence of nullable Int32 values that is obtained by invoking a projection function on each element of the input sequence. (Defined by QueryableExtensions.)
Public Extension MethodAverageAsync<TEntity>(Expression<Func<TEntity, Int64>>, CancellationToken)Overloaded. Asynchronously computes the average of a sequence of Int64 values that is obtained by invoking a projection function on each element of the input sequence. (Defined by QueryableExtensions.)
Public Extension MethodAverageAsync<TEntity>(Expression<Func<TEntity, Nullable<Int64>>>, CancellationToken)Overloaded. Asynchronously computes the average of a sequence of nullable Int64 values that is obtained by invoking a projection function on each element of the input sequence. (Defined by QueryableExtensions.)
Public Extension MethodAverageAsync<TEntity>(Expression<Func<TEntity, Single>>, CancellationToken)Overloaded. Asynchronously computes the average of a sequence of Single values that is obtained by invoking a projection function on each element of the input sequence. (Defined by QueryableExtensions.)
Public Extension MethodAverageAsync<TEntity>(Expression<Func<TEntity, Nullable<Single>>>, CancellationToken)Overloaded. Asynchronously computes the average of a sequence of nullable Single values that is obtained by invoking a projection function on each element of the input sequence. (Defined by QueryableExtensions.)
Public Extension MethodAverageAsync<TEntity>(Expression<Func<TEntity, Double>>, CancellationToken)Overloaded. Asynchronously computes the average of a sequence of Double values that is obtained by invoking a projection function on each element of the input sequence. (Defined by QueryableExtensions.)
Public Extension MethodAverageAsync<TEntity>(Expression<Func<TEntity, Nullable<Double>>>, CancellationToken)Overloaded. Asynchronously computes the average of a sequence of nullable Double values that is obtained by invoking a projection function on each element of the input sequence. (Defined by QueryableExtensions.)
Public Extension MethodAverageAsync<TEntity>(Expression<Func<TEntity, Decimal>>, CancellationToken)Overloaded. Asynchronously computes the average of a sequence of Decimal values that is obtained by invoking a projection function on each element of the input sequence. (Defined by QueryableExtensions.)
Public Extension MethodAverageAsync<TEntity>(Expression<Func<TEntity, Nullable<Decimal>>>, CancellationToken)Overloaded. Asynchronously computes the average of a sequence of nullable Decimal values that is obtained by invoking a projection function on each element of the input sequence. (Defined by QueryableExtensions.)
Public Extension MethodContainsAsync<TEntity>(TEntity)Overloaded. Asynchronously determines whether a sequence contains a specified element by using the default equality comparer. (Defined by QueryableExtensions.)
Public Extension MethodContainsAsync<TEntity>(TEntity, CancellationToken)Overloaded. Asynchronously determines whether a sequence contains a specified element by using the default equality comparer. (Defined by QueryableExtensions.)
Public Extension MethodCountAsync<TEntity>()Overloaded. Asynchronously returns the number of elements in a sequence. (Defined by QueryableExtensions.)
Public Extension MethodCountAsync<TEntity>(CancellationToken)Overloaded. Asynchronously returns the number of elements in a sequence. (Defined by QueryableExtensions.)
Public Extension MethodCountAsync<TEntity>(Expression<Func<TEntity, Boolean>>)Overloaded. Asynchronously returns the number of elements in a sequence that satisfy a condition. (Defined by QueryableExtensions.)
Public Extension MethodCountAsync<TEntity>(Expression<Func<TEntity, Boolean>>, CancellationToken)Overloaded. Asynchronously returns the number of elements in a sequence that satisfy a condition. (Defined by QueryableExtensions.)
Public Extension MethodFirstAsync<TEntity>()Overloaded. Asynchronously returns the first element of a sequence. (Defined by QueryableExtensions.)
Public Extension MethodFirstAsync<TEntity>(CancellationToken)Overloaded. Asynchronously returns the first element of a sequence. (Defined by QueryableExtensions.)
Public Extension MethodFirstAsync<TEntity>(Expression<Func<TEntity, Boolean>>)Overloaded. Asynchronously returns the first element of a sequence that satisfies a specified condition. (Defined by QueryableExtensions.)
Public Extension MethodFirstAsync<TEntity>(Expression<Func<TEntity, Boolean>>, CancellationToken)Overloaded. Asynchronously returns the first element of a sequence that satisfies a specified condition. (Defined by QueryableExtensions.)
Public Extension MethodFirstOrDefaultAsync<TEntity>()Overloaded. Asynchronously returns the first element of a sequence, or a default value if the sequence contains no elements. (Defined by QueryableExtensions.)
Public Extension MethodFirstOrDefaultAsync<TEntity>(CancellationToken)Overloaded. Asynchronously returns the first element of a sequence, or a default value if the sequence contains no elements. (Defined by QueryableExtensions.)
Public Extension MethodFirstOrDefaultAsync<TEntity>(Expression<Func<TEntity, Boolean>>)Overloaded. Asynchronously returns the first element of a sequence that satisfies a specified condition or a default value if no such element is found. (Defined by QueryableExtensions.)
Public Extension MethodFirstOrDefaultAsync<TEntity>(Expression<Func<TEntity, Boolean>>, CancellationToken)Overloaded. Asynchronously returns the first element of a sequence that satisfies a specified condition or a default value if no such element is found. (Defined by QueryableExtensions.)
Public Extension MethodForEachAsync(Action<Object>)Overloaded. Asynchronously enumerates the query results and performs the specified action on each element. (Defined by QueryableExtensions.)
Public Extension MethodForEachAsync(Action<Object>, CancellationToken)Overloaded. Asynchronously enumerates the query results and performs the specified action on each element. (Defined by QueryableExtensions.)
Public Extension MethodForEachAsync<TEntity>(Action<TEntity>)Overloaded. Asynchronously enumerates the query results and performs the specified action on each element. (Defined by QueryableExtensions.)
Public Extension MethodForEachAsync<TEntity>(Action<TEntity>, CancellationToken)Overloaded. Asynchronously enumerates the query results and performs the specified action on each element. (Defined by QueryableExtensions.)
Public Extension MethodInclude<TEntity>(String)Overloaded. Specifies the related objects to include in the query results. (Defined by QueryableExtensions.)
Public Extension MethodInclude<TEntity, TProperty>(Expression<Func<TEntity, TProperty>>)Overloaded. Specifies the related objects to include in the query results. (Defined by QueryableExtensions.)
Public Extension MethodLoadEnumerates the query such that for server queries such as those of DbSet<TEntity>, ObjectSet<TEntity> , ObjectQuery<T>, and others the results of the query will be loaded into the associated DbContext , ObjectContext or other cache on the client. This is equivalent to calling ToList and then throwing away the list without the overhead of actually creating the list. (Defined by QueryableExtensions.)
Public Extension MethodLoadAsync()Overloaded. Asynchronously enumerates the query such that for server queries such as those of DbSet<TEntity>, ObjectSet<TEntity> , ObjectQuery<T>, and others the results of the query will be loaded into the associated DbContext , ObjectContext or other cache on the client. This is equivalent to calling ToList and then throwing away the list without the overhead of actually creating the list. (Defined by QueryableExtensions.)
Public Extension MethodLoadAsync(CancellationToken)Overloaded. Asynchronously enumerates the query such that for server queries such as those of DbSet<TEntity>, ObjectSet<TEntity> , ObjectQuery<T>, and others the results of the query will be loaded into the associated DbContext , ObjectContext or other cache on the client. This is equivalent to calling ToList and then throwing away the list without the overhead of actually creating the list. (Defined by QueryableExtensions.)
Public Extension MethodLongCountAsync<TEntity>()Overloaded. Asynchronously returns an Int64 that represents the total number of elements in a sequence. (Defined by QueryableExtensions.)
Public Extension MethodLongCountAsync<TEntity>(CancellationToken)Overloaded. Asynchronously returns an Int64 that represents the total number of elements in a sequence. (Defined by QueryableExtensions.)
Public Extension MethodLongCountAsync<TEntity>(Expression<Func<TEntity, Boolean>>)Overloaded. Asynchronously returns an Int64 that represents the number of elements in a sequence that satisfy a condition. (Defined by QueryableExtensions.)
Public Extension MethodLongCountAsync<TEntity>(Expression<Func<TEntity, Boolean>>, CancellationToken)Overloaded. Asynchronously returns an Int64 that represents the number of elements in a sequence that satisfy a condition. (Defined by QueryableExtensions.)
Public Extension MethodMaxAsync<TEntity>()Overloaded. Asynchronously returns the maximum value of a sequence. (Defined by QueryableExtensions.)
Public Extension MethodMaxAsync<TEntity>(CancellationToken)Overloaded. Asynchronously returns the maximum value of a sequence. (Defined by QueryableExtensions.)
Public Extension MethodMaxAsync<TEntity, TResult>(Expression<Func<TEntity, TResult>>)Overloaded. Asynchronously invokes a projection function on each element of a sequence and returns the maximum resulting value. (Defined by QueryableExtensions.)
Public Extension MethodMaxAsync<TEntity, TResult>(Expression<Func<TEntity, TResult>>, CancellationToken)Overloaded. Asynchronously invokes a projection function on each element of a sequence and returns the maximum resulting value. (Defined by QueryableExtensions.)
Public Extension MethodMinAsync<TEntity>()Overloaded. Asynchronously returns the minimum value of a sequence. (Defined by QueryableExtensions.)
Public Extension MethodMinAsync<TEntity>(CancellationToken)Overloaded. Asynchronously returns the minimum value of a sequence. (Defined by QueryableExtensions.)
Public Extension MethodMinAsync<TEntity, TResult>(Expression<Func<TEntity, TResult>>)Overloaded. Asynchronously invokes a projection function on each element of a sequence and returns the minimum resulting value. (Defined by QueryableExtensions.)
Public Extension MethodMinAsync<TEntity, TResult>(Expression<Func<TEntity, TResult>>, CancellationToken)Overloaded. Asynchronously invokes a projection function on each element of a sequence and returns the minimum resulting value. (Defined by QueryableExtensions.)
Public Extension MethodSingleAsync<TEntity>()Overloaded. Asynchronously returns the only element of a sequence, and throws an exception if there is not exactly one element in the sequence. (Defined by QueryableExtensions.)
Public Extension MethodSingleAsync<TEntity>(CancellationToken)Overloaded. Asynchronously returns the only element of a sequence, and throws an exception if there is not exactly one element in the sequence. (Defined by QueryableExtensions.)
Public Extension MethodSingleAsync<TEntity>(Expression<Func<TEntity, Boolean>>)Overloaded. Asynchronously returns the only element of a sequence that satisfies a specified condition, and throws an exception if more than one such element exists. (Defined by QueryableExtensions.)
Public Extension MethodSingleAsync<TEntity>(Expression<Func<TEntity, Boolean>>, CancellationToken)Overloaded. Asynchronously returns the only element of a sequence that satisfies a specified condition, and throws an exception if more than one such element exists. (Defined by QueryableExtensions.)
Public Extension MethodSingleOrDefaultAsync<TEntity>()Overloaded. Asynchronously returns the only element of a sequence, or a default value if the sequence is empty; this method throws an exception if there is more than one element in the sequence. (Defined by QueryableExtensions.)
Public Extension MethodSingleOrDefaultAsync<TEntity>(CancellationToken)Overloaded. Asynchronously returns the only element of a sequence, or a default value if the sequence is empty; this method throws an exception if there is more than one element in the sequence. (Defined by QueryableExtensions.)
Public Extension MethodSingleOrDefaultAsync<TEntity>(Expression<Func<TEntity, Boolean>>)Overloaded. Asynchronously returns the only element of a sequence that satisfies a specified condition or a default value if no such element exists; this method throws an exception if more than one element satisfies the condition. (Defined by QueryableExtensions.)
Public Extension MethodSingleOrDefaultAsync<TEntity>(Expression<Func<TEntity, Boolean>>, CancellationToken)Overloaded. Asynchronously returns the only element of a sequence that satisfies a specified condition or a default value if no such element exists; this method throws an exception if more than one element satisfies the condition. (Defined by QueryableExtensions.)
Public Extension MethodSkip<TEntity>Bypasses a specified number of elements in a sequence and then returns the remaining elements. (Defined by QueryableExtensions.)
Public Extension MethodSumAsync<TEntity>(Expression<Func<TEntity, Int32>>)Overloaded. Asynchronously computes the sum of the sequence of Int32 values that is obtained by invoking a projection function on each element of the input sequence. (Defined by QueryableExtensions.)
Public Extension MethodSumAsync<TEntity>(Expression<Func<TEntity, Nullable<Int32>>>)Overloaded. Asynchronously computes the sum of the sequence of nullable Int32 values that is obtained by invoking a projection function on each element of the input sequence. (Defined by QueryableExtensions.)
Public Extension MethodSumAsync<TEntity>(Expression<Func<TEntity, Int64>>)Overloaded. Asynchronously computes the sum of the sequence of Int64 values that is obtained by invoking a projection function on each element of the input sequence. (Defined by QueryableExtensions.)
Public Extension MethodSumAsync<TEntity>(Expression<Func<TEntity, Nullable<Int64>>>)Overloaded. Asynchronously computes the sum of the sequence of nullable Int64 values that is obtained by invoking a projection function on each element of the input sequence. (Defined by QueryableExtensions.)
Public Extension MethodSumAsync<TEntity>(Expression<Func<TEntity, Single>>)Overloaded. Asynchronously computes the sum of the sequence of Single values that is obtained by invoking a projection function on each element of the input sequence. (Defined by QueryableExtensions.)
Public Extension MethodSumAsync<TEntity>(Expression<Func<TEntity, Nullable<Single>>>)Overloaded. Asynchronously computes the sum of the sequence of nullable Single values that is obtained by invoking a projection function on each element of the input sequence. (Defined by QueryableExtensions.)
Public Extension MethodSumAsync<TEntity>(Expression<Func<TEntity, Double>>)Overloaded. Asynchronously computes the sum of the sequence of Double values that is obtained by invoking a projection function on each element of the input sequence. (Defined by QueryableExtensions.)
Public Extension MethodSumAsync<TEntity>(Expression<Func<TEntity, Nullable<Double>>>)Overloaded. Asynchronously computes the sum of the sequence of nullable Double values that is obtained by invoking a projection function on each element of the input sequence. (Defined by QueryableExtensions.)
Public Extension MethodSumAsync<TEntity>(Expression<Func<TEntity, Decimal>>)Overloaded. Asynchronously computes the sum of the sequence of Decimal values that is obtained by invoking a projection function on each element of the input sequence. (Defined by QueryableExtensions.)
Public Extension MethodSumAsync<TEntity>(Expression<Func<TEntity, Nullable<Decimal>>>)Overloaded. Asynchronously computes the sum of the sequence of nullable Decimal values that is obtained by invoking a projection function on each element of the input sequence. (Defined by QueryableExtensions.)
Public Extension MethodSumAsync<TEntity>(Expression<Func<TEntity, Int32>>, CancellationToken)Overloaded. Asynchronously computes the sum of the sequence of Int32 values that is obtained by invoking a projection function on each element of the input sequence. (Defined by QueryableExtensions.)
Public Extension MethodSumAsync<TEntity>(Expression<Func<TEntity, Nullable<Int32>>>, CancellationToken)Overloaded. Asynchronously computes the sum of the sequence of nullable Int32 values that is obtained by invoking a projection function on each element of the input sequence. (Defined by QueryableExtensions.)
Public Extension MethodSumAsync<TEntity>(Expression<Func<TEntity, Int64>>, CancellationToken)Overloaded. Asynchronously computes the sum of the sequence of Int64 values that is obtained by invoking a projection function on each element of the input sequence. (Defined by QueryableExtensions.)
Public Extension MethodSumAsync<TEntity>(Expression<Func<TEntity, Nullable<Int64>>>, CancellationToken)Overloaded. Asynchronously computes the sum of the sequence of nullable Int64 values that is obtained by invoking a projection function on each element of the input sequence. (Defined by QueryableExtensions.)
Public Extension MethodSumAsync<TEntity>(Expression<Func<TEntity, Single>>, CancellationToken)Overloaded. Asynchronously computes the sum of the sequence of Single values that is obtained by invoking a projection function on each element of the input sequence. (Defined by QueryableExtensions.)
Public Extension MethodSumAsync<TEntity>(Expression<Func<TEntity, Nullable<Single>>>, CancellationToken)Overloaded. Asynchronously computes the sum of the sequence of nullable Single values that is obtained by invoking a projection function on each element of the input sequence. (Defined by QueryableExtensions.)
Public Extension MethodSumAsync<TEntity>(Expression<Func<TEntity, Double>>, CancellationToken)Overloaded. Asynchronously computes the sum of the sequence of Double values that is obtained by invoking a projection function on each element of the input sequence. (Defined by QueryableExtensions.)
Public Extension MethodSumAsync<TEntity>(Expression<Func<TEntity, Nullable<Double>>>, CancellationToken)Overloaded. Asynchronously computes the sum of the sequence of nullable Double values that is obtained by invoking a projection function on each element of the input sequence. (Defined by QueryableExtensions.)
Public Extension MethodSumAsync<TEntity>(Expression<Func<TEntity, Decimal>>, CancellationToken)Overloaded. Asynchronously computes the sum of the sequence of Decimal values that is obtained by invoking a projection function on each element of the input sequence. (Defined by QueryableExtensions.)
Public Extension MethodSumAsync<TEntity>(Expression<Func<TEntity, Nullable<Decimal>>>, CancellationToken)Overloaded. Asynchronously computes the sum of the sequence of nullable Decimal values that is obtained by invoking a projection function on each element of the input sequence. (Defined by QueryableExtensions.)
Public Extension MethodTake<TEntity>Returns a specified number of contiguous elements from the start of a sequence. (Defined by QueryableExtensions.)
Public Extension MethodToArrayAsync<TEntity>()Overloaded. Creates an array from an IQueryable<T> by enumerating it asynchronously. (Defined by QueryableExtensions.)
Public Extension MethodToArrayAsync<TEntity>(CancellationToken)Overloaded. Creates an array from an IQueryable<T> by enumerating it asynchronously. (Defined by QueryableExtensions.)
Public Extension MethodToDictionaryAsync<TEntity, TKey>(Func<TEntity, TKey>)Overloaded. Creates a Dictionary<TKey, TValue> from an IQueryable<T> by enumerating it asynchronously according to a specified key selector function. (Defined by QueryableExtensions.)
Public Extension MethodToDictionaryAsync<TEntity, TKey>(Func<TEntity, TKey>, CancellationToken)Overloaded. Creates a Dictionary<TKey, TValue> from an IQueryable<T> by enumerating it asynchronously according to a specified key selector function. (Defined by QueryableExtensions.)
Public Extension MethodToDictionaryAsync<TEntity, TKey>(Func<TEntity, TKey>, IEqualityComparer<TKey>)Overloaded. Creates a Dictionary<TKey, TValue> from an IQueryable<T> by enumerating it asynchronously according to a specified key selector function and a comparer. (Defined by QueryableExtensions.)
Public Extension MethodToDictionaryAsync<TEntity, TKey>(Func<TEntity, TKey>, IEqualityComparer<TKey>, CancellationToken)Overloaded. Creates a Dictionary<TKey, TValue> from an IQueryable<T> by enumerating it asynchronously according to a specified key selector function and a comparer. (Defined by QueryableExtensions.)
Public Extension MethodToDictionaryAsync<TEntity, TKey, TElement>(Func<TEntity, TKey>, Func<TEntity, TElement>)Overloaded. Creates a Dictionary<TKey, TValue> from an IQueryable<T> by enumerating it asynchronously according to a specified key selector and an element selector function. (Defined by QueryableExtensions.)
Public Extension MethodToDictionaryAsync<TEntity, TKey, TElement>(Func<TEntity, TKey>, Func<TEntity, TElement>, CancellationToken)Overloaded. Creates a Dictionary<TKey, TValue> from an IQueryable<T> by enumerating it asynchronously according to a specified key selector and an element selector function. (Defined by QueryableExtensions.)
Public Extension MethodToDictionaryAsync<TEntity, TKey, TElement>(Func<TEntity, TKey>, Func<TEntity, TElement>, IEqualityComparer<TKey>)Overloaded. Creates a Dictionary<TKey, TValue> from an IQueryable<T> by enumerating it asynchronously according to a specified key selector function, a comparer, and an element selector function. (Defined by QueryableExtensions.)
Public Extension MethodToDictionaryAsync<TEntity, TKey, TElement>(Func<TEntity, TKey>, Func<TEntity, TElement>, IEqualityComparer<TKey>, CancellationToken)Overloaded. Creates a Dictionary<TKey, TValue> from an IQueryable<T> by enumerating it asynchronously according to a specified key selector function, a comparer, and an element selector function. (Defined by QueryableExtensions.)
Public Extension MethodToListAsync()Overloaded. Creates a List<T> from an IQueryable by enumerating it asynchronously. (Defined by QueryableExtensions.)
Public Extension MethodToListAsync(CancellationToken)Overloaded. Creates a List<T> from an IQueryable by enumerating it asynchronously. (Defined by QueryableExtensions.)
Public Extension MethodToListAsync<TEntity>()Overloaded. Creates a List<T> from an IQueryable<T> by enumerating it asynchronously. (Defined by QueryableExtensions.)
Public Extension MethodToListAsync<TEntity>(CancellationToken)Overloaded. Creates a List<T> from an IQueryable<T> by enumerating it asynchronously. (Defined by QueryableExtensions.)
Top

  NameDescription
Explicit interface implemetationPrivate propertyIListSource.ContainsListCollectionReturns false. (Inherited from DbQuery<TResult>.)
Explicit interface implemetationPrivate propertyIQueryable.ElementTypeThe IQueryable element type. (Inherited from DbQuery<TResult>.)
Explicit interface implemetationPrivate propertyIQueryable.ExpressionThe IQueryable LINQ Expression. (Inherited from DbQuery<TResult>.)
Explicit interface implemetationPrivate methodIEnumerable<TResult>.GetEnumeratorGets the enumeration of this query causing it to be executed against the store. (Inherited from DbQuery<TResult>.)
Explicit interface implemetationPrivate methodIEnumerable.GetEnumeratorReturns an IEnumerator<T> which when enumerated will execute the query against the database. (Inherited from DbQuery<TResult>.)
Explicit interface implemetationPrivate methodIListSource.GetListThrows an exception indicating that binding directly to a store query is not supported. Instead populate a DbSet with data, for example by using the Load extension method, and then bind to local data. For WPF bind to DbSet.Local. For Windows Forms bind to DbSet.Local.ToBindingList(). (Inherited from DbQuery<TResult>.)
Explicit interface implemetationPrivate propertyIQueryable.ProviderThe IQueryable provider. (Inherited from DbQuery<TResult>.)
Explicit interface implemetationPrivate methodIDbAsyncEnumerable.GetAsyncEnumeratorReturns an IDbAsyncEnumerator which when enumerated will execute the query against the database. (Inherited from DbQuery<TResult>.)
Explicit interface implemetationPrivate methodIDbAsyncEnumerable<TResult>.GetAsyncEnumeratorReturns an IDbAsyncEnumerator<T> which when enumerated will execute the query against the database. (Inherited from DbQuery<TResult>.)
Top

Note that DbSet does not support MEST (Multiple Entity Sets per Type) meaning that there is always a one-to-one correlation between a type and a set.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft