Table of Contents

Interface IIdentifyRelatedResources<TRelated, TId>

Namespace
Trellis.Authorization
Assembly
Trellis.Authorization.dll

Declares that this resource has a plural outbound navigation to a set of related resources of type TRelated identified by TId. Used at the terminal hop of an indirect authorization chain to express OR-style / candidate-set authorization (e.g. cricket Match → {HomeTeam, AwayTeam}).

public interface IIdentifyRelatedResources<TRelated, TId>

Type Parameters

TRelated

The related resource type.

TId

The identifier type of the related resource.

Extension Methods

Examples

public sealed class Match : Aggregate<MatchId>, IIdentifyRelatedResources<Team, TeamId>
{
    public TeamId Team1Id { get; }
    public TeamId Team2Id { get; }
    public IReadOnlyList<TeamId> GetRelatedResourceIds() => [Team1Id, Team2Id];
}

Remarks

The list semantics are:

  • Empty list is treated as "no candidates" and produces a Error.Forbidden result without invoking the command's Authorize(Actor, IReadOnlyList<TOwner>).
  • Duplicate IDs are de-duplicated by the pipeline before loading.
  • Order is not significant. If your domain needs to distinguish roles (e.g., HomeTeam vs AwayTeam), use distinct types for each role or drop to IResourceLoader<TMessage, TProjection>.

Only supported at the terminal hop of an authorization chain in v1. Plural-in-middle (fan-out cartesian expansion) is intentionally out of scope and produces a startup error. Use IResourceLoader<TMessage, TProjection> for that shape.

Methods

GetRelatedResourceIds()

Returns the identifiers of all related resources of type TRelated.

IReadOnlyList<TId> GetRelatedResourceIds()

Returns

IReadOnlyList<TId>

A non-null read-only list. Duplicates are de-duplicated by the pipeline before loading. An empty list short-circuits authorization to Error.Forbidden.