DbExpressionBuilder.GroupBy 方法

定义

创建一个新 DbGroupByExpression 项,以便根据指定的组键对输入集的元素进行分组,并应用给定的聚合。

public:
[System::Runtime::CompilerServices::Extension]
 static System::Data::Common::CommandTrees::DbGroupByExpression ^ GroupBy(System::Data::Common::CommandTrees::DbGroupExpressionBinding ^ input, System::Collections::Generic::IEnumerable<System::Collections::Generic::KeyValuePair<System::String ^, System::Data::Common::CommandTrees::DbExpression ^>> ^ keys, System::Collections::Generic::IEnumerable<System::Collections::Generic::KeyValuePair<System::String ^, System::Data::Common::CommandTrees::DbAggregate ^>> ^ aggregates);
public static System.Data.Common.CommandTrees.DbGroupByExpression GroupBy(this System.Data.Common.CommandTrees.DbGroupExpressionBinding input, System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string,System.Data.Common.CommandTrees.DbExpression>> keys, System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string,System.Data.Common.CommandTrees.DbAggregate>> aggregates);
static member GroupBy : System.Data.Common.CommandTrees.DbGroupExpressionBinding * seq<System.Collections.Generic.KeyValuePair<string, System.Data.Common.CommandTrees.DbExpression>> * seq<System.Collections.Generic.KeyValuePair<string, System.Data.Common.CommandTrees.DbAggregate>> -> System.Data.Common.CommandTrees.DbGroupByExpression
<Extension()>
Public Function GroupBy (input As DbGroupExpressionBinding, keys As IEnumerable(Of KeyValuePair(Of String, DbExpression)), aggregates As IEnumerable(Of KeyValuePair(Of String, DbAggregate))) As DbGroupByExpression

参数

input
DbGroupExpressionBinding

指定输入集的 A DbGroupExpressionBinding

keys
IEnumerable<KeyValuePair<String,DbExpression>>

定义分组列的字符串表达式对的列表。

aggregates
IEnumerable<KeyValuePair<String,DbAggregate>>

指定要应用的聚合的表达式列表。

返回

具有指定输入集、分组键和聚合的新 DbGroupByExpression。

例外

inputkeysaggregates 为 null, keys 包含 null 列键或表达式,或 aggregates 包含 null 聚合列名或聚合。

两者 keys 均为 aggregates 空,或者指定了无效或重复的列名。

注解

DbGroupByExpression 允许键列表或聚合列表为空,但不能同时为两者。

适用于