Table of Contents

Interface IIdentifyRelatedResource<TRelated, TId>

Namespace
Trellis.Authorization
Assembly
Trellis.Authorization.dll

Declares that this resource has a single outbound navigation to a related resource of type TRelated identified by TId. Used by the pipeline to walk a chain of resources for indirect (multi-hop) resource authorization.

public interface IIdentifyRelatedResource<TRelated, out TId>

Type Parameters

TRelated

The related resource type the navigation points at.

TId

The identifier type of the related resource.

Extension Methods

Examples

public sealed class Match : Aggregate<MatchId>, IIdentifyRelatedResource<Tournament, TournamentId>
{
    public TournamentId TournamentId { get; }
    public TournamentId GetRelatedResourceId() => TournamentId;
}

Remarks

Implement on aggregate roots whose ownership/authorization is evaluated against a different aggregate one or more hops away. Each hop declared on the chain is loaded via the existing SharedResourceLoaderById<TResource, TId> registration for TRelated.

For fan-out (multiple related resources of the same type, e.g. a cricket Match with home and away teams), implement IIdentifyRelatedResources<TRelated, TId> instead.

Paired with IAuthorizeResourceVia<TOwner> on the command. The pipeline resolves a single non-cycling path from the command's leaf resource to its declared owner type at registration time; runtime hops follow that pre-computed path.

Methods

GetRelatedResourceId()

Returns the identifier of the related resource of type TRelated.

TId GetRelatedResourceId()

Returns

TId

The typed identifier.