Class BowireRailRegistry

Namespace
Kuestenlogik.Bowire.Plugins
Assembly
Kuestenlogik.Bowire.dll

Registry of discovered IBowireRailContribution descriptors. Mirrors BowireProtocolRegistry's shape — scans loaded assemblies whose name starts with Kuestenlogik.Bowire for rail contributions, instantiates each (default ctor required), and exposes the sorted catalogue to BowireHtmlGenerator for transport to the JS bundle's BOWIRE_CONFIG.rails seed.

public sealed class BowireRailRegistry
Inheritance
BowireRailRegistry
Inherited Members

Remarks

Auto-discovered descriptors mix freely with descriptors registered by hand through services.AddBowireRail<TRail>(); the registry de-duplicates by Id so a host that wants to override a built-in rail's metadata can do so by registering a replacement descriptor with the same id (last write wins).

Constructors

BowireRailRegistry()

public BowireRailRegistry()

Properties

Rails

All registered rails, sorted by SortIndex. Stable secondary sort by Id so two rails with the same sort index render in a deterministic order across reloads.

public IReadOnlyList<IBowireRailContribution> Rails { get; }

Property Value

IReadOnlyList<IBowireRailContribution>

Methods

Discover(ILogger?)

Auto-discover rail contributions from every loaded Kuestenlogik.Bowire* assembly. The registry returned already carries the built-in rail set: hosts that don't reference a rail package simply don't see that rail in the catalogue.

public static BowireRailRegistry Discover(ILogger? logger = null)

Parameters

logger ILogger

Returns

BowireRailRegistry

GetById(string)

Lookup by id, or null when no rail with that id is registered.

public IBowireRailContribution? GetById(string id)

Parameters

id string

Returns

IBowireRailContribution

Register(IBowireRailContribution)

Register a rail descriptor. If a descriptor with the same Id is already registered, the new one replaces it — this lets hosts override a built-in rail's metadata (label, icon, sort) without having to fork the contributing package.

public void Register(IBowireRailContribution rail)

Parameters

rail IBowireRailContribution

ToJson()

Render the registry as the JSON literal seeded into BOWIRE_CONFIG.rails. Each rail becomes an object matching the shape render-sidebar.js expects of an entry in _railModes: { id, label, icon, group, sort, sidebar:{ kind }, hideFromRail, alwaysOn }.

public string ToJson()

Returns

string