EntityEntry EntityEntry EntityEntry Class

Definition

Provides access to change tracking information and operations for a given entity.

Instances of this class are returned from methods when using the ChangeTracker API and it is not designed to be directly constructed in your application code.

[System.Diagnostics.DebuggerDisplay("{InternalEntry,nq}")]
[System.Diagnostics.DebuggerDisplay("{_internalEntityEntry,nq}")]
public class EntityEntry : Microsoft.EntityFrameworkCore.Infrastructure.IInfrastructure<Microsoft.EntityFrameworkCore.ChangeTracking.Internal.InternalEntityEntry>
type EntityEntry = class
    interface IInfrastructure<InternalEntityEntry>
Public Class EntityEntry
Implements IInfrastructure(Of InternalEntityEntry)
Inheritance
EntityEntryEntityEntryEntityEntry
Derived
Attributes
Implements

Constructors

EntityEntry(InternalEntityEntry) EntityEntry(InternalEntityEntry) EntityEntry(InternalEntityEntry)

This API supports the Entity Framework Core infrastructure and is not intended to be used directly from your code. This API may change or be removed in future releases.

Properties

Collections Collections Collections

Provides access to change tracking information and loading information for all collection navigation properties of this entity.

Context Context Context

Gets the context that is tracking the entity.

CurrentValues CurrentValues CurrentValues

Gets the current property values for this entity.

Entity Entity Entity

Gets the entity being tracked by this entry.

InternalEntry InternalEntry InternalEntry

This API supports the Entity Framework Core infrastructure and is not intended to be used directly from your code. This API may change or be removed in future releases.

IsKeySet IsKeySet IsKeySet

Gets a value indicating if the key values of this entity have been assigned a value.

For keys with store-generated properties (e.g. mapping to Identity columns), the return value will be false if any of the store-generated properties have the CLR default value.

For keys without any store-generated properties, the return value will always be true since any value is considered a valid key value.

Members Members Members

Provides access to change tracking information and operations for all properties and navigation properties of this entity.

Metadata Metadata Metadata

Gets the metadata about the shape of the entity, its relationships to other entities, and how it maps to the database.

Navigations Navigations Navigations

Provides access to change tracking information and operations for all navigation properties of this entity.

OriginalValues OriginalValues OriginalValues

Gets the original property values for this entity. The original values are the property values as they were when the entity was retrieved from the database.

Properties Properties Properties

Provides access to change tracking information and operations for all properties of this entity.

References References References

Provides access to change tracking information and loading information for all reference (i.e. non-collection) navigation properties of this entity.

State State State

Gets or sets that state that this entity is being tracked in.

When setting the state, the entity will always end up in the specified state. For example, if you change the state to Deleted the entity will be marked for deletion regardless of its current state. This is different than calling Remove(TEntity) where the entity will be disconnected (rather than marked for deletion) if it is in the Added state.

Methods

Collection(String) Collection(String) Collection(String)

Provides access to change tracking and loading information for a collection navigation property that associates this entity to a collection of another entities.

Equals(Object) Equals(Object) Equals(Object)

Determines whether the specified object is equal to the current object.

GetDatabaseValues() GetDatabaseValues() GetDatabaseValues()

Queries the database for copies of the values of the tracked entity as they currently exist in the database. If the entity is not found in the database, then null is returned.

Note that changing the values in the returned dictionary will not update the values in the database.

GetDatabaseValuesAsync(CancellationToken) GetDatabaseValuesAsync(CancellationToken) GetDatabaseValuesAsync(CancellationToken)

Queries the database for copies of the values of the tracked entity as they currently exist in the database. If the entity is not found in the database, then null is returned.

Note that changing the values in the returned dictionary will not update the values in the database.

Multiple active operations on the same context instance are not supported. Use 'await' to ensure that any asynchronous operations have completed before calling another method on this context.

GetHashCode() GetHashCode() GetHashCode()

Serves as the default hash function.

Member(String) Member(String) Member(String)

Provides access to change tracking information and operations for a given property or navigation property of this entity.

Navigation(String) Navigation(String) Navigation(String)

Provides access to change tracking information and operations for a given navigation property of this entity.

Property(String) Property(String) Property(String)

Provides access to change tracking information and operations for a given property of this entity.

Reference(String) Reference(String) Reference(String)

Provides access to change tracking and loading information for a reference (i.e. non-collection) navigation property that associates this entity to another entity.

Reload() Reload() Reload()

Reloads the entity from the database overwriting any property values with values from the database.

The entity will be in the Unchanged state after calling this method, unless the entity does not exist in the database, in which case the entity will be Detached. Finally, calling Reload on an Added entity that does not exist in the database is a no-op. Note, however, that an Added entity may not yet have had its permanent key value created.

ReloadAsync(CancellationToken) ReloadAsync(CancellationToken) ReloadAsync(CancellationToken)

Reloads the entity from the database overwriting any property values with values from the database.

The entity will be in the Unchanged state after calling this method, unless the entity does not exist in the database, in which case the entity will be Detached. Finally, calling Reload on an Added entity that does not exist in the database is a no-op. Note, however, that an Added entity may not yet have had its permanent key value created.

ToString() ToString() ToString()

Returns a string that represents the current object.

Explicit Interface Implementations

IInfrastructure<InternalEntityEntry>.Instance IInfrastructure<InternalEntityEntry>.Instance IInfrastructure<InternalEntityEntry>.Instance

This API supports the Entity Framework Core infrastructure and is not intended to be used directly from your code. This API may change or be removed in future releases.

Extension Methods

GetInfrastructure<T>(IInfrastructure<T>) GetInfrastructure<T>(IInfrastructure<T>) GetInfrastructure<T>(IInfrastructure<T>)

Gets the value from a property that is being hidden using IInfrastructure<T>.

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

IInfrastructure<T> is used to hide properties that are not intended to be used in application code but can be used in extension methods written by database providers etc.

Applies to