ChangeTracker.Entries Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
Entries() |
Returns an EntityEntry for each entity being tracked by the context. The entries provide access to change tracking information and operations for each entity. |
Entries<TEntity>() |
Gets an EntityEntry for all entities of a given type being tracked by the context. The entries provide access to change tracking information and operations for each entity. |
Entries()
Returns an EntityEntry for each entity being tracked by the context. The entries provide access to change tracking information and operations for each entity.
public virtual System.Collections.Generic.IEnumerable<Microsoft.EntityFrameworkCore.ChangeTracking.EntityEntry> Entries ();
abstract member Entries : unit -> seq<Microsoft.EntityFrameworkCore.ChangeTracking.EntityEntry>
override this.Entries : unit -> seq<Microsoft.EntityFrameworkCore.ChangeTracking.EntityEntry>
Public Overridable Function Entries () As IEnumerable(Of EntityEntry)
Returns
An entry for each entity being tracked.
Remarks
Consider using the methods of Local for faster lookup of tracked entities by key, foreign key, or property value.
This method calls DetectChanges() to ensure all entries returned reflect up-to-date state. Since detecting changes can be slow, consider temporarily setting AutoDetectChangesEnabled to prevent detecting changes in situations where the state is known to be up-to-date.
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
Entries<TEntity>()
Gets an EntityEntry for all entities of a given type being tracked by the context. The entries provide access to change tracking information and operations for each entity.
public virtual System.Collections.Generic.IEnumerable<Microsoft.EntityFrameworkCore.ChangeTracking.EntityEntry<TEntity>> Entries<TEntity> () where TEntity : class;
abstract member Entries : unit -> seq<Microsoft.EntityFrameworkCore.ChangeTracking.EntityEntry<'Entity>> (requires 'Entity : null)
override this.Entries : unit -> seq<Microsoft.EntityFrameworkCore.ChangeTracking.EntityEntry<'Entity>> (requires 'Entity : null)
Public Overridable Function Entries(Of TEntity As Class) () As IEnumerable(Of EntityEntry(Of TEntity))
Type Parameters
- TEntity
The type of entities to get entries for.
Returns
An entry for each entity of the given type that is being tracked.
Remarks
Consider using the methods of Local for faster lookup of tracked entities by key, foreign key, or property value.
This method calls DetectChanges() to ensure all entries returned reflect up-to-date state. Since detecting changes can be slow, consider temporarily setting AutoDetectChangesEnabled to prevent detecting changes in situations where the state is known to be up-to-date.
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
Entity Framework