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
-
IOwnedValue<T>IValue<T>
- Inherited Members
Constructors
EntityReferenceProperty(RelationshipInfo, EntityKernel)
public EntityReferenceProperty(RelationshipInfo metadata, EntityKernel parent)
Parameters
metadataRelationshipInfoparentEntityKernel
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
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
contextIEntityContext
Returns
Get()
public T? Get()
Returns
- T
GetAsync(CancellationToken)
public Task<T?> GetAsync(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationToken
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
optionsRequestOptionsCache request options controlling freshness requirements and priority.
cancellationTokenCancellationTokenCancellation 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
idGuidoptionsRequestOptionscancellationTokenCancellationToken?