EntityEntry EntityEntry Class

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.

Syntax

Declaration

public class EntityEntry : IInfrastructure<InternalEntityEntry>Public Class EntityEntry
    Implements IInfrastructure(Of InternalEntityEntry)

Inheritance Hierarchy

  • System.Object
    System.Object
  • EntityEntry
    EntityEntry

Inherited Members

ToString(),
ToString(),
Equals(Object),
Equals(Object),
Equals(Object, Object),
Equals(Object, Object),
ReferenceEquals(Object, Object),
ReferenceEquals(Object, Object),
GetHashCode(),
GetHashCode(),
GetType(),
GetType(),
MemberwiseClone()
MemberwiseClone()

Constructors summary

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 summary

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

Gets the context that is tracking the entity.

Gets the current property values for this entity.

Gets the entity being tracked by this entry.

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.

Gets a value indicating if the key values of this entity have been assigned a value. False if one or more of the key properties is assigned null or the CLR default, otherwise true.

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

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

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

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.

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

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

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 summary

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

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.

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.

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

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

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

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

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.

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.

Explicit Interface Implementations summary

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.

Constructors

  • 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.

    public EntityEntry(InternalEntityEntry internalEntry)Public Sub New(internalEntry As InternalEntityEntry)

    Parameters

Properties

  • Collections
    Collections

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

    public virtual IEnumerable<CollectionEntry> Collections { get; }Public Overridable ReadOnly Property Collections As IEnumerable(Of CollectionEntry)

    Property Value

  • Context
    Context

    Gets the context that is tracking the entity.

    public virtual DbContext Context { get; }Public Overridable ReadOnly Property Context As DbContext

    Property Value

  • CurrentValues
    CurrentValues

    Gets the current property values for this entity.

    public virtual PropertyValues CurrentValues { get; }Public Overridable ReadOnly Property CurrentValues As PropertyValues

    Property Value

  • Entity
    Entity

    Gets the entity being tracked by this entry.

    public virtual object Entity { get; }Public Overridable ReadOnly Property Entity As Object

    Property Value

    • System.Object
      System.Object
  • 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.

    protected virtual InternalEntityEntry InternalEntry { get; }Protected Overridable ReadOnly Property InternalEntry As InternalEntityEntry

    Property Value

  • IsKeySet
    IsKeySet

    Gets a value indicating if the key values of this entity have been assigned a value. False if one or more of the key properties is assigned null or the CLR default, otherwise true.

    public virtual bool IsKeySet { get; }Public Overridable ReadOnly Property IsKeySet As Boolean

    Property Value

    • System.Boolean
      System.Boolean
  • Members
    Members

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

    public virtual IEnumerable<MemberEntry> Members { get; }Public Overridable ReadOnly Property Members As IEnumerable(Of MemberEntry)

    Property Value

    • System.Collections.Generic.IEnumerable<T><MemberEntry>
      System.Collections.Generic.IEnumerable<T>(Of MemberEntry)
  • Metadata
    Metadata

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

    public virtual IEntityType Metadata { get; }Public Overridable ReadOnly Property Metadata As IEntityType

    Property Value

  • Navigations
    Navigations

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

    public virtual IEnumerable<NavigationEntry> Navigations { get; }Public Overridable ReadOnly Property Navigations As IEnumerable(Of NavigationEntry)

    Property Value

  • 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.

    public virtual PropertyValues OriginalValues { get; }Public Overridable ReadOnly Property OriginalValues As PropertyValues

    Property Value

  • Properties
    Properties

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

    public virtual IEnumerable<PropertyEntry> Properties { get; }Public Overridable ReadOnly Property Properties As IEnumerable(Of PropertyEntry)

    Property Value

  • References
    References

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

    public virtual IEnumerable<ReferenceEntry> References { get; }Public Overridable ReadOnly Property References As IEnumerable(Of ReferenceEntry)

    Property Value

  • 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.

    public virtual EntityState State { get; set; }Public Overridable Property State As EntityState

    Property Value

Methods

  • 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.

    public virtual CollectionEntry Collection(string navigationPropertyName)Public Overridable Function Collection(navigationPropertyName As String) As CollectionEntry

    Parameters

    • navigationPropertyName
      System.String
      System.String

      The name of the navigation property.

    Returns

  • 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.

    public virtual PropertyValues GetDatabaseValues()Public Overridable Function GetDatabaseValues As PropertyValues

    Returns

  • 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.

    public virtual Task<PropertyValues> GetDatabaseValuesAsync(CancellationToken cancellationToken = null)Public Overridable Function GetDatabaseValuesAsync(cancellationToken As CancellationToken = Nothing) As Task(Of PropertyValues)

    Parameters

    • cancellationToken
      System.Threading.CancellationToken
      System.Threading.CancellationToken

      A System.Threading.CancellationToken to observe while waiting for the task to complete.

    Returns

    • System.Threading.Tasks.Task<TResult><PropertyValues>
      System.Threading.Tasks.Task<TResult>(Of PropertyValues)

      A task that represents the asynchronous operation. The task result contains the store values, or null if the entity does not exist in the database.

  • Member(String)
    Member(String)

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

    public virtual MemberEntry Member(string propertyName)Public Overridable Function Member(propertyName As String) As MemberEntry

    Parameters

    • propertyName
      System.String
      System.String

      The property to access information and operations for.

    Returns

    • An object that exposes change tracking information and operations for the given property.

  • Navigation(String)
    Navigation(String)

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

    public virtual NavigationEntry Navigation(string propertyName)Public Overridable Function Navigation(propertyName As String) As NavigationEntry

    Parameters

    • propertyName
      System.String
      System.String

      The property to access information and operations for.

    Returns

  • Property(String)
    Property(String)

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

    public virtual PropertyEntry Property(string propertyName)Public Overridable Function Property(propertyName As String) As PropertyEntry

    Parameters

    • propertyName
      System.String
      System.String

      The property to access information and operations for.

    Returns

  • 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.

    public virtual ReferenceEntry Reference(string navigationPropertyName)Public Overridable Function Reference(navigationPropertyName As String) As ReferenceEntry

    Parameters

    • navigationPropertyName
      System.String
      System.String

      The name of the navigation property.

    Returns

  • 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.

    public virtual void Reload()Public Overridable Sub Reload
  • 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.

    public virtual Task ReloadAsync(CancellationToken cancellationToken = null)Public Overridable Function ReloadAsync(cancellationToken As CancellationToken = Nothing) As Task

    Parameters

    • cancellationToken
      System.Threading.CancellationToken
      System.Threading.CancellationToken

      A System.Threading.CancellationToken to observe while waiting for the task to complete.

    Returns

    • System.Threading.Tasks.Task
      System.Threading.Tasks.Task

      A task that represents the asynchronous operation.

Explicit Interface Implementations

  • IInfrastructure<InternalEntityEntry>.Instance
    Microsoft.EntityFrameworkCore.Infrastructure.IInfrastructure<Microsoft.EntityFrameworkCore.ChangeTracking.Internal.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.

    InternalEntityEntry IInfrastructure<InternalEntityEntry>.Instance { get; }ReadOnly WriteOnly Property Microsoft.EntityFrameworkCore.Infrastructure.IInfrastructure<Microsoft.EntityFrameworkCore.ChangeTracking.Internal.InternalEntityEntry>.Instance As InternalEntityEntry Implements IInfrastructure(Of InternalEntityEntry).Instance

    Returns

Details

Assembly

Microsoft.EntityFrameworkCore.dll