DashboardOptions
Configuration class for the Trax.Core Dashboard. Passed via the configure callback in AddTraxDashboard.
Properties
| Property | Type | Default | Description |
|---|---|---|---|
RoutePrefix | string | "/trax" | Read-only. Prefix used to build the sidebar navigation links, set from the routePrefix argument of UseTraxDashboard. It does not move the pages, whose routes are compile-time /trax/... templates. |
Title | string | "Trax" | Title displayed in the dashboard header and browser tab. |
EnvironmentName | string | "" | Read-only. The hosting environment name (e.g., "Development", "Production"), set from IHostEnvironment.EnvironmentName by UseTraxDashboard. |
Authorization posture
Exactly one posture is required before UseTraxDashboard will start. Each method returns the options, so they chain.
| Method | Description |
|---|---|
RequirePolicy(string policy) | Every dashboard endpoint requires the named policy. Throws ArgumentException for a blank name. |
RequireRoles(params string[] roles) | Every dashboard endpoint requires one of the roles. Throws ArgumentException for no roles or a blank one. May be combined with RequirePolicy. |
AllowAnonymousDashboard() | The dashboard adds no authorization of its own; UseTraxDashboard logs a warning on every start. Throws InvalidOperationException when combined with either of the above. |
Example
builder.AddTraxDashboard(options =>
{
options.Title = "My Application - Trains";
options.RequireRoles("Admin");
});
app.UseTraxDashboard();
// RoutePrefix stays at "/trax", which is where the pages are
// EnvironmentName is set automatically from the hosting environmentRemarks
RoutePrefixandEnvironmentNamehave no public setter.UseTraxDashboardsets both, and code can read them from the registeredDashboardOptionssingleton.RoutePrefixis read only by the sidebar. PassingUseTraxDashboarda prefix other than/traxleaves the pages where they are and points every navigation link somewhere that does not exist.Titleis the only property theconfigurecallback can set, alongside the posture.