EntityEntry<TEntity> EntityEntry(Of TEntity) 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.

public class EntityEntry<TEntity> : EntityEntry, IInfrastructure<InternalEntityEntry> where TEntity : class
Public Class EntityEntry(Of TEntity As Class)
    Inherits EntityEntry
    Implements IInfrastructure(Of InternalEntityEntry)
Type Parameters
TEntity

The type of entity being tracked by this entry.

Inheritance
System.ObjectSystem.Object
EntityEntry<TEntity>EntityEntry(Of TEntity)
Implements

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.

(Inherited from EntityEntry)

Context Context

Gets the context that is tracking the entity.

(Inherited from EntityEntry)

CurrentValues CurrentValues

Gets the current property values for this entity.

(Inherited from EntityEntry)

Entity Entity

Gets the entity being tracked by this entry.

public virtual TEntity Entity { get; }
Public Overridable ReadOnly Property Entity As TEntity
Value
TEntity TEntity

IInfrastructure.Instance Microsoft.EntityFrameworkCore.Infrastructure.IInfrastructure.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.

(Inherited from EntityEntry)

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.

(Inherited from EntityEntry)

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.

(Inherited from EntityEntry)

Members Members

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

(Inherited from EntityEntry)

Metadata Metadata

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

(Inherited from EntityEntry)

Navigations Navigations

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

(Inherited from EntityEntry)

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.

(Inherited from EntityEntry)

Properties Properties

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

(Inherited from EntityEntry)

References References

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

(Inherited from EntityEntry)

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.

(Inherited from EntityEntry)

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.

(Inherited from EntityEntry)

Collection(Expression<>>>) Collection(Of TProperty)(Expression(Of Func(Of TEntity, IEnumerable(Of TProperty))))

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<TEntity, TProperty> Collection<TProperty>(Expression<Func<TEntity, IEnumerable<TProperty>>> propertyExpression)where TProperty : class
Public Overridable Function Collection(Of TProperty As Class)(propertyExpression As Expression(Of Func(Of TEntity, IEnumerable(Of TProperty)))) As CollectionEntry(Of TEntity, TProperty)
Type Parameters
TProperty
Parameters
propertyExpression
System.Linq.Expressions.Expression<System.Func<TEntity, System.Collections.Generic.IEnumerable<TProperty>>> System.Linq.Expressions.Expression(Of System.Func(Of TEntity, System.Collections.Generic.IEnumerable(Of TProperty)))

A lambda expression representing the property to access information and operations for (t => t.Property1).

Returns
CollectionEntry<TEntity, TProperty> CollectionEntry(Of TEntity, TProperty)

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

Collection(String) Collection(Of TProperty)(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<TEntity, TProperty> Collection<TProperty>(string navigationPropertyName)where TProperty : class
Public Overridable Function Collection(Of TProperty As Class)(navigationPropertyName As String) As CollectionEntry(Of TEntity, TProperty)
Type Parameters
TProperty
Parameters
navigationPropertyName
System.String System.String

The name of the navigation property.

Returns
CollectionEntry<TEntity, TProperty> CollectionEntry(Of TEntity, TProperty)

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

Equals(Object) Equals(Object)

Inherited from System.Object

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

Inherited from System.Object

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.

(Inherited from EntityEntry)

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.

(Inherited from EntityEntry)

GetHashCode() GetHashCode()

Inherited from System.Object

GetType() GetType()

Inherited from System.Object

Member(String) Member(String)

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

(Inherited from EntityEntry)

MemberwiseClone() MemberwiseClone()

Inherited from System.Object

Navigation(String) Navigation(String)

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

(Inherited from EntityEntry)

Property(String) Property(String)

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

(Inherited from EntityEntry)

Property(Expression<>>) Property(Of TProperty)(Expression(Of Func(Of TEntity, TProperty)))

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

public virtual PropertyEntry<TEntity, TProperty> Property<TProperty>(Expression<Func<TEntity, TProperty>> propertyExpression)
Public Overridable Function Property(Of TProperty)(propertyExpression As Expression(Of Func(Of TEntity, TProperty))) As PropertyEntry(Of TEntity, TProperty)
Type Parameters
TProperty
Parameters
propertyExpression
System.Linq.Expressions.Expression<System.Func<TEntity, TProperty>> System.Linq.Expressions.Expression(Of System.Func(Of TEntity, TProperty))

A lambda expression representing the property to access information and operations for (t => t.Property1).

Returns
PropertyEntry<TEntity, TProperty> PropertyEntry(Of TEntity, TProperty)

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

Property(String) Property(Of TProperty)(String)

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

public virtual PropertyEntry<TEntity, TProperty> Property<TProperty>(string propertyName)
Public Overridable Function Property(Of TProperty)(propertyName As String) As PropertyEntry(Of TEntity, TProperty)
Type Parameters
TProperty

The type of the property.

Parameters
propertyName
System.String System.String

The property to access information and operations for.

Returns
PropertyEntry<TEntity, TProperty> PropertyEntry(Of TEntity, TProperty)

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

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.

(Inherited from EntityEntry)

Reference(Expression<>>) Reference(Of TProperty)(Expression(Of Func(Of TEntity, TProperty)))

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<TEntity, TProperty> Reference<TProperty>(Expression<Func<TEntity, TProperty>> propertyExpression)where TProperty : class
Public Overridable Function Reference(Of TProperty As Class)(propertyExpression As Expression(Of Func(Of TEntity, TProperty))) As ReferenceEntry(Of TEntity, TProperty)
Type Parameters
TProperty
Parameters
propertyExpression
System.Linq.Expressions.Expression<System.Func<TEntity, TProperty>> System.Linq.Expressions.Expression(Of System.Func(Of TEntity, TProperty))

A lambda expression representing the property to access information and operations for (t => t.Property1).

Returns
ReferenceEntry<TEntity, TProperty> ReferenceEntry(Of TEntity, TProperty)

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

Reference(String) Reference(Of TProperty)(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<TEntity, TProperty> Reference<TProperty>(string navigationPropertyName)where TProperty : class
Public Overridable Function Reference(Of TProperty As Class)(navigationPropertyName As String) As ReferenceEntry(Of TEntity, TProperty)
Type Parameters
TProperty
Parameters
navigationPropertyName
System.String System.String

The name of the navigation property.

Returns
ReferenceEntry<TEntity, TProperty> ReferenceEntry(Of TEntity, TProperty)

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

ReferenceEquals(Object, Object) ReferenceEquals(Object, Object)

Inherited from System.Object

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.

(Inherited from EntityEntry)

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.

(Inherited from EntityEntry)

ToString() ToString()

Inherited from System.Object