Tenekon.Extensions.FluentValidation.Blazor
1.0.53-alpha
Prefix Reserved
dotnet add package Tenekon.Extensions.FluentValidation.Blazor --version 1.0.53-alpha
NuGet\Install-Package Tenekon.Extensions.FluentValidation.Blazor -Version 1.0.53-alpha
<PackageReference Include="Tenekon.Extensions.FluentValidation.Blazor" Version="1.0.53-alpha" />
<PackageVersion Include="Tenekon.Extensions.FluentValidation.Blazor" Version="1.0.53-alpha" />
<PackageReference Include="Tenekon.Extensions.FluentValidation.Blazor" />
paket add Tenekon.Extensions.FluentValidation.Blazor --version 1.0.53-alpha
#r "nuget: Tenekon.Extensions.FluentValidation.Blazor, 1.0.53-alpha"
#:package Tenekon.Extensions.FluentValidation.Blazor@1.0.53-alpha
#addin nuget:?package=Tenekon.Extensions.FluentValidation.Blazor&version=1.0.53-alpha&prerelease
#tool nuget:?package=Tenekon.Extensions.FluentValidation.Blazor&version=1.0.53-alpha&prerelease
Tenekon.Extensions.FluentValidation.Blazor
Scoped, nestable FluentValidation for Blazor forms. Use it to validate the form root, a nested model, or a routed region of a form without giving up Blazor's EditContext flow.
Status: 1.0-alpha. The public API is intended to be stable, but changes may occur as the library matures.
Repository rename: this repository used to be called Tenekon.FluentValidation.Extensions. It was renamed to Tenekon.Extensions.FluentValidation.Blazor to match the single package it ships.
Why This Package
Blazor's built-in validation flow is centered around a single EditContext, but real forms often split into nested components, repeating items, and scoped sub-regions.
This package lets you:
- validate the whole form with FluentValidation
- attach validators to nested models and collection items
- keep nested validators connected to the parent form lifecycle
- limit validation to selected branches of the model when needed
Installation
Install the package:
dotnet add package Tenekon.Extensions.FluentValidation.Blazor
If you want to resolve validators from dependency injection by using ValidatorType, also install:
dotnet add package FluentValidation.DependencyInjectionExtensions
If you prefer, you can skip the DI extensions package and pass a validator instance through the Validator parameter instead.
Quickstart
1. Register your validators
using FluentValidation;
builder.Services.AddValidatorsFromAssemblyContaining<PersonValidator>();
2. Create a model and validator
using FluentValidation;
public sealed class Person
{
public string? Name { get; set; }
}
public sealed class PersonValidator : AbstractValidator<Person>
{
public PersonValidator()
{
RuleFor(x => x.Name).NotEmpty();
}
}
3. Use EditModelValidatorRootpath inside your form
Add the package namespace to _Imports.razor or directly in the component:
@using Microsoft.AspNetCore.Components.Forms
@using Tenekon.Extensions.FluentValidation.Blazor
Then wire the validator into your EditForm:
<EditForm Model="_model" OnValidSubmit="HandleValidSubmit">
<EditModelValidatorRootpath ValidatorType="typeof(PersonValidator)" />
<label for="name">Name</label>
<InputText id="name" @bind-Value="_model.Name" />
<ValidationMessage For="() => _model.Name" />
<button type="submit">Save</button>
</EditForm>
@code {
private readonly Person _model = new();
private Task HandleValidSubmit()
{
return Task.CompletedTask;
}
}
If you want to bypass DI, use Validator="new PersonValidator()" instead of ValidatorType="typeof(PersonValidator)".
Which Component Should I Use?
| Component | Use it when |
|---|---|
EditModelValidatorRootpath |
You want to validate the main model of the current form or cascaded EditContext. |
EditModelValidatorSubpath |
You want to validate a nested object or a repeated item inside the main model. |
EditModelValidatorRoutes |
You want a validator to act only on selected branches of the model. Use it inside EditModelValidatorRootpath or EditModelValidatorSubpath. |
EditModelScope |
You want to create a scoped validation region with its own EditContext behavior. |
For worked examples of all four components, see the Validator Components Cookbook.
Compatibility And Dependencies
- Target frameworks:
net8.0,net9.0,net10.0 - FluentValidation:
12.x - Blazor forms integration: the package selects the matching
Microsoft.AspNetCore.Components.Formsversion for each target framework - Internal dependency:
FastExpressionCompiler5.x
Documentation
- Cookbook: start here for usage patterns and copyable scenarios.
- Architecture: read this when you want the mental model behind root, subpath, routes, and scope behavior.
- Motivation: read this when you want the design rationale and why the package is split into rootpath, subpath, routes, and scope.
Development
git clone https://github.com/tenekon/Tenekon.Extensions.FluentValidation.Blazor.git
cd Tenekon.Extensions.FluentValidation.Blazor
dotnet test
Questions, feedback, and design discussion are welcome in the Tenekon Community Discord.
License
MIT License. See LICENSE for details.
| 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
- FastExpressionCompiler (>= 5.3.0)
- FluentValidation (>= 12.0.0)
- Microsoft.AspNetCore.Components.Forms (>= 10.0.3)
-
net8.0
- FastExpressionCompiler (>= 5.3.0)
- FluentValidation (>= 12.0.0)
- Microsoft.AspNetCore.Components.Forms (>= 8.0.23)
-
net9.0
- FastExpressionCompiler (>= 5.3.0)
- FluentValidation (>= 12.0.0)
- Microsoft.AspNetCore.Components.Forms (>= 9.0.12)
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 |
|---|---|---|
| 1.0.53-alpha | 33 | 3/21/2026 |