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 為空, keys 包含空欄位鍵或表達式,或 aggregates 包含空集合欄位名稱或彙總。

aggregateskeys為空,或指定欄位名稱無效或重複。

備註

DbGroupByExpression 允許鍵列表或聚合列表為空,但不能兩者同時為空。

適用於