Table of Contents

Class ResolvedAuthorizationHop

Namespace
Trellis.Mediator
Assembly
Trellis.Mediator.dll

Describes a single hop in an indirect authorization chain.

public sealed class ResolvedAuthorizationHop
Inheritance
ResolvedAuthorizationHop
Inherited Members
Extension Methods

Constructors

ResolvedAuthorizationHop(Type, Type, Type, Func<object, IReadOnlyList<object>>, Func<IServiceProvider, object, CancellationToken, Task<HopLoadResult>>, bool)

Creates a new resolved hop.

public ResolvedAuthorizationHop(Type fromType, Type toType, Type toIdType, Func<object, IReadOnlyList<object>> extractIds, Func<IServiceProvider, object, CancellationToken, Task<HopLoadResult>> loadAsync, bool isPlural)

Parameters

fromType Type

The CLR type of the resources this hop starts from.

toType Type

The CLR type of the resources this hop loads.

toIdType Type

The CLR type of the identifier used to load toType.

extractIds Func<object, IReadOnlyList<object>>

Delegate that, given an instance of fromType, returns the related resource IDs of type toIdType. For singular hops, returns a list of size 0 or 1; for plural hops, returns 0..N IDs.

loadAsync Func<IServiceProvider, object, CancellationToken, Task<HopLoadResult>>

Delegate that loads a single related resource by ID from the request-scoped service provider. Built at registration time so the runtime behavior remains AOT-clean.

isPlural bool

true when this hop is plural (the source declares IIdentifyRelatedResources<TRelated, TId>); false when singular.

Properties

ExtractIds

Gets the delegate that extracts related-resource IDs from a single source instance.

public Func<object, IReadOnlyList<object>> ExtractIds { get; }

Property Value

Func<object, IReadOnlyList<object>>

FromType

Gets the CLR type of the resources this hop starts from.

public Type FromType { get; }

Property Value

Type

IsPlural

Gets a value indicating whether this hop is plural (fan-out). Only the terminal hop may be plural.

public bool IsPlural { get; }

Property Value

bool

LoadAsync

Gets the delegate that loads one resource by ID from the request-scoped service provider.

public Func<IServiceProvider, object, CancellationToken, Task<HopLoadResult>> LoadAsync { get; }

Property Value

Func<IServiceProvider, object, CancellationToken, Task<HopLoadResult>>

ToIdType

Gets the CLR type of the identifier used to load ToType.

public Type ToIdType { get; }

Property Value

Type

ToType

Gets the CLR type of the resources this hop loads.

public Type ToType { get; }

Property Value

Type