語言

DbRawSqlQuery<TElement>.CountAsync 方法

定義

多載

名稱 Description
CountAsync()

非同步回傳查詢中的元素數量。

CountAsync(Func<TElement,Boolean>)

非同步回傳查詢中滿足條件的元素數量。

CountAsync(CancellationToken)

非同步回傳查詢中的元素數量。

CountAsync(Func<TElement,Boolean>, CancellationToken)

非同步回傳查詢中滿足條件的元素數量。

CountAsync()

非同步回傳查詢中的元素數量。

public System.Threading.Tasks.Task<int> CountAsync();
member this.CountAsync : unit -> System.Threading.Tasks.Task<int>
Public Function CountAsync () As Task(Of Integer)

傳回

一個代表非同步操作的任務。 任務結果包含查詢結果中的元素數量。

例外狀況

查詢結果中的元素數大於 MaxValue 。

備註

不支援在同一上下文實例上進行多個主動操作。 在此上下文中呼叫其他方法前,請使用「wait」以確保所有非同步操作已完成。

適用於

CountAsync(Func<TElement,Boolean>)

非同步回傳查詢中滿足條件的元素數量。

public System.Threading.Tasks.Task<int> CountAsync(Func<TElement,bool> predicate);
member this.CountAsync : Func<'Element, bool> -> System.Threading.Tasks.Task<int>
Public Function CountAsync (predicate As Func(Of TElement, Boolean)) As Task(Of Integer)

參數

predicate
Func<TElement,Boolean>

一個用來測試每個元素條件的函數。

傳回

一個代表非同步操作的任務。 任務結果包含查詢結果中滿足謂詞函數條件的元素數量。

例外狀況

查詢結果中滿足謂詞函數條件的元素數多 MaxValue 於 。

備註

不支援在同一上下文實例上進行多個主動操作。 在此上下文中呼叫其他方法前,請使用「wait」以確保所有非同步操作已完成。

適用於

CountAsync(CancellationToken)

非同步回傳查詢中的元素數量。

public System.Threading.Tasks.Task<int> CountAsync(System.Threading.CancellationToken cancellationToken);
member this.CountAsync : System.Threading.CancellationToken -> System.Threading.Tasks.Task<int>

參數

cancellationToken
CancellationToken

A CancellationToken 在等待任務完成時觀察。

傳回

一個代表非同步操作的任務。 任務結果包含查詢結果中的元素數量。

例外狀況

查詢結果中的元素數大於 MaxValue 。

備註

不支援在同一上下文實例上進行多個主動操作。 在此上下文中呼叫其他方法前,請使用「wait」以確保所有非同步操作已完成。

適用於

CountAsync(Func<TElement,Boolean>, CancellationToken)

非同步回傳查詢中滿足條件的元素數量。

public System.Threading.Tasks.Task<int> CountAsync(Func<TElement,bool> predicate, System.Threading.CancellationToken cancellationToken);
member this.CountAsync : Func<'Element, bool> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<int>

參數

predicate
Func<TElement,Boolean>

一個用來測試每個元素條件的函數。

cancellationToken
CancellationToken

A CancellationToken 在等待任務完成時觀察。

傳回

一個代表非同步操作的任務。 任務結果包含查詢結果中滿足謂詞函數條件的元素數量。

例外狀況

查詢結果中滿足謂詞函數條件的元素數多 MaxValue 於 。

備註

不支援在同一上下文實例上進行多個主動操作。 在此上下文中呼叫其他方法前,請使用「wait」以確保所有非同步操作已完成。

適用於