Table of Contents

Class EntityReferenceProperty<T>

Namespace
The.Relationships
Assembly
Instagile.dll

One-to-one foreign key

public sealed class EntityReferenceProperty<T> : EntityReferenceProperty, ILazy, IOwnedValue<IEntity?>, IValue<IEntity?>, IOwnedValue<T?>, IValue<T?>, INotifyValueChanged, IProperty, IOwned, IHasChanges where T : IEntity<T>

Type Parameters

T
Inheritance
EntityReferenceProperty<T>
Implements
Inherited Members

Constructors

EntityReferenceProperty(RelationshipInfo, EntityKernel)

public EntityReferenceProperty(RelationshipInfo metadata, EntityKernel parent)

Parameters

metadata RelationshipInfo
parent EntityKernel

Properties

HasValue

Gets a value indicating whether the reference has a non-null value. Does not require or force the property to be present.

public override bool HasValue { get; }

Property Value

bool

OriginalValue

public T? OriginalValue { get; }

Property Value

T

Value

read/write underlying data

public T? Value { get; set; }

Property Value

T

Methods

AsLoaded()

public T? AsLoaded()

Returns

T

AsUnloaded()

public IEntityQuery<T>? AsUnloaded()

Returns

IEntityQuery<T>

Clone(IEntityContext?)

public EntityReferenceProperty<T> Clone(IEntityContext? context = null)

Parameters

context IEntityContext

Returns

EntityReferenceProperty<T>

Get()

public T? Get()

Returns

T

GetAsync(CancellationToken)

public Task<T?> GetAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

Returns

Task<T>

GetCachedAsync(RequestOptions?, CancellationToken)

Asynchronously loads the referenced entity using the query cache. Returns immediately with stale data if available, with background refresh for stale entries.

public Task<T?> GetCachedAsync(RequestOptions? options = null, CancellationToken cancellationToken = default)

Parameters

options RequestOptions

Cache request options controlling freshness requirements and priority.

cancellationToken CancellationToken

Cancellation token for the operation.

Returns

Task<T>

The referenced entity, or null if the reference has no value.

GetRelatedEntityCachedAsync(Guid, RequestOptions, CancellationToken?)

protected override Task<IEntity?> GetRelatedEntityCachedAsync(Guid id, RequestOptions options, CancellationToken? cancellationToken)

Parameters

id Guid
options RequestOptions
cancellationToken CancellationToken?

Returns

Task<IEntity>