Class DynamicBivariantReference<TIn, TOut>
- Namespace
- The.Components
- Assembly
- Instagile.dll
public sealed class DynamicBivariantReference<TIn, TOut> : EntityPathBase<TOut>, IEntityReference<TOut>, IEntityPath<TOut>, IEntityPath, ILazy<TOut?>, ILazy where TIn : class, TOut, IEntity<TIn> where TOut : IEntity
Type Parameters
TInTOut
- Inheritance
-
EntityPathBase<TOut>DynamicBivariantReference<TIn, TOut>
- Implements
-
IEntityReference<TOut>IEntityPath<TOut>ILazy<TOut>
- Inherited Members
Constructors
DynamicBivariantReference(EntityReferenceProperty<TIn>)
public DynamicBivariantReference(EntityReferenceProperty<TIn> property)
Parameters
propertyEntityReferenceProperty<TIn>
Properties
HasValue
Whether the foreign key is set. Distinct from IsPresent; never performs I/O.
public bool HasValue { get; }
Property Value
ID
Gets or sets the referenced entity by ID, without loading anything.
public Guid? ID { get; set; }
Property Value
- Guid?
Methods
AsLoaded()
Asserts that the path is loaded and returns the entity at its end (or null when a reference along the path is genuinely null); never performs I/O. This also backs the generated explicit conversion operators and query-only members, which exist for use in expression trees or to be executed by query providers against prefetched data.
public override TOut? AsLoaded()
Returns
- TOut
Exceptions
- InvalidOperationException
Thrown if any reference along the path is unloaded, naming the first that is.
- InvalidOperationException
Thrown if the target is unloaded, naming the relationship and foreign key.
LoadCachedAsync(RequestOptions?, RelationshipPath[], CancellationToken?)
Paths through more than one reference do not use the entity cache; references override this to use it.
public override Task<TOut?> LoadCachedAsync(RequestOptions? options, RelationshipPath[] includes, CancellationToken? cancellationToken = null)
Parameters
optionsRequestOptionsincludesRelationshipPath[]cancellationTokenCancellationToken?
Returns
- Task<TOut>
Set(TOut?)
Sets the referenced identity by value.
public void Set(TOut? value)
Parameters
valueTOut
Remarks
Assignment is usually done by conversion (foo.Ref = bar); Set is implemented explicitly for internal consumers that don't have concrete entity types available.
ToString()
The relationship and foreign key ("3: Foo.Bar: {ID}", or "null" for no target), whether or not the target is loaded; never the target's own text.
public override string ToString()
Returns
Events
ValueChanged
Raised when the reference is changed to point at a different entity.
public event EventHandler? ValueChanged