Tenekon.Extensions.FluentValidation.Blazor 1.0.53-alpha

Prefix Reserved
This is a prerelease version of Tenekon.Extensions.FluentValidation.Blazor.
dotnet add package Tenekon.Extensions.FluentValidation.Blazor --version 1.0.53-alpha
                    
NuGet\Install-Package Tenekon.Extensions.FluentValidation.Blazor -Version 1.0.53-alpha
                    
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="Tenekon.Extensions.FluentValidation.Blazor" Version="1.0.53-alpha" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Tenekon.Extensions.FluentValidation.Blazor" Version="1.0.53-alpha" />
                    
Directory.Packages.props
<PackageReference Include="Tenekon.Extensions.FluentValidation.Blazor" />
                    
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 Tenekon.Extensions.FluentValidation.Blazor --version 1.0.53-alpha
                    
#r "nuget: Tenekon.Extensions.FluentValidation.Blazor, 1.0.53-alpha"
                    
#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 Tenekon.Extensions.FluentValidation.Blazor@1.0.53-alpha
                    
#: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=Tenekon.Extensions.FluentValidation.Blazor&version=1.0.53-alpha&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Tenekon.Extensions.FluentValidation.Blazor&version=1.0.53-alpha&prerelease
                    
Install as a Cake Tool

Tenekon.Extensions.FluentValidation.Blazor

NuGet License Activity Stars Discord

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.Forms version for each target framework
  • Internal dependency: FastExpressionCompiler 5.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 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. 
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
1.0.53-alpha 33 3/21/2026