GroupBy Method

DbExpressionBuilder.GroupBy Method (DbGroupExpressionBinding, IEnumerable<KeyValuePair<String, DbExpression>>, IEnumerable<KeyValuePair<String, DbAggregate>>)

.NET Framework 4.6 and 4.5

Creates a new DbGroupByExpression that groups the elements of the input set according to the specified group keys and applies the given aggregates.

Namespace:   System.Data.Common.CommandTrees.ExpressionBuilder
Assembly:  System.Data.Entity (in System.Data.Entity.dll)

public static DbGroupByExpression GroupBy(
	this DbGroupExpressionBinding input,
	IEnumerable<KeyValuePair<string, DbExpression>> keys,
	IEnumerable<KeyValuePair<string, DbAggregate>> aggregates


Type: System.Data.Common.CommandTrees.DbGroupExpressionBinding

A DbGroupExpressionBinding that specifies the input set.

Type: System.Collections.Generic.IEnumerable<KeyValuePair<String, DbExpression>>

A list of string-expression pairs that define the grouping columns.

Type: System.Collections.Generic.IEnumerable<KeyValuePair<String, DbAggregate>>

A list of expressions that specify aggregates to apply.

Return Value

Type: System.Data.Common.CommandTrees.DbGroupByExpression

A new DbGroupByExpression with the specified input set, grouping keys and aggregates.

Exception Condition

input, keys or aggregates is null, keys contains a null column key or expression, or aggregates contains a null aggregate column name or aggregate.


Both keys and aggregates are empty, or an invalid or duplicate column name was specified.

DbGroupByExpression allows either the list of keys or the list of aggregates to be empty, but not both.

.NET Framework
Available since 4.5
Return to top
© 2015 Microsoft