LocalView<TEntity>.GetEntries 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
多載
| 名稱 | Description |
|---|---|
| GetEntries(IEnumerable<IProperty>, IEnumerable<Object>) |
對於每個被上下文追蹤的實體,回傳 EntityEntry 一個,該上下文中給定屬性的值與給定值相符。 這些條目提供每個實體的變更追蹤資訊與操作存取權限。 |
| GetEntries(IEnumerable<String>, IEnumerable<Object>) |
對於每個被上下文追蹤的實體,回傳 EntityEntry 一個,該上下文中給定屬性的值與給定值相符。 這些條目提供每個實體的變更追蹤資訊與操作存取權限。 |
| GetEntries<TProperty>(String, TProperty) |
對於每個被上下文追蹤的實體,回傳 EntityEntry<TEntity> 一個,當該屬性的值與給定值相符。 這些條目提供每個實體的變更追蹤資訊與操作存取權限。 |
| GetEntries<TProperty>(IProperty, TProperty) |
對於每個被上下文追蹤的實體,回傳 EntityEntry<TEntity> 一個,當該屬性的值與給定值相符。 這些條目提供每個實體的變更追蹤資訊與操作存取權限。 |
GetEntries(IEnumerable<IProperty>, IEnumerable<Object>)
- 來源:
- LocalView.cs
- 來源:
- LocalView.cs
- 來源:
- LocalView.cs
- 來源:
- LocalView.cs
對於每個被上下文追蹤的實體,回傳 EntityEntry 一個,該上下文中給定屬性的值與給定值相符。 這些條目提供每個實體的變更追蹤資訊與操作存取權限。
public virtual System.Collections.Generic.IEnumerable<Microsoft.EntityFrameworkCore.ChangeTracking.EntityEntry<TEntity>> GetEntries(System.Collections.Generic.IEnumerable<Microsoft.EntityFrameworkCore.Metadata.IProperty> properties, System.Collections.Generic.IEnumerable<object?> propertyValues);
abstract member GetEntries : seq<Microsoft.EntityFrameworkCore.Metadata.IProperty> * seq<obj> -> seq<Microsoft.EntityFrameworkCore.ChangeTracking.EntityEntry<'Entity>>
override this.GetEntries : seq<Microsoft.EntityFrameworkCore.Metadata.IProperty> * seq<obj> -> seq<Microsoft.EntityFrameworkCore.ChangeTracking.EntityEntry<'Entity>>
Public Overridable Function GetEntries (properties As IEnumerable(Of IProperty), propertyValues As IEnumerable(Of Object)) As IEnumerable(Of EntityEntry(Of TEntity))
參數
- properties
- IEnumerable<IProperty>
屬性也要配合。
- propertyValues
- IEnumerable<Object>
屬性的價值要匹配。
傳回
每個被追蹤實體的條目。
備註
此方法常用來取得具有非空外鍵、主鍵或替代鍵值的實體。 使用這類關鍵屬性的查詢比對其他屬性值的查詢更有效率。
預設情況下,存取 Local 會呼叫 DetectChanges() 以確保所有搜尋並回傳的實體皆為 up-to-日期。 呼叫此方法不會再次呼叫 。DetectChanges() 由於此方法常用於快速查詢,請考慮重複使用該 Local 物件進行多次查詢,或停用使用 AutoDetectChangesEnabled。
請注意,在迭代回傳回的枚舉時修改實體狀態,可能會顯示 InvalidOperationException 集合在枚舉時被修改。 為了避免這種情況,建議在迭代前先建立防禦性複製 ToList<TSource>(IEnumerable<TSource>) 品。
更多資訊與範例請參閱 EF Core 變更追蹤 。
適用於
GetEntries(IEnumerable<String>, IEnumerable<Object>)
- 來源:
- LocalView.cs
- 來源:
- LocalView.cs
- 來源:
- LocalView.cs
- 來源:
- LocalView.cs
對於每個被上下文追蹤的實體,回傳 EntityEntry 一個,該上下文中給定屬性的值與給定值相符。 這些條目提供每個實體的變更追蹤資訊與操作存取權限。
public virtual System.Collections.Generic.IEnumerable<Microsoft.EntityFrameworkCore.ChangeTracking.EntityEntry<TEntity>> GetEntries(System.Collections.Generic.IEnumerable<string> propertyNames, System.Collections.Generic.IEnumerable<object?> propertyValues);
abstract member GetEntries : seq<string> * seq<obj> -> seq<Microsoft.EntityFrameworkCore.ChangeTracking.EntityEntry<'Entity>>
override this.GetEntries : seq<string> * seq<obj> -> seq<Microsoft.EntityFrameworkCore.ChangeTracking.EntityEntry<'Entity>>
Public Overridable Function GetEntries (propertyNames As IEnumerable(Of String), propertyValues As IEnumerable(Of Object)) As IEnumerable(Of EntityEntry(Of TEntity))
參數
- propertyNames
- IEnumerable<String>
物業名稱也要配合。
- propertyValues
- IEnumerable<Object>
屬性的價值要匹配。
傳回
每個被追蹤實體的條目。
備註
此方法常用來取得具有非空外鍵、主鍵或替代鍵值的實體。 使用這類關鍵屬性的查詢比對其他屬性值的查詢更有效率。
預設情況下,存取 Local 會呼叫 DetectChanges() 以確保所有搜尋並回傳的實體皆為 up-to-日期。 呼叫此方法不會再次呼叫 。DetectChanges() 由於此方法常用於快速查詢,請考慮重複使用該 Local 物件進行多次查詢,或停用使用 AutoDetectChangesEnabled。
請注意,在迭代回傳回的枚舉時修改實體狀態,可能會顯示 InvalidOperationException 集合在枚舉時被修改。 為了避免這種情況,建議在迭代前先建立防禦性複製 ToList<TSource>(IEnumerable<TSource>) 品。
更多資訊與範例請參閱 EF Core 變更追蹤 。
適用於
GetEntries<TProperty>(String, TProperty)
- 來源:
- LocalView.cs
- 來源:
- LocalView.cs
- 來源:
- LocalView.cs
- 來源:
- LocalView.cs
對於每個被上下文追蹤的實體,回傳 EntityEntry<TEntity> 一個,當該屬性的值與給定值相符。 這些條目提供每個實體的變更追蹤資訊與操作存取權限。
public virtual System.Collections.Generic.IEnumerable<Microsoft.EntityFrameworkCore.ChangeTracking.EntityEntry<TEntity>> GetEntries<TProperty>(string propertyName, TProperty? propertyValue);
abstract member GetEntries : string * 'Property -> seq<Microsoft.EntityFrameworkCore.ChangeTracking.EntityEntry<'Entity>>
override this.GetEntries : string * 'Property -> seq<Microsoft.EntityFrameworkCore.ChangeTracking.EntityEntry<'Entity>>
Public Overridable Function GetEntries(Of TProperty) (propertyName As String, propertyValue As TProperty) As IEnumerable(Of EntityEntry(Of TEntity))
類型參數
- TProperty
屬性值的型別。
參數
- propertyName
- String
物業名稱也相符。
- propertyValue
- TProperty
房產價值也要匹配。
傳回
每個被追蹤實體的條目。
備註
此方法常用來取得具有非空外鍵、主鍵或替代鍵值的實體。 使用這類關鍵屬性的查詢比對其他屬性值的查詢更有效率。
預設情況下,存取 Local 會呼叫 DetectChanges() 以確保所有搜尋並回傳的實體皆為 up-to-日期。 呼叫此方法不會再次呼叫 。DetectChanges() 由於此方法常用於快速查詢,請考慮重複使用該 Local 物件進行多次查詢,或停用使用 AutoDetectChangesEnabled。
請注意,在迭代回傳回的枚舉時修改實體狀態,可能會顯示 InvalidOperationException 集合在枚舉時被修改。 為了避免這種情況,建議在迭代前先建立防禦性複製 ToList<TSource>(IEnumerable<TSource>) 品。
更多資訊與範例請參閱 EF Core 變更追蹤 。
適用於
GetEntries<TProperty>(IProperty, TProperty)
- 來源:
- LocalView.cs
- 來源:
- LocalView.cs
- 來源:
- LocalView.cs
- 來源:
- LocalView.cs
對於每個被上下文追蹤的實體,回傳 EntityEntry<TEntity> 一個,當該屬性的值與給定值相符。 這些條目提供每個實體的變更追蹤資訊與操作存取權限。
public virtual System.Collections.Generic.IEnumerable<Microsoft.EntityFrameworkCore.ChangeTracking.EntityEntry<TEntity>> GetEntries<TProperty>(Microsoft.EntityFrameworkCore.Metadata.IProperty property, TProperty? propertyValue);
abstract member GetEntries : Microsoft.EntityFrameworkCore.Metadata.IProperty * 'Property -> seq<Microsoft.EntityFrameworkCore.ChangeTracking.EntityEntry<'Entity>>
override this.GetEntries : Microsoft.EntityFrameworkCore.Metadata.IProperty * 'Property -> seq<Microsoft.EntityFrameworkCore.ChangeTracking.EntityEntry<'Entity>>
Public Overridable Function GetEntries(Of TProperty) (property As IProperty, propertyValue As TProperty) As IEnumerable(Of EntityEntry(Of TEntity))
類型參數
- TProperty
屬性值的型別。
參數
- property
- IProperty
這塊地也相配。
- propertyValue
- TProperty
房產價值也要匹配。
傳回
每個被追蹤實體的條目。
備註
此方法常用來取得具有非空外鍵、主鍵或替代鍵值的實體。 使用這類關鍵屬性的查詢比對其他屬性值的查詢更有效率。
預設情況下,存取 Local 會呼叫 DetectChanges() 以確保所有搜尋並回傳的實體皆為 up-to-日期。 呼叫此方法不會再次呼叫 。DetectChanges() 由於此方法常用於快速查詢,請考慮重複使用該 Local 物件進行多次查詢,或停用使用 AutoDetectChangesEnabled。
請注意,在迭代回傳回的枚舉時修改實體狀態,可能會顯示 InvalidOperationException 集合在枚舉時被修改。 為了避免這種情況,建議在迭代前先建立防禦性複製 ToList<TSource>(IEnumerable<TSource>) 品。
更多資訊與範例請參閱 EF Core 變更追蹤 。