語言

EntityFrameworkQueryableExtensions 類別

定義

Entity Framework LINQ 相關的擴充方法。

public static class EntityFrameworkQueryableExtensions
[System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessage("ReflectionAnalysis", "IL2060", Justification="MakeGenericMethod is used in this class to create MethodCallExpression nodes, but only if the method in question is called from user code - so it's never trimmed. After https://github.com/dotnet/linker/issues/2482 is fixed, the suppression will no longer be necessary.")]
[System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessage("AOT", "IL3050:Calling members annotated with 'RequiresDynamicCodeAttribute' may break functionality when AOT compiling.", Justification="MakeGenericMethod is used in this class to create MethodCallExpression nodes, but only if the method in question is called from user code - so it's never trimmed.")]
[System.Runtime.CompilerServices.Nullable(0)]
public static class EntityFrameworkQueryableExtensions
[System.Runtime.CompilerServices.Nullable(0)]
public static class EntityFrameworkQueryableExtensions
[System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessage("ReflectionAnalysis", "IL2060", Justification="MakeGenericMethod is used in this class to create MethodCallExpression nodes, but only if the method in question is called from user code - so it's never trimmed. After https://github.com/dotnet/linker/issues/2482 is fixed, the suppression will no longer be necessary.")]
public static class EntityFrameworkQueryableExtensions
[System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessage("ReflectionAnalysis", "IL2060", Justification="MakeGenericMethod is used in this class to create MethodCallExpression nodes, but only if the method in question is called from user code - so it's never trimmed. After https://github.com/dotnet/linker/issues/2482 is fixed, the suppression will no longer be necessary.")]
[System.Runtime.CompilerServices.Nullable(0)]
public static class EntityFrameworkQueryableExtensions
type EntityFrameworkQueryableExtensions = class
[<System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessage("ReflectionAnalysis", "IL2060", Justification="MakeGenericMethod is used in this class to create MethodCallExpression nodes, but only if the method in question is called from user code - so it's never trimmed. After https://github.com/dotnet/linker/issues/2482 is fixed, the suppression will no longer be necessary.")>]
[<System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessage("AOT", "IL3050:Calling members annotated with 'RequiresDynamicCodeAttribute' may break functionality when AOT compiling.", Justification="MakeGenericMethod is used in this class to create MethodCallExpression nodes, but only if the method in question is called from user code - so it's never trimmed.")>]
[<System.Runtime.CompilerServices.Nullable(0)>]
type EntityFrameworkQueryableExtensions = class
[<System.Runtime.CompilerServices.Nullable(0)>]
type EntityFrameworkQueryableExtensions = class
[<System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessage("ReflectionAnalysis", "IL2060", Justification="MakeGenericMethod is used in this class to create MethodCallExpression nodes, but only if the method in question is called from user code - so it's never trimmed. After https://github.com/dotnet/linker/issues/2482 is fixed, the suppression will no longer be necessary.")>]
type EntityFrameworkQueryableExtensions = class
[<System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessage("ReflectionAnalysis", "IL2060", Justification="MakeGenericMethod is used in this class to create MethodCallExpression nodes, but only if the method in question is called from user code - so it's never trimmed. After https://github.com/dotnet/linker/issues/2482 is fixed, the suppression will no longer be necessary.")>]
[<System.Runtime.CompilerServices.Nullable(0)>]
type EntityFrameworkQueryableExtensions = class
Public Module EntityFrameworkQueryableExtensions
繼承
EntityFrameworkQueryableExtensions
屬性

欄位

名稱 Description
ExecuteUpdateMethodInfo

這是一個內部 API,支援 Entity Framework Core 基礎架構,且不受公開 API 相同的相容性標準約束。 該內容可能會在任何新聞稿中未經通知而更改或移除。 你應該只在程式碼中直接使用它,並且要非常謹慎,並且要知道這樣做可能會導致更新到新的 Entity Framework Core 版本時應用程式失敗。

方法

名稱 Description
AllAsync<TSource>(IQueryable<TSource>, Expression<Func<TSource,Boolean>>, CancellationToken)

非同步判斷序列中的所有元素是否滿足某一條件。

AnyAsync<TSource>(IQueryable<TSource>, CancellationToken)

非同步判斷序列是否包含任何元素。

AnyAsync<TSource>(IQueryable<TSource>, Expression<Func<TSource,Boolean>>, CancellationToken)

非同步判斷序列中任一元素是否滿足某條件。

AsAsyncEnumerable<TSource>(IQueryable<TSource>)

回傳 和 IAsyncEnumerable<T> ,可非同步列舉。

AsNoTracking<TEntity>(IQueryable<TEntity>)

變更追蹤器不會追蹤從 LINQ 查詢回傳的任何實體。 若實體實例被修改,變更追蹤器不會偵測到,且 SaveChanges() 這些變更不會持久化到資料庫中。

AsNoTrackingWithIdentityResolution<TEntity>(IQueryable<TEntity>)

變更追蹤器不會追蹤從 LINQ 查詢回傳的任何實體。 若實體實例被修改,變更追蹤器不會偵測到,且 SaveChanges() 這些變更不會持久化到資料庫中。

AsTracking<TEntity>(IQueryable<TEntity>, QueryTrackingBehavior)

會回傳一個新查詢,變更追蹤器會根據「追蹤」參數的值,對所有回傳的實體都會追蹤變更,或不會追蹤。 在追蹤時,任何對實體實例的修改都會被偵測並持續保存到資料庫中。SaveChanges() 當不追蹤時,若實體實例被修改,變更追蹤器不會偵測到,且 SaveChanges() 這些變更不會持久化到資料庫中。

AsTracking<TEntity>(IQueryable<TEntity>)

回傳一個新查詢,變更追蹤器會追蹤所有回傳實體的變更。 任何對實體實例的修改都會被偵測到,並在 期間持續存在資料庫 SaveChanges()。

AverageAsync(IQueryable<Decimal>, CancellationToken)

非同步計算一列數值的平均值。

AverageAsync(IQueryable<Double>, CancellationToken)

非同步計算一列數值的平均值。

AverageAsync(IQueryable<Int32>, CancellationToken)

非同步計算一列數值的平均值。

AverageAsync(IQueryable<Int64>, CancellationToken)

非同步計算一列數值的平均值。

AverageAsync(IQueryable<Nullable<Decimal>>, CancellationToken)

非同步計算一列數值的平均值。

AverageAsync(IQueryable<Nullable<Double>>, CancellationToken)

非同步計算一列數值的平均值。

AverageAsync(IQueryable<Nullable<Int32>>, CancellationToken)

非同步計算一列數值的平均值。

AverageAsync(IQueryable<Nullable<Int64>>, CancellationToken)

非同步計算一列數值的平均值。

AverageAsync(IQueryable<Nullable<Single>>, CancellationToken)

非同步計算一列數值的平均值。

AverageAsync(IQueryable<Single>, CancellationToken)

非同步計算一列數值的平均值。

AverageAsync<TSource>(IQueryable<TSource>, Expression<Func<TSource,Decimal>>, CancellationToken)

非同步計算透過在輸入序列中每個元素上呼叫投影函數所得到的數值序列的平均值。

AverageAsync<TSource>(IQueryable<TSource>, Expression<Func<TSource,Double>>, CancellationToken)

非同步計算透過在輸入序列中每個元素上呼叫投影函數所得到的數值序列的平均值。

AverageAsync<TSource>(IQueryable<TSource>, Expression<Func<TSource,Int32>>, CancellationToken)

非同步計算透過在輸入序列中每個元素上呼叫投影函數所得到的數值序列的平均值。

AverageAsync<TSource>(IQueryable<TSource>, Expression<Func<TSource,Int64>>, CancellationToken)

非同步計算透過在輸入序列中每個元素上呼叫投影函數所得到的數值序列的平均值。

AverageAsync<TSource>(IQueryable<TSource>, Expression<Func<TSource,Nullable<Decimal>>>, CancellationToken)

非同步計算透過在輸入序列中每個元素上呼叫投影函數所得到的數值序列的平均值。

AverageAsync<TSource>(IQueryable<TSource>, Expression<Func<TSource,Nullable<Double>>>, CancellationToken)

非同步計算透過在輸入序列中每個元素上呼叫投影函數所得到的數值序列的平均值。

AverageAsync<TSource>(IQueryable<TSource>, Expression<Func<TSource,Nullable<Int32>>>, CancellationToken)

非同步計算透過在輸入序列中每個元素上呼叫投影函數所得到的數值序列的平均值。

AverageAsync<TSource>(IQueryable<TSource>, Expression<Func<TSource,Nullable<Int64>>>, CancellationToken)

非同步計算透過在輸入序列中每個元素上呼叫投影函數所得到的數值序列的平均值。

AverageAsync<TSource>(IQueryable<TSource>, Expression<Func<TSource,Nullable<Single>>>, CancellationToken)

非同步計算透過在輸入序列中每個元素上呼叫投影函數所得到的數值序列的平均值。

AverageAsync<TSource>(IQueryable<TSource>, Expression<Func<TSource,Single>>, CancellationToken)

非同步計算透過在輸入序列中每個元素上呼叫投影函數所得到的數值序列的平均值。

ContainsAsync<TSource>(IQueryable<TSource>, TSource, CancellationToken)

非同步地利用預設的等號比較器判斷序列是否包含特定元素。

CountAsync<TSource>(IQueryable<TSource>, CancellationToken)

非同步回傳序列中的元素數量。

CountAsync<TSource>(IQueryable<TSource>, Expression<Func<TSource,Boolean>>, CancellationToken)

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

ElementAtAsync<TSource>(IQueryable<TSource>, Int32, CancellationToken)

非同步回傳序列中指定索引的元素。

ElementAtOrDefaultAsync<TSource>(IQueryable<TSource>, Int32, CancellationToken)

非同步回傳序列中指定索引的元素,若索引超出範圍則回傳預設值。

ExecuteDelete<TSource>(IQueryable<TSource>)

刪除所有與 LINQ 查詢相符實體實例的資料庫列。

ExecuteDeleteAsync<TSource>(IQueryable<TSource>, CancellationToken)

非同步刪除與 LINQ 查詢相符的實體實例的資料庫列。

ExecuteUpdate<TSource>(IQueryable<TSource>, Action<UpdateSettersBuilder<TSource>>)

更新所有與資料庫 LINQ 查詢相符實體實例的資料庫資料列。

ExecuteUpdate<TSource>(IQueryable<TSource>, Expression<Func<SetPropertyCalls<TSource>,SetPropertyCalls<TSource>>>)

更新所有與資料庫 LINQ 查詢相符實體實例的資料庫資料列。

ExecuteUpdateAsync<TSource>(IQueryable<TSource>, Action<UpdateSettersBuilder<TSource>>, CancellationToken)

非同步更新與資料庫 LINQ 查詢相符實體實例的資料庫列。

ExecuteUpdateAsync<TSource>(IQueryable<TSource>, Expression<Func<SetPropertyCalls<TSource>,SetPropertyCalls<TSource>>>, CancellationToken)

非同步更新與資料庫 LINQ 查詢相符實體實例的資料庫列。

FirstAsync<TSource>(IQueryable<TSource>, CancellationToken)

非同步回傳序列的第一個元素。

FirstAsync<TSource>(IQueryable<TSource>, Expression<Func<TSource,Boolean>>, CancellationToken)

非同步回傳滿足特定條件的序列中第一個元素。

FirstOrDefaultAsync<TSource>(IQueryable<TSource>, CancellationToken)

非同步回傳序列的第一個元素,若序列中沒有元素則回傳預設值。

FirstOrDefaultAsync<TSource>(IQueryable<TSource>, Expression<Func<TSource,Boolean>>, CancellationToken)

非同步回傳序列中第一個符合指定條件的元素,若未找到該元素則回傳預設值。

ForEachAsync<T>(IQueryable<T>, Action<T>, CancellationToken)

非同步列舉查詢結果,並對每個元素執行指定動作。

IgnoreAutoIncludes<TEntity>(IQueryable<TEntity>)

規定目前的 Entity Framework LINQ 查詢不應套用任何模型層級的 eager loaded 導覽。

IgnoreQueryFilters<TEntity>(IQueryable<TEntity>, IReadOnlyCollection<String>)

規定目前的實體框架 LINQ 查詢不應套用任何模型層級的實體查詢過濾器。

IgnoreQueryFilters<TEntity>(IQueryable<TEntity>)

規定目前的實體框架 LINQ 查詢不應套用任何模型層級的實體查詢過濾器。

Include<TEntity,TProperty>(IQueryable<TEntity>, Expression<Func<TEntity,TProperty>>)

指定相關實體,包含在查詢結果中。 要包含的導航屬性會從被查詢TEntity的實體類型()開始指定。 如果你想根據所包含型別的導航屬性加入更多類型,請在此呼叫後串接呼叫至 ThenInclude<TEntity,TPreviousProperty,TProperty>(IIncludableQueryable<TEntity, IEnumerable<TPreviousProperty>>, Expression<Func<TPreviousProperty, TProperty>>) 。

Include<TEntity>(IQueryable<TEntity>, String)

指定相關實體,包含在查詢結果中。 要包含的導航屬性會從被查詢TEntity的實體類型()開始指定。 其他需包含的導航屬性可附加,並以 '.' 字元分隔。

LastAsync<TSource>(IQueryable<TSource>, CancellationToken)

非同步回傳序列的最後一個元素。

LastAsync<TSource>(IQueryable<TSource>, Expression<Func<TSource,Boolean>>, CancellationToken)

非同步回傳序列中滿足特定條件的最後一個元素。

LastOrDefaultAsync<TSource>(IQueryable<TSource>, CancellationToken)

非同步回傳序列的最後一個元素,若序列中無元素則回傳預設值。

LastOrDefaultAsync<TSource>(IQueryable<TSource>, Expression<Func<TSource,Boolean>>, CancellationToken)

非同步回傳序列中滿足特定條件的最後一個元素,若找不到該元素則回傳預設值。

Load<TSource>(IQueryable<TSource>)

列舉查詢。 使用實體框架時,查詢結果會被載入到相關上下文中。 這相當於呼叫 ToList,然後丟棄清單(但沒有實際建立清單的額外負擔)。

LoadAsync<TSource>(IQueryable<TSource>, CancellationToken)

非同步列舉查詢。 使用實體框架時,查詢結果會被載入到相關上下文中。 這相當於呼叫 ToList,然後丟棄清單(但沒有實際建立清單的額外負擔)。

LongCountAsync<TSource>(IQueryable<TSource>, CancellationToken)

非同步回傳代表序列中元素總數的 a Int64 。

LongCountAsync<TSource>(IQueryable<TSource>, Expression<Func<TSource,Boolean>>, CancellationToken)

非同步回傳 a Int64 ,代表序列中滿足條件的元素數量。

MaxAsync<TSource,TResult>(IQueryable<TSource>, Expression<Func<TSource,TResult>>, CancellationToken)

非同步地對序列中的每個元素呼叫投影函數,並回傳最大結果值。

MaxAsync<TSource>(IQueryable<TSource>, CancellationToken)

非同步回傳序列的最大值。

MaxByAsync<TSource,TKey>(IQueryable<TSource>, Expression<Func<TSource,TKey>>, CancellationToken)

非同步回傳根據指定的鍵選擇函式,在通用中 IQueryable<T> 最大值。

MinAsync<TSource,TResult>(IQueryable<TSource>, Expression<Func<TSource,TResult>>, CancellationToken)

非同步地對序列中的每個元素呼叫投影函數,並回傳最小結果值。

MinAsync<TSource>(IQueryable<TSource>, CancellationToken)

非同步回傳序列的最小值。

MinByAsync<TSource,TKey>(IQueryable<TSource>, Expression<Func<TSource,TKey>>, CancellationToken)

非同步回傳根據指定的鍵選擇函式,將通用的 IQueryable<T> 最小值回傳。

SingleAsync<TSource>(IQueryable<TSource>, CancellationToken)

非同步回傳序列中唯一的元素,若序列中沒有恰好一個元素則拋出例外。

SingleAsync<TSource>(IQueryable<TSource>, Expression<Func<TSource,Boolean>>, CancellationToken)

非同步回傳序列中唯一符合特定條件的元素,若存在多個此類元素則拋出例外。

SingleOrDefaultAsync<TSource>(IQueryable<TSource>, CancellationToken)

非同步回傳序列中唯一的元素,若序列為空則回傳預設值;此方法若序列中有多個元素,會拋出例外。

SingleOrDefaultAsync<TSource>(IQueryable<TSource>, Expression<Func<TSource,Boolean>>, CancellationToken)

非同步回傳序列中唯一符合指定條件的元素,若不存在該元素則回傳預設值;此方法若有多個元素符合條件,則拋出例外。

SumAsync(IQueryable<Decimal>, CancellationToken)

非同步計算一列數值的總和。

SumAsync(IQueryable<Double>, CancellationToken)

非同步計算一列數值的總和。

SumAsync(IQueryable<Int32>, CancellationToken)

非同步計算一列數值的總和。

SumAsync(IQueryable<Int64>, CancellationToken)

非同步計算一列數值的總和。

SumAsync(IQueryable<Nullable<Decimal>>, CancellationToken)

非同步計算一列數值的總和。

SumAsync(IQueryable<Nullable<Double>>, CancellationToken)

非同步計算一列數值的總和。

SumAsync(IQueryable<Nullable<Int32>>, CancellationToken)

非同步計算一列數值的總和。

SumAsync(IQueryable<Nullable<Int64>>, CancellationToken)

非同步計算一列數值的總和。

SumAsync(IQueryable<Nullable<Single>>, CancellationToken)

非同步計算一列數值的總和。

SumAsync(IQueryable<Single>, CancellationToken)

非同步計算一列數值的總和。

SumAsync<TSource>(IQueryable<TSource>, Expression<Func<TSource,Decimal>>, CancellationToken)

非同步計算透過呼叫投影函數在輸入序列中每個元素上所得到的數值序列總和。

SumAsync<TSource>(IQueryable<TSource>, Expression<Func<TSource,Double>>, CancellationToken)

非同步計算透過呼叫投影函數在輸入序列中每個元素上所得到的數值序列總和。

SumAsync<TSource>(IQueryable<TSource>, Expression<Func<TSource,Int32>>, CancellationToken)

非同步計算透過呼叫投影函數在輸入序列中每個元素上所得到的數值序列總和。

SumAsync<TSource>(IQueryable<TSource>, Expression<Func<TSource,Int64>>, CancellationToken)

非同步計算透過呼叫投影函數在輸入序列中每個元素上所得到的數值序列總和。

SumAsync<TSource>(IQueryable<TSource>, Expression<Func<TSource,Nullable<Decimal>>>, CancellationToken)

非同步計算透過呼叫投影函數在輸入序列中每個元素上所得到的數值序列總和。

SumAsync<TSource>(IQueryable<TSource>, Expression<Func<TSource,Nullable<Double>>>, CancellationToken)

非同步計算透過呼叫投影函數在輸入序列中每個元素上所得到的數值序列總和。

SumAsync<TSource>(IQueryable<TSource>, Expression<Func<TSource,Nullable<Int32>>>, CancellationToken)

非同步計算透過呼叫投影函數在輸入序列中每個元素上所得到的數值序列總和。

SumAsync<TSource>(IQueryable<TSource>, Expression<Func<TSource,Nullable<Int64>>>, CancellationToken)

非同步計算透過呼叫投影函數在輸入序列中每個元素上所得到的數值序列總和。

SumAsync<TSource>(IQueryable<TSource>, Expression<Func<TSource,Nullable<Single>>>, CancellationToken)

非同步計算透過呼叫投影函數在輸入序列中每個元素上所得到的數值序列總和。

SumAsync<TSource>(IQueryable<TSource>, Expression<Func<TSource,Single>>, CancellationToken)

非同步計算透過呼叫投影函數在輸入序列中每個元素上所得到的數值序列總和。

TagWith<T>(IQueryable<T>, String)

在與 EF LINQ 查詢相關的標籤集合中新增一個標籤。 標籤是查詢註解,能在查詢流程的不同點提供上下文追蹤資訊。

TagWithCallSite<T>(IQueryable<T>, String, Int32)

在與 EF LINQ 查詢相關的標籤集合中新增一個標籤,包含來源檔名及方法呼叫的行,能在查詢流程的不同階段提供上下文追蹤資訊。

ThenInclude<TEntity,TPreviousProperty,TProperty>(IIncludableQueryable<TEntity, ICollection<TPreviousProperty>>, Expression<Func<TPreviousProperty, TProperty>>)

根據剛納入的相關類型,指定額外相關資料需進一步納入。

ThenInclude<TEntity,TPreviousProperty,TProperty>(IIncludableQueryable<TEntity, IEnumerable<TPreviousProperty>>, Expression<Func<TPreviousProperty, TProperty>>)

根據剛納入的相關類型,指定額外相關資料需進一步納入。

ThenInclude<TEntity,TPreviousProperty,TProperty>(IIncludableQueryable<TEntity,TPreviousProperty>, Expression<Func<TPreviousProperty,TProperty>>)

根據剛納入的相關類型,指定額外相關資料需進一步納入。

ToArrayAsync<TSource>(IQueryable<TSource>, CancellationToken)

非同步地從 中 IQueryable<T> 建立陣列,方法是透過非同步枚舉它。

ToDictionaryAsync<TSource,TKey,TElement>(IQueryable<TSource>, Func<TSource,TKey>, Func<TSource,TElement>, CancellationToken)

透過非同步列舉,依照指定的鍵選擇器與元素選擇函式,從 建立 a Dictionary<TKey,TValue>IQueryable<T> 。

ToDictionaryAsync<TSource,TKey,TElement>(IQueryable<TSource>, Func<TSource,TKey>, Func<TSource,TElement>, IEqualityComparer<TKey>, CancellationToken)

透過非同步列舉,依照指定的鍵選擇函數、比較器及元素選擇函式,從 和 IQueryable<T> 建立 aDictionary<TKey,TValue>。

ToDictionaryAsync<TSource,TKey>(IQueryable<TSource>, Func<TSource,TKey>, CancellationToken)

透過非同步列舉,依照指定的鍵選擇函式從 中IQueryable<T>建立 aDictionary<TKey,TValue>。

ToDictionaryAsync<TSource,TKey>(IQueryable<TSource>, Func<TSource,TKey>, IEqualityComparer<TKey>, CancellationToken)

透過非同步列舉,根據指定的金鑰選擇函式與比較器,從 和 IQueryable<T> 建立 。Dictionary<TKey,TValue>

ToHashSetAsync<TSource>(IQueryable<TSource>, CancellationToken)

非同步地從 中IQueryable<T>建立 aHashSet<T>,方法是透過非同步列舉它。

ToHashSetAsync<TSource>(IQueryable<TSource>, IEqualityComparer<TSource>, CancellationToken)

非同步地從 中IQueryable<T>建立 aHashSet<T>,方法是透過非同步列舉它。

ToListAsync<TSource>(IQueryable<TSource>, CancellationToken)

非同步地從 中IQueryable<T>建立 aList<T>,方法是透過非同步列舉它。

ToQueryString(IQueryable)

產生所用查詢的字串表示法。 此字串可能不適合直接執行,僅用於除錯。

適用於