CasCap.Common.Configuration.Blazor
5.2.1
Prefix Reserved
dotnet add package CasCap.Common.Configuration.Blazor --version 5.2.1
NuGet\Install-Package CasCap.Common.Configuration.Blazor -Version 5.2.1
<PackageReference Include="CasCap.Common.Configuration.Blazor" Version="5.2.1" />
<PackageVersion Include="CasCap.Common.Configuration.Blazor" Version="5.2.1" />
<PackageReference Include="CasCap.Common.Configuration.Blazor" />
paket add CasCap.Common.Configuration.Blazor --version 5.2.1
#r "nuget: CasCap.Common.Configuration.Blazor, 5.2.1"
#:package CasCap.Common.Configuration.Blazor@5.2.1
#addin nuget:?package=CasCap.Common.Configuration.Blazor&version=5.2.1
#tool nuget:?package=CasCap.Common.Configuration.Blazor&version=5.2.1
CasCap.Common.Configuration.Blazor
Optional .NET 10/11 Razor class library for embedding typed runtime-control editing in an existing Blazor frontend. It calls the authorized management API; it references only browser-neutral Contracts and Blazor packages, never Runtime, EF Core, SQL/Redis clients or server configuration.
Installation
dotnet add package CasCap.Common.Configuration.Blazor
Usage
Register RuntimeConfigurationClient<T>
in the existing browser DI container. Reuse its same-origin authenticated HttpClient:
builder.Services.AddScoped<RuntimeConfigurationClient<BrowserControls>>();
The host provides its browser-safe DTO from a shared contracts assembly and its existing
authentication, navigation and render mode. Interactive WebAssembly is the simplest cookie-based
integration: the browser retains the HttpOnly cookies and sends same-origin requests.
The RCL imposes no render mode. An Interactive Server host must explicitly provide a per-user
authenticated HTTP client and paired-cookie handling; server-side HttpClient does not
automatically inherit browser authentication. Never use an application-wide privileged client
for every browser user.
Mount RuntimeConfigurationEditor<T>
inside an existing interactive page, with typed fields rather than a key/string-value catalogue:
@using CasCap.Common.Configuration.Blazor.Components
@using CasCap.Common.Configuration.Management.Contracts.Models
<RuntimeConfigurationEditor T="BrowserControls" Destination="_destination">
<Fields Context="value">
<label for="diagnostic-verbosity">Verbosity</label>
<InputNumber id="diagnostic-verbosity" @bind-Value="value.Verbosity" min="0" max="5" />
<label for="diagnostic-feature">Feature enabled</label>
<InputCheckbox id="diagnostic-feature" @bind-Value="value.FeatureEnabled" />
<label for="diagnostic-window">Diagnostic window</label>
<InputDuration id="diagnostic-window" @bind-Value="value.Window" />
</Fields>
</RuntimeConfigurationEditor>
@code {
private readonly RuntimeConfigurationDestination _destination =
new("sample-app", "staging", "controls");
}
The page imports the host's DTO and Microsoft.AspNetCore.Components.Forms.
Use an ordinary forms-compatible mutable DTO or record for the independent editing copy, with
DataAnnotations; no accepted monitor object is mutated. Enum fields use typed InputSelect<TEnum>,
numbers use InputNumber<TNumber>, and InputDuration
preserves TimeSpan with invariant hours:minutes:seconds input. The host chooses bounds and
DTO enum converters shared with the server. Supply unique visible labels/IDs in every field
fragment. The page owns its h1, routing, sign-in and navigation chrome.
Include the host's normal generated .styles.css bundle so the RCL's isolated styles load.
The editor supplies bordered native controls, responsive card spacing and visible focus/disabled
states even when the host resets browser defaults. It inherits the host font and uses MudBlazor
palette CSS variables when available, with standalone fallbacks; no MudBlazor dependency is added.
Scoped descendant styles also cover forms-compatible inputs supplied by the host field fragment.
No JavaScript plugin, assembly scanner, external font or extra component framework is needed.
Configuration Examples
The destination is immutable host bootstrap, not a user-selected arbitrary database/environment. It must exactly match the server's registered scope. Server policies remain authoritative, even when the UI hides a field or operation.
<RuntimeConfigurationEditor T="BrowserControls"
Destination="_destination"
Title="Operational controls"
OnCommitted="DocumentCommittedAsync">
<Fields Context="value">
<label for="operational-verbosity">Verbosity</label>
<InputNumber id="operational-verbosity" @bind-Value="value.Verbosity" />
</Fields>
</RuntimeConfigurationEditor>
DocumentCommittedAsync receives a RuntimeConfigurationDocument<BrowserControls> only after
durable commit; it is not an applied/replica acknowledgement. If the host customizes MVC JSON
naming/converters, construct the client with matching JsonSerializerOptions explicitly.
Do not globally register browser serializer settings that break other typed clients.
Editing and Failure Behavior
- Read the authoritative durable document, including its revision and any expiry. It is not the runtime reader's effective state; an expired durable head can differ from the startup baseline.
- Preview validates the typed candidate without publishing. Editing a previewed control invalidates that preview. Publication requires a reason and explicit destination confirmation.
- Optional temporary lifetime is 1-1440 minutes; absence publishes without expiry.
- Every POST obtains a new principal-bound antiforgery token using the host's issued header name. Tokens remain local to the request, never browser storage or logs.
- Publication uses exact .NET
longrevision serialization, not a JavaScript number conversion. Committed replies explicitly leave activation pending. - Validation, sign-in, permission, missing-document, conflict, unavailable and malformed-response states are distinct. Failed publication preserves entered values and never retries automatically. After an unavailable/uncertain result, investigate or reload before another explicit decision.
- Reloading dirty values and leaving a dirty page require explicit discard confirmation. Requests cancel on destination changes/disposal; the editor does not reuse an old scope's form.
- Native labeled inputs, form submission and buttons support keyboard operation; isolated styles allow controls/actions to wrap. The host still needs its own browser/accessibility verification.
See the server setup, wire contract, consumer guide and component tests. History browsing, restore, promotion, arbitrary scope discovery and live activation dashboards are deliberately not part of this editor.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. net11.0 is compatible. |
-
net10.0
- CasCap.Common.Configuration.Management.Contracts (>= 5.2.1)
- Microsoft.AspNetCore.Components.Web (>= 10.0.14)
-
net11.0
- CasCap.Common.Configuration.Management.Contracts (>= 5.2.1)
- Microsoft.AspNetCore.Components.Web (>= 11.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.