Class ReferenceEntry<TEntity, TProperty>
- Namespace
- Microsoft.EntityFrameworkCore.ChangeTracking
- Assembly
- Microsoft.EntityFrameworkCore.dll
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 class ReferenceEntry<TEntity, TProperty> : ReferenceEntry, IInfrastructure<InternalEntityEntry> where TEntity : class where TProperty : class
Type Parameters
TEntity
The type of the entity the property belongs to.
TProperty
The type of the property.
- Inheritance
-
ReferenceEntry<TEntity, TProperty>
- Implements
- Inherited Members
- Extension Methods
Remarks
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.
See Accessing tracked entities in EF Core and Loading related entities for more information and examples.
Constructors
ReferenceEntry(InternalEntityEntry, INavigation)
This is an internal API that supports the Entity Framework Core infrastructure and not subject to the same compatibility standards as public APIs. It may be changed or removed without notice in any release. You should only use it directly in your code with extreme caution and knowing that doing so can result in application failures when updating to a new Entity Framework Core release.
[EntityFrameworkInternal]
public ReferenceEntry(InternalEntityEntry internalEntry, INavigation navigation)
Parameters
internalEntry
InternalEntityEntrynavigation
INavigation
ReferenceEntry(InternalEntityEntry, string)
This is an internal API that supports the Entity Framework Core infrastructure and not subject to the same compatibility standards as public APIs. It may be changed or removed without notice in any release. You should only use it directly in your code with extreme caution and knowing that doing so can result in application failures when updating to a new Entity Framework Core release.
[EntityFrameworkInternal]
public ReferenceEntry(InternalEntityEntry internalEntry, string name)
Parameters
internalEntry
InternalEntityEntryname
string
Properties
CurrentValue
Gets or sets the value currently assigned to this property. If the current value is set using this property, the change tracker is aware of the change and DetectChanges() is not required for the context to detect the change.
public virtual TProperty? CurrentValue { get; set; }
Property Value
- TProperty
Remarks
See Accessing tracked entities in EF Core and Changing foreign keys and navigations for more information and examples.
EntityEntry
The EntityEntry<TEntity> to which this member belongs.
public virtual EntityEntry<TEntity> EntityEntry { get; }
Property Value
- EntityEntry<TEntity>
An entry for the entity that owns this member.
Remarks
See Accessing tracked entities in EF Core for more information and examples.
TargetEntry
The EntityEntry<TEntity> of the entity this navigation targets.
public virtual EntityEntry<TProperty>? TargetEntry { get; }
Property Value
- EntityEntry<TProperty>
An entry for the entity that owns this navigation targets.
Remarks
See Accessing tracked entities in EF Core for more information and examples.
Methods
Query()
Returns the query that would be used by Load() to load the entity referenced by this navigation property.
public virtual IQueryable<TProperty> Query()
Returns
- IQueryable<TProperty>
Remarks
The query can be composed over using LINQ to perform filtering, counting, etc. without actually loading the entity from the database.
See Accessing tracked entities in EF Core and Loading related entities for more information and examples.