Cloudstrap.BlazorCommon 0.2.0-preview.83

Prefix Reserved
This is a prerelease version of Cloudstrap.BlazorCommon.
dotnet add package Cloudstrap.BlazorCommon --version 0.2.0-preview.83
                    
NuGet\Install-Package Cloudstrap.BlazorCommon -Version 0.2.0-preview.83
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Cloudstrap.BlazorCommon" Version="0.2.0-preview.83" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Cloudstrap.BlazorCommon" Version="0.2.0-preview.83" />
                    
Directory.Packages.props
<PackageReference Include="Cloudstrap.BlazorCommon" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Cloudstrap.BlazorCommon --version 0.2.0-preview.83
                    
#r "nuget: Cloudstrap.BlazorCommon, 0.2.0-preview.83"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Cloudstrap.BlazorCommon@0.2.0-preview.83
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Cloudstrap.BlazorCommon&version=0.2.0-preview.83&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Cloudstrap.BlazorCommon&version=0.2.0-preview.83&prerelease
                    
Install as a Cake Tool

Cloudstrap.BlazorCommon

Shared Blazor abstractions for Cloudstrap apps: the IViewModel initialization contract, the consumer-implemented IErrorHandler feedback contract, and one-call Scrutor convention registration of your presentation layer — usable from Blazor Server and WebAssembly alike. The package references no Blazor package at all: it works in any host that has Microsoft.Extensions.DependencyInjection.

Quick start

// Program.cs — WASM client (or any Blazor host)
builder.Services.AddCloudstrapBlazorCommon<IDoctorsViewModel>();          // scans the marker's assembly
builder.Services.AddScoped<IErrorHandler, SnackbarErrorHandler>();        // consumer-owned, any lifetime

One call scans the marker type's assembly and registers every public concrete class whose name ends in ViewModel or Service as all of its implemented interfaces.

Knobs

All conventions are code-level knobs at the call site — this package has no Cloudstrap: configuration section and never reads IConfiguration.

Knob Default Meaning
ConventionSuffixes ["ViewModel", "Service"] Class-name suffixes the scan matches (ordinal). Replace the contents to change the conventions; clear the list for a deliberate no-op.
Lifetime Transient The lifetime applied to every convention registration.
AdditionalAssemblies empty Assemblies scanned in addition to the marker type's assembly.
builder.Services.AddCloudstrapBlazorCommon<IDoctorsViewModel>(options =>
{
    options.ConventionSuffixes.Add("Presenter");
    options.Lifetime = ServiceLifetime.Scoped;
    options.AdditionalAssemblies.Add(typeof(SomeOtherFeature).Assembly);
});

Registration semantics

  • Interfaces-only — a matching class with no interfaces registers nothing; the concrete type itself is never registered.
  • Append-on-repeat — calling the method again appends registrations (standard IServiceCollection semantics). Call it once per scanned assembly set.
  • Ordinal suffix matching, once per suffix — a name is matched by each suffix pass independently; don't name classes so that they end in two configured suffixes.
  • A null/empty/whitespace suffix entry throws ArgumentException at the call — an emptied list is the supported no-op, a blank entry is always a bug.

Escape hatch

Scrutor is a normal public dependency of this package. For anything beyond the three knobs — self-registration, decorators, predicate filters — call services.Scan(...) directly; it composes freely with AddCloudstrapBlazorCommon.

IErrorHandler — consumer-implemented

The package ships the contract only: no implementation, no default registration. Implement it in your app (for example over MudBlazor's ISnackbar) and register it at any lifetime. ViewModels route failures to HandleError(Exception) / ShowError(string) instead of throwing into the render loop.

IViewModel — page initialization

protected override async Task OnInitializedAsync() => await ViewModel.InitializeAsync();

InitializeAsync(CancellationToken cancellationToken = default) loads the ViewModel's initial state. Cancellation is the implementer's duty: pass the token to every downstream call.

Migrating from the source library

Source Here
IViewModel.InitializeAsync() Gains an optional CancellationToken (D-1).
IErrorHandler.ShowWarning / ShowSuccess Dropped — zero call sites existed (D-2).
INavigationService / AddNavigationService Dropped — inject NavigationManager directly (D-3).
AddPresentationServices<T> / AddBlazorCommonForNihdi Folded into AddCloudstrapBlazorCommon<T> with overridable conventions (D-4).
NihdiWasmControls Dropped — use the router's native AdditionalAssemblies parameter (D-5).

License

MIT — part of the Cloudstrap suite.

Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.2.0-preview.83 58 9/3/2026
0.2.0-preview.2 72 8/27/2026