OrionGuard.Blazor
7.0.0
dotnet add package OrionGuard.Blazor --version 7.0.0
NuGet\Install-Package OrionGuard.Blazor -Version 7.0.0
<PackageReference Include="OrionGuard.Blazor" Version="7.0.0" />
<PackageVersion Include="OrionGuard.Blazor" Version="7.0.0" />
<PackageReference Include="OrionGuard.Blazor" />
paket add OrionGuard.Blazor --version 7.0.0
#r "nuget: OrionGuard.Blazor, 7.0.0"
#:package OrionGuard.Blazor@7.0.0
#addin nuget:?package=OrionGuard.Blazor&version=7.0.0
#tool nuget:?package=OrionGuard.Blazor&version=7.0.0
OrionGuard.Blazor
Runs your OrionGuard rules inside an EditForm, so the same validator the API uses also drives the form's field messages.
dotnet add package OrionGuard.Blazor
@using Moongazing.OrionGuard.Blazor
<EditForm Model="model" OnValidSubmit="Save">
<OrionGuardFluentValidator TModel="SignUpModel" />
<InputText @bind-Value="model.Email" />
<ValidationMessage For="() => model.Email" />
<button type="submit">Save</button>
</EditForm>
@code {
private readonly SignUpModel model = new();
private void Save() { }
}
Typing an invalid address and leaving the field puts the validator's message under that input; submitting with it invalid never calls Save. The core OrionGuard package comes along as a dependency.
The component resolves IValidator<SignUpModel> from DI, so register it:
using Microsoft.Extensions.DependencyInjection;
using Moongazing.OrionGuard.Blazor.Extensions;
using Moongazing.OrionGuard.DependencyInjection;
public sealed class SignUpModel
{
public string Email { get; set; } = "";
}
public sealed class SignUpModelValidator : AbstractValidator<SignUpModel>
{
public SignUpModelValidator()
{
RuleFor(x => x.Email, nameof(SignUpModel.Email), p => p.NotEmpty().Email());
}
}
public static class BlazorSetup
{
public static void Add(IServiceCollection services) =>
services
.AddOrionGuardBlazor()
.AddValidator<SignUpModel, SignUpModelValidator>();
}
AddOrionGuardBlazor() only calls AddOrionGuard(); it registers no validators.
The two components
<OrionGuardFluentValidator TModel="..." /> injects IValidator<TModel> and runs it. A validator for the model type must be registered, or the component cannot be constructed.
<OrionGuardValidator /> needs no registration at all: it validates EditContext.Model with AttributeValidator, using the attributes from Moongazing.OrionGuard.Attributes — [NotNull], [NotEmpty], [Length], [Email], [Range], [Regex], [Positive].
Both react to the same EditContext events: on submit the messages are cleared and the whole model is validated; when one field changes the whole model is validated again but only that field's errors are shown. An error is attached to FieldIdentifier(model, error.ParameterName).
What this does not do
- No async rules in the form.
OrionGuardFluentValidatorcalls the synchronousValidate(model), soRuleForAsyncrules never run here. That is forced by Blazor:EditContext.Validate()raises its events synchronously and returns a verdict immediately, so an async rule could not finish in time. For a "is this email taken" check, injectIValidator<TModel>into the page andawait ValidateAsync(...)in the submit handler. <OrionGuardValidator />ignoresSystem.ComponentModel.DataAnnotations.[Required]and friends are not read; add<DataAnnotationsValidator />alongside it if your model uses both.- The error's
ParameterNamemust equal the property name for<ValidationMessage For="..." />to find it. An error for a nested object does not map to a field — it still shows in<ValidationSummary />, just not next to an input. - Both components require a cascading
EditContext. Outside anEditFormthey throwInvalidOperationException. - Server-hosted Blazor only. The package references the
Microsoft.AspNetCore.Appshared framework, which a Blazor WebAssembly client project cannot reference. Use it from Blazor Server or interactive server rendering.
Targets
net8.0, net9.0, net10.0. A Razor class library on the ASP.NET Core shared framework.
With the rest of OrionGuard
OrionGuard · OrionGuard.AspNetCore (the same validator behind the API the form posts to)
Documentation
License
MIT. See LICENSE.txt.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. 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. |
-
net10.0
- OrionGuard (>= 7.0.0)
-
net8.0
- OrionGuard (>= 7.0.0)
-
net9.0
- OrionGuard (>= 7.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.
| Version | Downloads | Last Updated |
|---|---|---|
| 7.0.0 | 83 | 9/20/2026 |
| 6.7.0 | 125 | 7/20/2026 |
| 6.6.2 | 133 | 6/20/2026 |
| 6.6.1 | 121 | 6/20/2026 |
| 6.6.0 | 120 | 6/19/2026 |
| 6.5.30 | 132 | 6/17/2026 |
| 6.5.29 | 118 | 6/15/2026 |
| 6.5.28 | 121 | 6/15/2026 |
| 6.5.27 | 115 | 6/15/2026 |
| 6.5.26 | 120 | 6/13/2026 |
| 6.5.25 | 112 | 6/13/2026 |
| 6.5.24 | 117 | 6/12/2026 |
| 6.5.23 | 123 | 6/12/2026 |
| 6.5.22 | 119 | 6/11/2026 |
| 6.5.21 | 118 | 6/11/2026 |
| 6.5.20 | 117 | 6/11/2026 |
| 6.5.19 | 119 | 6/11/2026 |
| 6.5.18 | 116 | 6/11/2026 |
| 6.5.16 | 114 | 6/11/2026 |
| 6.5.15 | 119 | 6/11/2026 |