Interface IEntityEntryGraphIterator
- Namespace
- Microsoft.EntityFrameworkCore.ChangeTracking
- Assembly
- Microsoft.EntityFrameworkCore.dll
A service to traverse a graph of entities and perform some action on at each node.
public interface IEntityEntryGraphIterator
Remarks
The service lifetime is Singleton. This means a single instance is used by many DbContext instances. The implementation must be thread-safe. This service cannot depend on services registered as Scoped.
See Tracking entities in EF Core for more information and examples.
Methods
TraverseGraphAsync<TState>(EntityEntryGraphNode<TState>, Func<EntityEntryGraphNode<TState>, CancellationToken, Task<bool>>, CancellationToken)
Traverses a graph of entities allowing an action to be taken at each node.
Task TraverseGraphAsync<TState>(EntityEntryGraphNode<TState> node, Func<EntityEntryGraphNode<TState>, CancellationToken, Task<bool>> handleNode, CancellationToken cancellationToken = default)
Parameters
node
EntityEntryGraphNode<TState>The node that is being visited.
handleNode
Func<EntityEntryGraphNode<TState>, CancellationToken, Task<bool>>A delegate to call to handle the node.
cancellationToken
CancellationTokenA CancellationToken to observe while waiting for the task to complete.
Returns
- Task
A task that represents the asynchronous operation.
Type Parameters
TState
The type of the state object.
Exceptions
- OperationCanceledException
If the CancellationToken is canceled.
TraverseGraph<TState>(EntityEntryGraphNode<TState>, Func<EntityEntryGraphNode<TState>, bool>)
Traverses a graph of entities allowing an action to be taken at each node.
void TraverseGraph<TState>(EntityEntryGraphNode<TState> node, Func<EntityEntryGraphNode<TState>, bool> handleNode)
Parameters
node
EntityEntryGraphNode<TState>The node that is being visited.
handleNode
Func<EntityEntryGraphNode<TState>, bool>A delegate to call to handle the node.
Type Parameters
TState
The type of the state object.