ChangeTracker.GetEntriesForState 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
| Name | Description |
|---|---|
| GetEntriesForState(Boolean, Boolean, Boolean, Boolean) |
Gets an EntityEntry for each entity being tracked by the context that has the given state(s). The entries provide access to change tracking information and operations for each entity. |
| GetEntriesForState<TEntity>(Boolean, Boolean, Boolean, Boolean) |
Gets an EntityEntry<TEntity> for each entity of a given type being tracked by the context that has the given state(s). The entries provide access to change tracking information and operations for each entity. |
GetEntriesForState(Boolean, Boolean, Boolean, Boolean)
- Source:
- ChangeTracker.cs
Gets an EntityEntry for each entity being tracked by the context that has the given state(s). The entries provide access to change tracking information and operations for each entity.
public virtual System.Collections.Generic.IEnumerable<Microsoft.EntityFrameworkCore.ChangeTracking.EntityEntry> GetEntriesForState(bool added = false, bool modified = false, bool deleted = false, bool unchanged = false);
abstract member GetEntriesForState : bool * bool * bool * bool -> seq<Microsoft.EntityFrameworkCore.ChangeTracking.EntityEntry>
override this.GetEntriesForState : bool * bool * bool * bool -> seq<Microsoft.EntityFrameworkCore.ChangeTracking.EntityEntry>
Public Overridable Function GetEntriesForState (Optional added As Boolean = false, Optional modified As Boolean = false, Optional deleted As Boolean = false, Optional unchanged As Boolean = false) As IEnumerable(Of EntityEntry)
Parameters
Returns
An entry for each entity that has the given state(s).
Remarks
This method does not call DetectChanges() and returns entries based on the current state of the change tracker. This makes it suitable for use in high-performance scenarios or in contexts that track many entities, where calling DetectChanges() may be expensive.
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
GetEntriesForState<TEntity>(Boolean, Boolean, Boolean, Boolean)
- Source:
- ChangeTracker.cs
Gets an EntityEntry<TEntity> for each entity of a given type being tracked by the context that has the given state(s). The entries provide access to change tracking information and operations for each entity.
public virtual System.Collections.Generic.IEnumerable<Microsoft.EntityFrameworkCore.ChangeTracking.EntityEntry<TEntity>> GetEntriesForState<TEntity>(bool added = false, bool modified = false, bool deleted = false, bool unchanged = false) where TEntity : class;
abstract member GetEntriesForState : bool * bool * bool * bool -> seq<Microsoft.EntityFrameworkCore.ChangeTracking.EntityEntry<'Entity>> (requires 'Entity : null)
override this.GetEntriesForState : bool * bool * bool * bool -> seq<Microsoft.EntityFrameworkCore.ChangeTracking.EntityEntry<'Entity>> (requires 'Entity : null)
Public Overridable Function GetEntriesForState(Of TEntity As Class) (Optional added As Boolean = false, Optional modified As Boolean = false, Optional deleted As Boolean = false, Optional unchanged As Boolean = false) As IEnumerable(Of EntityEntry(Of TEntity))
Type Parameters
- TEntity
The type of entities to get entries for.
Parameters
Returns
An entry for each entity of the given type that has the given state(s).
Remarks
This method does not call DetectChanges() and returns entries based on the current state of the change tracker. This makes it suitable for use in high-performance scenarios or in contexts that track many entities, where calling DetectChanges() may be expensive.
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.