LocalView<TEntity>.GetEntries Method

Definition

Overloads

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

Returns an EntityEntry for each entity being tracked by the context where the values of the given properties matches the given values. The entries provide access to change tracking information and operations for each entity.

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

Returns an EntityEntry for each entity being tracked by the context where the values of the given properties matches the given values. The entries provide access to change tracking information and operations for each entity.

GetEntries<TProperty>(String, TProperty)

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

GetEntries<TProperty>(IProperty, TProperty)

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

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

Returns an EntityEntry for each entity being tracked by the context where the values of the given properties matches the given values. The entries provide access to change tracking information and operations for each entity.

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))

Parameters

properties
IEnumerable<IProperty>

The the properties to match.

propertyValues
IEnumerable<Object>

The values of the properties to match.

Returns

An entry for each entity being tracked.

Remarks

This method is frequently used to get the entities 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 values.

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.

Note that modification of entity state while iterating over the returned enumeration may result in an InvalidOperationException indicating that the collection was modified while enumerating. To avoid this, create a defensive copy using ToList<TSource>(IEnumerable<TSource>) or similar before iterating.

See EF Core change tracking for more information and examples.

Applies to

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

Returns an EntityEntry for each entity being tracked by the context where the values of the given properties matches the given values. The entries provide access to change tracking information and operations for each entity.

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))

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 each entity being tracked.

Remarks

This method is frequently used to get the entities 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 values.

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.

Note that modification of entity state while iterating over the returned enumeration may result in an InvalidOperationException indicating that the collection was modified while enumerating. To avoid this, create a defensive copy using ToList<TSource>(IEnumerable<TSource>) or similar before iterating.

See EF Core change tracking for more information and examples.

Applies to

GetEntries<TProperty>(String, TProperty)

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

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))

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 each entity being tracked.

Remarks

This method is frequently used to get the entities 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 values.

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.

Note that modification of entity state while iterating over the returned enumeration may result in an InvalidOperationException indicating that the collection was modified while enumerating. To avoid this, create a defensive copy using ToList<TSource>(IEnumerable<TSource>) or similar before iterating.

See EF Core change tracking for more information and examples.

Applies to

GetEntries<TProperty>(IProperty, TProperty)

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

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))

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 each entity being tracked.

Remarks

This method is frequently used to get the entities 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 values.

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.

Note that modification of entity state while iterating over the returned enumeration may result in an InvalidOperationException indicating that the collection was modified while enumerating. To avoid this, create a defensive copy using ToList<TSource>(IEnumerable<TSource>) or similar before iterating.

See EF Core change tracking for more information and examples.

Applies to