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

参数

keys
IEnumerable<KeyValuePair<String,DbExpression>>

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

aggregates
IEnumerable<KeyValuePair<String,DbAggregate>>

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

返回

使用指定输入集、分组密钥和聚合的新 DbGroupByExpression。

例外

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

keysaggregates 都为空,或指定了无效或重复的列名称。

注解

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

适用于