语言

LocalView<TEntity>.FindEntry 方法

定义

重载

名称 说明
FindEntry(IEnumerable<IProperty>, IEnumerable<Object>)

返回由上下文跟踪的第一个实体的一个 EntityEntry<TEntity> 实体,其中给定属性的值与给定的值匹配。 该条目提供对实体的更改跟踪信息和操作的访问权限。

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

返回由上下文跟踪的第一个实体的一个 EntityEntry<TEntity> 实体,其中给定属性的值与给定的值匹配。 该条目提供对实体的更改跟踪信息和操作的访问权限。

FindEntry<TKey>(TKey)

在 EntityEntry<TEntity> 更改跟踪器中查找具有给定主键值的实体(如果跟踪它)。 null 如果未跟踪具有给定键值的实体,则返回 。 此方法从不查询数据库。

FindEntry<TProperty>(IProperty, TProperty)

返回由给定属性的值与给定值匹配的上下文跟踪的第一个实体的一个 EntityEntry<TEntity> 实体。 该条目提供对实体的更改跟踪信息和操作的访问权限。

FindEntry<TProperty>(String, TProperty)

返回由给定属性的值与给定值匹配的上下文跟踪的第一个实体的一个 EntityEntry<TEntity> 实体。 该条目提供对实体的更改跟踪信息和操作的访问权限。

FindEntry(IEnumerable<IProperty>, IEnumerable<Object>)

Source:
LocalView.cs
Source:
LocalView.cs
Source:
LocalView.cs
Source:
LocalView.cs

返回由上下文跟踪的第一个实体的一个 EntityEntry<TEntity> 实体,其中给定属性的值与给定的值匹配。 该条目提供对实体的更改跟踪信息和操作的访问权限。

public virtual Microsoft.EntityFrameworkCore.ChangeTracking.EntityEntry<TEntity>? FindEntry(System.Collections.Generic.IEnumerable<Microsoft.EntityFrameworkCore.Metadata.IProperty> properties, System.Collections.Generic.IEnumerable<object?> propertyValues);
abstract member FindEntry : seq<Microsoft.EntityFrameworkCore.Metadata.IProperty> * seq<obj> -> Microsoft.EntityFrameworkCore.ChangeTracking.EntityEntry<'Entity (requires 'Entity : null)>
override this.FindEntry : seq<Microsoft.EntityFrameworkCore.Metadata.IProperty> * seq<obj> -> Microsoft.EntityFrameworkCore.ChangeTracking.EntityEntry<'Entity (requires 'Entity : null)>
Public Overridable Function FindEntry (properties As IEnumerable(Of IProperty), propertyValues As IEnumerable(Of Object)) As EntityEntry(Of TEntity)

参数

properties
IEnumerable<IProperty>

要匹配的属性。

propertyValues
IEnumerable<Object>

要匹配的属性的值。

返回

找到的实体的条目,或 null。

注解

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

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

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

适用于

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

Source:
LocalView.cs
Source:
LocalView.cs
Source:
LocalView.cs
Source:
LocalView.cs

返回由上下文跟踪的第一个实体的一个 EntityEntry<TEntity> 实体,其中给定属性的值与给定的值匹配。 该条目提供对实体的更改跟踪信息和操作的访问权限。

public virtual Microsoft.EntityFrameworkCore.ChangeTracking.EntityEntry<TEntity>? FindEntry(System.Collections.Generic.IEnumerable<string> propertyNames, System.Collections.Generic.IEnumerable<object?> propertyValues);
abstract member FindEntry : seq<string> * seq<obj> -> Microsoft.EntityFrameworkCore.ChangeTracking.EntityEntry<'Entity (requires 'Entity : null)>
override this.FindEntry : seq<string> * seq<obj> -> Microsoft.EntityFrameworkCore.ChangeTracking.EntityEntry<'Entity (requires 'Entity : null)>
Public Overridable Function FindEntry (propertyNames As IEnumerable(Of String), propertyValues As IEnumerable(Of Object)) As EntityEntry(Of TEntity)

参数

propertyNames
IEnumerable<String>

要匹配的属性的名称。

propertyValues
IEnumerable<Object>

要匹配的属性的值。

返回

找到的实体的条目,或 null。

注解

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

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

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

适用于

FindEntry<TKey>(TKey)

Source:
LocalView.cs
Source:
LocalView.cs
Source:
LocalView.cs
Source:
LocalView.cs

在 EntityEntry<TEntity> 更改跟踪器中查找具有给定主键值的实体(如果跟踪它)。 null 如果未跟踪具有给定键值的实体,则返回 。 此方法从不查询数据库。

public virtual Microsoft.EntityFrameworkCore.ChangeTracking.EntityEntry<TEntity>? FindEntry<TKey>(TKey keyValue);
abstract member FindEntry : 'Key -> Microsoft.EntityFrameworkCore.ChangeTracking.EntityEntry<'Entity (requires 'Entity : null)>
override this.FindEntry : 'Key -> Microsoft.EntityFrameworkCore.ChangeTracking.EntityEntry<'Entity (requires 'Entity : null)>
Public Overridable Function FindEntry(Of TKey) (keyValue As TKey) As EntityEntry(Of TEntity)

类型参数

TKey

主键属性的类型。

参数

keyValue
TKey

要找到的实体的主键的值。

返回

找到的实体的条目,或 null。

注解

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

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

适用于

FindEntry<TProperty>(IProperty, TProperty)

Source:
LocalView.cs
Source:
LocalView.cs
Source:
LocalView.cs
Source:
LocalView.cs

返回由给定属性的值与给定值匹配的上下文跟踪的第一个实体的一个 EntityEntry<TEntity> 实体。 该条目提供对实体的更改跟踪信息和操作的访问权限。

public virtual Microsoft.EntityFrameworkCore.ChangeTracking.EntityEntry<TEntity>? FindEntry<TProperty>(Microsoft.EntityFrameworkCore.Metadata.IProperty property, TProperty? propertyValue);
abstract member FindEntry : Microsoft.EntityFrameworkCore.Metadata.IProperty * 'Property -> Microsoft.EntityFrameworkCore.ChangeTracking.EntityEntry<'Entity (requires 'Entity : null)>
override this.FindEntry : Microsoft.EntityFrameworkCore.Metadata.IProperty * 'Property -> Microsoft.EntityFrameworkCore.ChangeTracking.EntityEntry<'Entity (requires 'Entity : null)>
Public Overridable Function FindEntry(Of TProperty) (property As IProperty, propertyValue As TProperty) As EntityEntry(Of TEntity)

类型参数

TProperty

属性值的类型。

参数

property
IProperty

要匹配的属性。

propertyValue
TProperty

要匹配的属性的值。

返回

找到的实体的条目,或 null。

注解

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

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

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

适用于

FindEntry<TProperty>(String, TProperty)

Source:
LocalView.cs
Source:
LocalView.cs
Source:
LocalView.cs
Source:
LocalView.cs

返回由给定属性的值与给定值匹配的上下文跟踪的第一个实体的一个 EntityEntry<TEntity> 实体。 该条目提供对实体的更改跟踪信息和操作的访问权限。

public virtual Microsoft.EntityFrameworkCore.ChangeTracking.EntityEntry<TEntity>? FindEntry<TProperty>(string propertyName, TProperty? propertyValue);
abstract member FindEntry : string * 'Property -> Microsoft.EntityFrameworkCore.ChangeTracking.EntityEntry<'Entity (requires 'Entity : null)>
override this.FindEntry : string * 'Property -> Microsoft.EntityFrameworkCore.ChangeTracking.EntityEntry<'Entity (requires 'Entity : null)>
Public Overridable Function FindEntry(Of TProperty) (propertyName As String, propertyValue As TProperty) As EntityEntry(Of TEntity)

类型参数

TProperty

属性值的类型。

参数

propertyName
String

要匹配的属性的名称。

propertyValue
TProperty

要匹配的属性的值。

返回

找到的实体的条目,或 null。

注解

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

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

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

适用于