Table of Contents

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

TIn
TOut
Inheritance
DynamicBivariantReference<TIn, TOut>
Implements
ILazy<TOut>
Inherited Members

Constructors

DynamicBivariantReference(EntityReferenceProperty<TIn>)

public DynamicBivariantReference(EntityReferenceProperty<TIn> property)

Parameters

property EntityReferenceProperty<TIn>

Properties

HasValue

Whether the foreign key is set. Distinct from IsPresent; never performs I/O.

public bool HasValue { get; }

Property Value

bool

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

options RequestOptions
includes RelationshipPath[]
cancellationToken CancellationToken?

Returns

Task<TOut>

Set(TOut?)

Sets the referenced identity by value.

public void Set(TOut? value)

Parameters

value TOut

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

string

Events

ValueChanged

Raised when the reference is changed to point at a different entity.

public event EventHandler? ValueChanged

Event Type

EventHandler