ReValidator.BlazorAdapter 1.0.0

dotnet add package ReValidator.BlazorAdapter --version 1.0.0
                    
NuGet\Install-Package ReValidator.BlazorAdapter -Version 1.0.0
                    
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="ReValidator.BlazorAdapter" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ReValidator.BlazorAdapter" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="ReValidator.BlazorAdapter" />
                    
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 ReValidator.BlazorAdapter --version 1.0.0
                    
#r "nuget: ReValidator.BlazorAdapter, 1.0.0"
                    
#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 ReValidator.BlazorAdapter@1.0.0
                    
#: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=ReValidator.BlazorAdapter&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=ReValidator.BlazorAdapter&version=1.0.0
                    
Install as a Cake Tool

ReValidator.BlazorAdapter

A Blazor adapter for the ReValidator validation library. This package enables seamless integration of ReValidator with Blazor's EditForm and validation system, providing model and field-level validation for your Blazor applications.

Features

  • Integrates ReValidator with Blazor's EditForm.
  • Supports model and field-level validation.
  • Works with dependency injection for validator resolution.
  • Merges server-side RFC 7807 validation errors into the form via ServerValidationInterop.
  • Compatible with .NET 10.

Installation

  1. Add the NuGet package to your Blazor project:
    dotnet add package ReValidator.BlazorAdapter
    
  2. Add your validators (implementing IValidator<TModel>) to your DI container, e.g.:
    builder.Services.AddScoped<IValidator<ContactModel>, ContactModelValidator>();
    

Usage

Place ReValidatorComponent<TModel> inside an EditForm. The component resolves IServiceProvider internally — no extra injection is required.

@using ReValidator.BlazorAdapter

<EditForm EditContext="editContext" OnValidSubmit="HandleValidSubmit">
    <ReValidatorComponent TModel="ContactModel" />

    <InputText @bind-Value="model.Name" />
    <ValidationMessage For="() => model.Name" />

    <button type="submit">Submit</button>
</EditForm>

@code {
    private ContactModel model = new();
    private EditContext editContext = null!;

    protected override void OnInitialized()
    {
        editContext = new EditContext(model);
    }
}

Server-Side Validation

ServerValidationInterop.HandleResponse merges errors from an HTTP 422 Unprocessable Entity response (RFC 7807 ValidationProblem) into the form's ValidationMessageStore, so server errors appear alongside client errors.

@code {
    private ValidationMessageStore serverMessageStore = null!;

    protected override void OnInitialized()
    {
        editContext = new EditContext(model);
        serverMessageStore = new ValidationMessageStore(editContext);
    }

    private async Task HandleValidSubmit()
    {
        serverMessageStore.Clear();
        editContext.NotifyValidationStateChanged();

        var response = await Http.PostAsJsonAsync("/api/contact", model);
        var body = await response.Content.ReadAsStringAsync();

        if (ServerValidationInterop.HandleResponse(response, body, editContext, serverMessageStore))
        {
            // success
        }
    }
}

Requirements

  • .NET 10.0 or later
  • Blazor Server (Interactive Server rendering)
  • ReValidator

License

MIT

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
1.0.0 39 3/14/2026