共用方式為


DbRawSqlQuery<TElement>.LongCountAsync 方法 (Func<TElement, Boolean>)

[此頁面專屬於 Entity Framework 第 6 版。最新版本可從 'Entity Framework' NuGet 套件取得。如需 Entity Framework 的詳細資訊,請參閱 msdn.com/data/ef。]

非同步傳回 Int64,表示查詢中符合條件的項目數。

命名空間:  System.Data.Entity.Infrastructure
組件:  EntityFramework (在 EntityFramework.dll 中)

語法

'宣告
Public Function LongCountAsync ( _
    predicate As Func(Of TElement, Boolean) _
) As Task(Of Long)
'用途
Dim instance As DbRawSqlQuery 
Dim predicate As Func(Of TElement, Boolean)
Dim returnValue As Task(Of Long)

returnValue = instance.LongCountAsync(predicate)
public Task<long> LongCountAsync(
    Func<TElement, bool> predicate
)
public:
Task<long long>^ LongCountAsync(
    Func<TElement, bool>^ predicate
)
member LongCountAsync : 
        predicate:Func<'TElement, bool> -> Task<int64> 
public function LongCountAsync(
    predicate : Func<TElement, boolean>
) : Task<long>

參數

傳回值

類型:System.Threading.Tasks.Task<Int64>
表示非同步作業的工作。工作結果包含查詢結果中符合述詞函式之條件的項目數。

例外狀況

例外狀況 條件
OverflowException

查詢結果中符合述詞函數之條件的項目數大於 MaxValue

備註

不支援相同內容執行個體上的多個作用中作業。 使用 'await' 確保在此內容上呼叫另一個方法之前,所有非同步作業都已完成。

請參閱

參考

DbRawSqlQuery<TElement> 類別

LongCountAsync 多載

System.Data.Entity.Infrastructure 命名空間