Table of Contents

Class EntityPathBase<T>

Namespace
The.Relationships
Assembly
Instagile.dll

Base class for generated entity path types. Derived classes add per-entity members.

public abstract class EntityPathBase<T> : IEntityPath<T>, IEntityPath, ILazy<T?>, ILazy where T : IEntity

Type Parameters

T
Inheritance
EntityPathBase<T>
Implements
Derived
Inherited Members

Constructors

EntityPathBase(IEntity?, RelationshipPath)

Base class for generated entity path types. Derived classes add per-entity members.

protected EntityPathBase(IEntity? root, RelationshipPath path)

Parameters

root IEntity
path RelationshipPath

Properties

IsPresent

Whether every reference along the path is loaded, or one of them is null. Never performs I/O.

public bool IsPresent { get; }

Property Value

bool

Kernel

Usable only inside query expressions: the target's core attributes (Kernel.active, Kernel.createdOn, …), as on the entity.

public PathKernel Kernel { get; }

Property Value

PathKernel

Path

The relationship path this navigation represents.

public RelationshipPath Path { get; }

Property Value

RelationshipPath

QueryRoot

The root for query composition. A null detached reference has no context to compose queries in.

protected IEntity QueryRoot { get; }

Property Value

IEntity

Root

The entity the path starts from. Null for a detached null reference: a path from nothing is null.

protected IEntity? Root { get; }

Property Value

IEntity

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 virtual T? AsLoaded()

Returns

T

Exceptions

InvalidOperationException

Thrown if any reference along the path is unloaded, naming the first that is.

AsUnloaded()

Asserts that the path is unloaded and returns a query for the entity at its end; never performs I/O.

public IEntityQuery<T> AsUnloaded()

Returns

IEntityQuery<T>

Exceptions

InvalidOperationException

Thrown if the path is loaded.

EnsurePresent()

Loads the path one reference at a time, in a read per unloaded reference.

[Obsolete("Synchronous reads are a legacy feature which will be removed eventually. Use await, LoadAsync() or EnsurePresentAsync().")]
public void EnsurePresent()

Equals(object?)

Determines whether the specified object is equal to the current object.

public override bool Equals(object? obj)

Parameters

obj object

The object to compare with the current object.

Returns

bool

true if the specified object is equal to the current object; otherwise, false.

GetAwaiter()

Awaiting the lazy is equivalent to calling LoadAsync(CancellationToken?); eager-loaded data completes synchronously.

public TaskAwaiter<T?> GetAwaiter()

Returns

TaskAwaiter<T>

GetHashCode()

Serves as the default hash function.

public override int GetHashCode()

Returns

int

A hash code for the current object.

LoadAsync(CancellationToken?)

Loads the property object in at most one read batch.

public Task<T?> LoadAsync(CancellationToken? cancellationToken = null)

Parameters

cancellationToken CancellationToken?

Returns

Task<T>

LoadAsync(RelationshipPath[], CancellationToken?)

Loads the property object and related data in at most one read batch.

public Task<T?> LoadAsync(RelationshipPath[] includes, CancellationToken? cancellationToken = null)

Parameters

includes RelationshipPath[]
cancellationToken CancellationToken?

Returns

Task<T>

LoadCachedAsync(RequestOptions?, CancellationToken?)

Loads the property object and related data in at most one read batch. Uses the entity cache if possible. If the result was stale, ValueChanged will be raised after validation.

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

Parameters

options RequestOptions
cancellationToken CancellationToken?

Returns

Task<T>

LoadCachedAsync(RequestOptions?, RelationshipPath[], CancellationToken?)

Paths through more than one reference do not use the entity cache; references override this to use it.

public virtual Task<T?> LoadCachedAsync(RequestOptions? options, RelationshipPath[] includes, CancellationToken? cancellationToken = null)

Parameters

options RequestOptions
includes RelationshipPath[]
cancellationToken CancellationToken?

Returns

Task<T>

QueryCollection<U>(RelationshipInfo)

A collection of the path's target: the target's own collection when the path is loaded, otherwise a store query from the first unloaded reference's foreign key; never loads.

protected IEntityQuery<U> QueryCollection<U>(RelationshipInfo collection) where U : IEntity

Parameters

collection RelationshipInfo

Returns

IEntityQuery<U>

Type Parameters

U

ToString()

The dotted navigation path ("Pet.Owner"); references override this to render their relationship and foreign key.

public override string ToString()

Returns

string

TryGetLoaded(out T?)

Returns the property object if it is loaded; never performs I/O. A loaded path or reference may be null.

public bool TryGetLoaded(out T? value)

Parameters

value T

Returns

bool

Operators

operator ==(EntityPathBase<T>?, EntityPathBase<T>?)

Paths and references compare by target identity: the ID of the known (or loaded) target entity. A null instance compares as a null target, matching the query translation of reference null checks to foreign key tests. Equals also equates a path with its target entity, symmetrically with the entity's own Equals.

public static bool operator ==(EntityPathBase<T>? left, EntityPathBase<T>? right)

Parameters

left EntityPathBase<T>
right EntityPathBase<T>

Returns

bool

operator !=(EntityPathBase<T>?, EntityPathBase<T>?)

public static bool operator !=(EntityPathBase<T>? left, EntityPathBase<T>? right)

Parameters

left EntityPathBase<T>
right EntityPathBase<T>

Returns

bool