Table of Contents

Interface IUpdateEntry

Namespace
Microsoft.EntityFrameworkCore.Update
Assembly
Microsoft.EntityFrameworkCore.dll

The information passed to a database provider to save changes to an entity to the database.

This interface is typically used by database providers (and other extensions). It is generally not used in application code.

public interface IUpdateEntry
Extension Methods

Remarks

See Implementation of database providers and extensions for more information and examples.

Properties

Context

The current DbContext being used.

DbContext Context { get; }

Property Value

DbContext

EntityState

The state of the entity to be saved.

EntityState EntityState { get; set; }

Property Value

EntityState

EntityType

The type of entity to be saved to the database.

IEntityType EntityType { get; }

Property Value

IEntityType

SharedIdentityEntry

The other entry that has the same key values, if one exists.

IUpdateEntry? SharedIdentityEntry { get; }

Property Value

IUpdateEntry

Methods

GetCurrentValue(IPropertyBase)

Gets the value assigned to the property.

object? GetCurrentValue(IPropertyBase propertyBase)

Parameters

propertyBase IPropertyBase

The property to get the value for.

Returns

object

The value for the property.

GetCurrentValue<TProperty>(IPropertyBase)

Gets the value assigned to the property.

TProperty GetCurrentValue<TProperty>(IPropertyBase propertyBase)

Parameters

propertyBase IPropertyBase

The property to get the value for.

Returns

TProperty

The value for the property.

Type Parameters

TProperty

The type of the property.

GetOriginalValue(IPropertyBase)

Gets the value assigned to the property when it was retrieved from the database.

object? GetOriginalValue(IPropertyBase propertyBase)

Parameters

propertyBase IPropertyBase

The property to get the value for.

Returns

object

The value for the property.

GetOriginalValue<TProperty>(IProperty)

Gets the value assigned to the property when it was retrieved from the database.

TProperty GetOriginalValue<TProperty>(IProperty property)

Parameters

property IProperty

The property to get the value for.

Returns

TProperty

The value for the property.

Type Parameters

TProperty

The type of the property.

GetPreStoreGeneratedCurrentValue(IPropertyBase)

Gets the value assigned to the property before any store-generated values have been applied.

object? GetPreStoreGeneratedCurrentValue(IPropertyBase propertyBase)

Parameters

propertyBase IPropertyBase

The property to get the value for.

Returns

object

The value for the property.

GetRelationshipSnapshotValue(IPropertyBase)

Gets the last value assigned to the property that's part of a foreign key or principal key

object? GetRelationshipSnapshotValue(IPropertyBase propertyBase)

Parameters

propertyBase IPropertyBase

The property to get the value for.

Returns

object

The value for the property.

HasTemporaryValue(IProperty)

Gets a value indicating if the specified property has a temporary value.

bool HasTemporaryValue(IProperty property)

Parameters

property IProperty

The property to be checked.

Returns

bool

true if the property has a temporary value, otherwise false.

IsConceptualNull(IProperty)

Checks whether the property is conceptually set to null even if the property type is not nullable.

bool IsConceptualNull(IProperty property)

Parameters

property IProperty

The property to check.

Returns

bool

true if the property is conceptually null; false otherwise.

IsModified(IProperty)

Gets a value indicating if the specified property is modified. If true, the current value assigned to the property should be saved to the database.

bool IsModified(IProperty property)

Parameters

property IProperty

The property to be checked.

Returns

bool

true if the property is modified, otherwise false.

IsStoreGenerated(IProperty)

Gets a value indicating if the specified property should have a value generated by the database.

bool IsStoreGenerated(IProperty property)

Parameters

property IProperty

The property to be checked.

Returns

bool

true if the property should have a value generated by the database, otherwise false.

SetOriginalValue(IProperty, object?)

Sets the original value of the given property.

void SetOriginalValue(IProperty property, object? value)

Parameters

property IProperty

The property to set.

value object

The value to set.

SetPropertyModified(IProperty)

Marks the given property as modified.

void SetPropertyModified(IProperty property)

Parameters

property IProperty

The property to mark as modified.

SetStoreGeneratedValue(IProperty, object?, bool)

Assign a store-generated value to the property.

void SetStoreGeneratedValue(IProperty property, object? value, bool setModified = true)

Parameters

property IProperty

The property to set the value for.

value object

The value to set.

setModified bool

Whether to set the store-generated property's state to Modified.

ToEntityEntry()

Gets an EntityEntry for the entity being saved. EntityEntry is an API optimized for application developers and IUpdateEntry is optimized for database providers, but there may be instances where a database provider wants to access information from EntityEntry.

EntityEntry ToEntityEntry()

Returns

EntityEntry

An EntityEntry for this entity.