Delen via


LocalView<TEntity>.FindEntry Method

Definition

Overloads

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

Returns an EntityEntry<TEntity> for the first entity being tracked by the context where the value of the given property matches the given values. The entry provide access to change tracking information and operations for the entity.

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

Returns an EntityEntry<TEntity> for the first entity being tracked by the context where the value of the given property matches the given values. The entry provide access to change tracking information and operations for the entity.

FindEntry<TKey>(TKey)

Finds an EntityEntry<TEntity> for the entity with the given primary key value in the change tracker, if it is being tracked. null is returned if no entity with the given key value is being tracked. This method never queries the database.

FindEntry<TProperty>(IProperty, TProperty)

Returns an EntityEntry<TEntity> for the first entity being tracked by the context where the value of the given property matches the given value. The entry provide access to change tracking information and operations for the entity.

FindEntry<TProperty>(String, TProperty)

Returns an EntityEntry<TEntity> for the first entity being tracked by the context where the value of the given property matches the given value. The entry provide access to change tracking information and operations for the entity.

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

Source:
LocalView.cs
Source:
LocalView.cs

Returns an EntityEntry<TEntity> for the first entity being tracked by the context where the value of the given property matches the given values. The entry provide access to change tracking information and operations for the entity.

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)

Parameters

properties
IEnumerable<IProperty>

The properties to match.

propertyValues
IEnumerable<Object>

The values of the properties to match.

Returns

An entry for the entity found, or null.

Remarks

This method is frequently used to get the entity with a given non-null foreign key, primary key, or alternate key values. Lookups using a key property like this are more efficient than lookups on other property value.

By default, accessing Local will call DetectChanges() to ensure that all entities searched and returned are up-to-date. Calling this method will not result in another call to DetectChanges(). Since this method is commonly used for fast lookups, consider reusing the Local object for multiple lookups and/or disabling automatic detecting of changes using AutoDetectChangesEnabled.

See EF Core change tracking for more information and examples.

Applies to

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

Source:
LocalView.cs
Source:
LocalView.cs

Returns an EntityEntry<TEntity> for the first entity being tracked by the context where the value of the given property matches the given values. The entry provide access to change tracking information and operations for the entity.

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)

Parameters

propertyNames
IEnumerable<String>

The name of the properties to match.

propertyValues
IEnumerable<Object>

The values of the properties to match.

Returns

An entry for the entity found, or null.

Remarks

This method is frequently used to get the entity with a given non-null foreign key, primary key, or alternate key values. Lookups using a key property like this are more efficient than lookups on other property value.

By default, accessing Local will call DetectChanges() to ensure that all entities searched and returned are up-to-date. Calling this method will not result in another call to DetectChanges(). Since this method is commonly used for fast lookups, consider reusing the Local object for multiple lookups and/or disabling automatic detecting of changes using AutoDetectChangesEnabled.

See EF Core change tracking for more information and examples.

Applies to

FindEntry<TKey>(TKey)

Source:
LocalView.cs
Source:
LocalView.cs

Finds an EntityEntry<TEntity> for the entity with the given primary key value in the change tracker, if it is being tracked. null is returned if no entity with the given key value is being tracked. This method never queries the database.

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)

Type Parameters

TKey

The type of the primary key property.

Parameters

keyValue
TKey

The value of the primary key for the entity to be found.

Returns

An entry for the entity found, or null.

Remarks

By default, accessing Local will call DetectChanges() to ensure that all entities searched and returned are up-to-date. Calling this method will not result in another call to DetectChanges(). Since this method is commonly used for fast lookups, consider reusing the Local object for multiple lookups and/or disabling automatic detecting of changes using AutoDetectChangesEnabled.

See EF Core change tracking for more information and examples.

Applies to

FindEntry<TProperty>(IProperty, TProperty)

Source:
LocalView.cs
Source:
LocalView.cs

Returns an EntityEntry<TEntity> for the first entity being tracked by the context where the value of the given property matches the given value. The entry provide access to change tracking information and operations for the entity.

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)

Type Parameters

TProperty

The type of the property value.

Parameters

property
IProperty

The property to match.

propertyValue
TProperty

The value of the property to match.

Returns

An entry for the entity found, or null.

Remarks

This method is frequently used to get the entity with a given non-null foreign key, primary key, or alternate key value. Lookups using a key property like this are more efficient than lookups on other property value.

By default, accessing Local will call DetectChanges() to ensure that all entities searched and returned are up-to-date. Calling this method will not result in another call to DetectChanges(). Since this method is commonly used for fast lookups, consider reusing the Local object for multiple lookups and/or disabling automatic detecting of changes using AutoDetectChangesEnabled.

See EF Core change tracking for more information and examples.

Applies to

FindEntry<TProperty>(String, TProperty)

Source:
LocalView.cs
Source:
LocalView.cs

Returns an EntityEntry<TEntity> for the first entity being tracked by the context where the value of the given property matches the given value. The entry provide access to change tracking information and operations for the entity.

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)

Type Parameters

TProperty

The type of the property value.

Parameters

propertyName
String

The name of the property to match.

propertyValue
TProperty

The value of the property to match.

Returns

An entry for the entity found, or null.

Remarks

This method is frequently used to get the entity with a given non-null foreign key, primary key, or alternate key value. Lookups using a key property like this are more efficient than lookups on other property value.

By default, accessing Local will call DetectChanges() to ensure that all entities searched and returned are up-to-date. Calling this method will not result in another call to DetectChanges(). Since this method is commonly used for fast lookups, consider reusing the Local object for multiple lookups and/or disabling automatic detecting of changes using AutoDetectChangesEnabled.

See EF Core change tracking for more information and examples.

Applies to