Interface IUpdateAdapter
- Namespace
- Microsoft.EntityFrameworkCore.Update
- Assembly
- Microsoft.EntityFrameworkCore.dll
Providers tracking capabilities for seed data stored in the model using HasData(params object[]).
This interface is typically used by database providers (and other extensions). It is generally not used in application code.
public interface IUpdateAdapter
Remarks
See Implementation of database providers and extensions for more information and examples.
Properties
CascadeDeleteTiming
Gets or sets a value indicating when a dependent/child entity will have its state set to Deleted once its parent/principal entity has been marked as Deleted. The default value isImmediate.
CascadeTiming CascadeDeleteTiming { get; set; }
Property Value
Remarks
Dependent/child entities are only deleted automatically when the relationship is configured with Microsoft.EntityFrameworkCore.DeleteBehavior.Cascade. This is set by default for required relationships.
DeleteOrphansTiming
Gets or sets a value indicating when a dependent/child entity will have its state set to Deleted once severed from a parent/principal entity through either a navigation or foreign key property being set to null. The default value is Immediate.
CascadeTiming DeleteOrphansTiming { get; set; }
Property Value
Remarks
Dependent/child entities are only deleted automatically when the relationship is configured with Microsoft.EntityFrameworkCore.DeleteBehavior.Cascade. This is set by default for required relationships.
Entries
All the entries currently being tracked.
IEnumerable<IUpdateEntry> Entries { get; }
Property Value
Model
The model with which the data is associated.
IModel Model { get; }
Property Value
Methods
CascadeChanges()
Forces immediate cascading deletion of child/dependent entities when they are either severed from a required parent/principal entity, or the required parent/principal entity is itself deleted. See Microsoft.EntityFrameworkCore.DeleteBehavior.
void CascadeChanges()
Remarks
This method is usually used when CascadeDeleteTiming and/or DeleteOrphansTiming have been set to Never to manually force the deletes to have at a time controlled by the application.
If AutoDetectChangesEnabled is null then this method will call DetectChanges().
CascadeDelete(IUpdateEntry, IEnumerable<IForeignKey>?)
Forces immediate cascading deletion of child/dependent entities when they are either severed from a required parent/principal entity, or the required parent/principal entity is itself deleted. See Microsoft.EntityFrameworkCore.DeleteBehavior.
void CascadeDelete(IUpdateEntry entry, IEnumerable<IForeignKey>? foreignKeys = null)
Parameters
entry
IUpdateEntryThe entry.
foreignKeys
IEnumerable<IForeignKey>The foreign keys to consider when cascading.
CreateEntry(IDictionary<string, object?>, IEntityType)
Creates a new entry with the given property values for the given entity type.
IUpdateEntry CreateEntry(IDictionary<string, object?> values, IEntityType entityType)
Parameters
values
IDictionary<string, object>A dictionary of property names to values.
entityType
IEntityTypeThe entity type.
Returns
- IUpdateEntry
The created entry.
DetectChanges()
Causes the underlying tracker to detect changes made to the tracked entities.
void DetectChanges()
FindPrincipal(IUpdateEntry, IForeignKey)
Gets the principal entry for the given dependent entry and foreign key.
IUpdateEntry? FindPrincipal(IUpdateEntry dependentEntry, IForeignKey foreignKey)
Parameters
dependentEntry
IUpdateEntryThe dependent entry.
foreignKey
IForeignKeyThe foreign key that defines the relationship.
Returns
- IUpdateEntry
The principal, or null if none was found.
GetDependents(IUpdateEntry, IForeignKey)
Returns the dependents associated with the given principal and foreign key.
IEnumerable<IUpdateEntry> GetDependents(IUpdateEntry principalEntry, IForeignKey foreignKey)
Parameters
principalEntry
IUpdateEntryThe principal entry.
foreignKey
IForeignKeyThe foreign key that defines the relationship.
Returns
- IEnumerable<IUpdateEntry>
The dependents.
GetEntriesToSave()
Gets all the entries that require inserts/updates/deletes in the database.
IList<IUpdateEntry> GetEntriesToSave()
Returns
- IList<IUpdateEntry>
The entries that need to be saved.
TryGetEntry(IKey, object?[])
Finds the tracked entity for the given key values.
IUpdateEntry? TryGetEntry(IKey key, object?[] keyValues)
Parameters
Returns
- IUpdateEntry
The entry for the found entity, or null if no entity with these key values is being tracked.