PostgreSQL · Types · Routing, paging cookies and capabilities
ArxRouter
Definition
- Namespace
ARX.SDK.Services- Package
ARX.SDK
public sealed class ArxRouter<TService> : IArxRouter<TService>, IDisposable, IAsyncDisposableThe router Create{TService} makes. Disposing it disposes the services it made, not the ones it was given.
Properties
IReadOnlyCollection<string> RouteKeys { get; }Every declared route key.
Methods
static ArxRouter<TService> Create<TService>(Action<ArxRouterBuilder<TService>> configure, IServiceProvider? services = null)A router with the routes
configuredeclares. Register it as a singleton, for exampleservices.AddSingleton<IArxRouter<ArxPgDbService>>(sp => ArxRouter.Create<ArxPgDbService>(r => r.Route("acme", …), sp)).Parameter Type Description configureAction<ArxRouterBuilder<TService>>Declares the routes; at least one. servicesIServiceProvider?= nullOptional: passed to the route factories. TService For(string routeKey)The service for this key. An unknown key is ARX1001 InvalidArgument (the message doesn't echo the key).
Parameter Type Description routeKeystringThe key that picks the service: a tenant, a region, a shard. bool TryFor(string routeKey, out TService service)The service for this key, or false when no route is declared for it.
Parameter Type Description routeKeystringThe key that picks the service: a tenant, a region, a shard. serviceout TServiceThe service when the key has a route; otherwise the default. void Dispose()Disposes the services the router made.
ValueTask DisposeAsync()Disposes the services the router made.