RCommon.FluentValidation
2.3.2-alpha.0.2
See the version list below for details.
dotnet add package RCommon.FluentValidation --version 2.3.2-alpha.0.2
NuGet\Install-Package RCommon.FluentValidation -Version 2.3.2-alpha.0.2
<PackageReference Include="RCommon.FluentValidation" Version="2.3.2-alpha.0.2" />
<PackageVersion Include="RCommon.FluentValidation" Version="2.3.2-alpha.0.2" />
<PackageReference Include="RCommon.FluentValidation" />
paket add RCommon.FluentValidation --version 2.3.2-alpha.0.2
#r "nuget: RCommon.FluentValidation, 2.3.2-alpha.0.2"
#:package RCommon.FluentValidation@2.3.2-alpha.0.2
#addin nuget:?package=RCommon.FluentValidation&version=2.3.2-alpha.0.2&prerelease
#tool nuget:?package=RCommon.FluentValidation&version=2.3.2-alpha.0.2&prerelease
RCommon.FluentValidation
FluentValidation integration for RCommon's IValidationProvider abstraction. This package bridges the FluentValidation library into RCommon's validation pipeline, resolving registered IValidator<T> instances from the DI container and executing them with support for automatic CQRS command/query validation.
Features
- Implements
IValidationProviderusing the FluentValidation library - Resolves and executes all registered
IValidator<T>instances for a given type from DI - Runs multiple validators concurrently via
Task.WhenAll - Maps FluentValidation failures to RCommon's
ValidationOutcomeandValidationFaulttypes - Supports optional automatic validation of CQRS commands and queries via
CqrsValidationOptions - Assembly scanning to auto-register all validators in one or more assemblies
- Configurable
throwOnFaultsbehavior to throwValidationExceptionon failure - Registered as a scoped service in the DI container
Installation
dotnet add package RCommon.FluentValidation
Usage
Register FluentValidation through the RCommon builder and add your validators:
using RCommon;
using RCommon.FluentValidation;
services.AddRCommon(builder =>
{
builder.WithValidation<FluentValidationBuilder>(validation =>
{
validation.AddValidator<CreateOrderDto, CreateOrderDtoValidator>();
// Or scan an assembly for all validators
validation.AddValidatorsFromAssembly(typeof(CreateOrderDtoValidator).Assembly);
});
});
To enable automatic validation in the CQRS pipeline:
services.AddRCommon(builder =>
{
builder.WithValidation<FluentValidationBuilder>(options =>
{
options.ValidateCommands = true;
options.ValidateQueries = true;
});
});
Inject and use IValidationProvider directly when needed:
public class OrderService
{
private readonly IValidationProvider _validator;
public OrderService(IValidationProvider validator)
{
_validator = validator;
}
public async Task CreateOrder(CreateOrderDto dto)
{
var outcome = await _validator.ValidateAsync(dto, throwOnFaults: true);
// If throwOnFaults is false, inspect the outcome manually
if (!outcome.IsValid)
{
foreach (var fault in outcome.Errors)
{
Console.WriteLine($"{fault.PropertyName}: {fault.ErrorMessage}");
}
}
}
}
Key Types
| Type | Description |
|---|---|
FluentValidationProvider |
IValidationProvider implementation that resolves and runs FluentValidation validators |
FluentValidationBuilder |
Registers FluentValidationProvider into the DI container |
IFluentValidationBuilder |
Builder interface exposing IServiceCollection for validator registration |
FluentValidationBuilderExtensions |
Provides AddValidator<T, TValidator>(), AddValidatorsFromAssembly(), and assembly scanning methods |
ValidationBuilderExtensions |
Provides WithValidation<T>() on IRCommonBuilder for pipeline registration |
Documentation
For full documentation, visit rcommon.com.
Related Packages
- RCommon.ApplicationServices - Core validation abstractions (IValidationProvider, ValidationOutcome, ValidationFault)
- RCommon.Core - RCommon framework core and DI builder
License
Licensed under the Apache License, Version 2.0.
| 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
- FluentValidation (>= 12.1.1)
- FluentValidation.DependencyInjectionExtensions (>= 12.1.1)
- RCommon.ApplicationServices (>= 2.3.2-alpha.0.2)
-
net8.0
- FluentValidation (>= 12.1.1)
- FluentValidation.DependencyInjectionExtensions (>= 12.1.1)
- RCommon.ApplicationServices (>= 2.3.2-alpha.0.2)
-
net9.0
- FluentValidation (>= 12.1.1)
- FluentValidation.DependencyInjectionExtensions (>= 12.1.1)
- RCommon.ApplicationServices (>= 2.3.2-alpha.0.2)
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 |
|---|---|---|
| 2.4.1 | 0 | 2/18/2026 |
| 2.3.2-alpha.0.3 | 0 | 2/18/2026 |
| 2.3.2-alpha.0.2 | 0 | 2/18/2026 |
| 2.3.2-alpha.0.1 | 42 | 2/9/2026 |
| 2.3.1 | 89 | 2/5/2026 |
| 2.3.0 | 83 | 2/3/2026 |
| 2.2.2-alpha.0.1 | 384 | 12/11/2025 |
| 2.2.1-alpha.0.2 | 127 | 10/24/2025 |
| 2.2.1-alpha.0.1 | 130 | 10/24/2025 |
| 2.1.11-alpha.0.2 | 128 | 10/24/2025 |
| 2.1.11-alpha.0.1 | 105 | 7/18/2025 |
| 2.1.10 | 280 | 7/17/2025 |
| 2.1.9-alpha.0.1 | 138 | 7/17/2025 |
| 2.1.2.4 | 222 | 5/21/2025 |
| 2.1.2.3 | 205 | 5/1/2025 |
| 2.1.2.2 | 444 | 1/23/2025 |
| 2.1.2.1 | 153 | 1/17/2025 |
| 2.1.2 | 158 | 1/17/2025 |
| 2.1.1.4 | 163 | 1/7/2025 |
| 0.0.0-alpha.0 | 149 | 7/17/2025 |