语言

LocalView<TEntity>.GetEntries 方法

定义

重载

名称 说明
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>)

Source:
LocalView.cs
Source:
LocalView.cs
Source:
LocalView.cs
Source:
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>

要匹配的属性的值。

返回

要跟踪的每个实体的条目。

注解

此方法通常用于获取具有给定非 null 外键、主键或备用键值的实体。 使用类似键属性的查找比其他属性值的查找更有效。

默认情况下,访问 Local 将调用 DetectChanges() 以确保搜索和返回的所有实体都 up-to-date。 调用此方法不会导致另一次调用 DetectChanges()。 由于此方法通常用于快速查找,因此请考虑重用 Local 对象进行多个查找和/或禁用使用 AutoDetectChangesEnabled自动检测更改。

请注意,在循环访问返回的枚举时修改实体状态可能会导致 InvalidOperationException 指示在枚举时修改了集合。 为了避免这种情况,请在迭代之前使用 ToList<TSource>(IEnumerable<TSource>) 或类似方式创建防御副本。

有关详细信息和示例,请参阅 EF Core 更改跟踪 。

适用于

GetEntries(IEnumerable<String>, IEnumerable<Object>)

Source:
LocalView.cs
Source:
LocalView.cs
Source:
LocalView.cs
Source:
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>

要匹配的属性的值。

返回

要跟踪的每个实体的条目。

注解

此方法通常用于获取具有给定非 null 外键、主键或备用键值的实体。 使用类似键属性的查找比其他属性值的查找更有效。

默认情况下,访问 Local 将调用 DetectChanges() 以确保搜索和返回的所有实体都 up-to-date。 调用此方法不会导致另一次调用 DetectChanges()。 由于此方法通常用于快速查找,因此请考虑重用 Local 对象进行多个查找和/或禁用使用 AutoDetectChangesEnabled自动检测更改。

请注意,在循环访问返回的枚举时修改实体状态可能会导致 InvalidOperationException 指示在枚举时修改了集合。 为了避免这种情况,请在迭代之前使用 ToList<TSource>(IEnumerable<TSource>) 或类似方式创建防御副本。

有关详细信息和示例,请参阅 EF Core 更改跟踪 。

适用于

GetEntries<TProperty>(String, TProperty)

Source:
LocalView.cs
Source:
LocalView.cs
Source:
LocalView.cs
Source:
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

要匹配的属性的值。

返回

要跟踪的每个实体的条目。

注解

此方法通常用于获取具有给定非 null 外键、主键或备用键值的实体。 使用类似键属性的查找比其他属性值的查找更有效。

默认情况下,访问 Local 将调用 DetectChanges() 以确保搜索和返回的所有实体都 up-to-date。 调用此方法不会导致另一次调用 DetectChanges()。 由于此方法通常用于快速查找,因此请考虑重用 Local 对象进行多个查找和/或禁用使用 AutoDetectChangesEnabled自动检测更改。

请注意,在循环访问返回的枚举时修改实体状态可能会导致 InvalidOperationException 指示在枚举时修改了集合。 为了避免这种情况,请在迭代之前使用 ToList<TSource>(IEnumerable<TSource>) 或类似方式创建防御副本。

有关详细信息和示例,请参阅 EF Core 更改跟踪 。

适用于

GetEntries<TProperty>(IProperty, TProperty)

Source:
LocalView.cs
Source:
LocalView.cs
Source:
LocalView.cs
Source:
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

要匹配的属性的值。

返回

要跟踪的每个实体的条目。

注解

此方法通常用于获取具有给定非 null 外键、主键或备用键值的实体。 使用类似键属性的查找比其他属性值的查找更有效。

默认情况下,访问 Local 将调用 DetectChanges() 以确保搜索和返回的所有实体都 up-to-date。 调用此方法不会导致另一次调用 DetectChanges()。 由于此方法通常用于快速查找,因此请考虑重用 Local 对象进行多个查找和/或禁用使用 AutoDetectChangesEnabled自动检测更改。

请注意,在循环访问返回的枚举时修改实体状态可能会导致 InvalidOperationException 指示在枚举时修改了集合。 为了避免这种情况,请在迭代之前使用 ToList<TSource>(IEnumerable<TSource>) 或类似方式创建防御副本。

有关详细信息和示例,请参阅 EF Core 更改跟踪 。

适用于