Bondarukini.Validation.DependencyInjection
10.0.0
dotnet add package Bondarukini.Validation.DependencyInjection --version 10.0.0
NuGet\Install-Package Bondarukini.Validation.DependencyInjection -Version 10.0.0
<PackageReference Include="Bondarukini.Validation.DependencyInjection" Version="10.0.0" />
<PackageVersion Include="Bondarukini.Validation.DependencyInjection" Version="10.0.0" />
<PackageReference Include="Bondarukini.Validation.DependencyInjection" />
paket add Bondarukini.Validation.DependencyInjection --version 10.0.0
#r "nuget: Bondarukini.Validation.DependencyInjection, 10.0.0"
#:package Bondarukini.Validation.DependencyInjection@10.0.0
#addin nuget:?package=Bondarukini.Validation.DependencyInjection&version=10.0.0
#tool nuget:?package=Bondarukini.Validation.DependencyInjection&version=10.0.0
Bondarukini.Validator.DependencyInjection
Dependency injection extensions for Bondarukini.Validator.
Provides simple, automatic registration of all validators across your assemblies.
β¨ Features
- One-line registration for all validators
- Automatically scans assemblies for:
IValidator<T>implementations
- Seamless integration with
Bondarukini.Mediatorpipeline - Works perfectly with
ValidatorBehaviour<TRequest, TResponse>
π Installation
dotnet add package Bondarukini.Validator.DependencyInjection
π‘ Example Usage
In your Program.cs or Startup.cs:
using Microsoft.Extensions.DependencyInjection;
using System.Reflection;
using Bondarukini.Validator.DependencyInjection;
var builder = WebApplication.CreateBuilder(args);
var services = builder.Services;
// Register all validators from the current assembly
services.AddValidatorsFromAssembly(Assembly.GetExecutingAssembly());
// Or from multiple assemblies
services.AddValidatorsFromAssemblies(new[]
{
Assembly.GetExecutingAssembly(),
typeof(SomeSharedValidator).Assembly
});
Now all validators implementing IValidator<T> will be automatically discovered and available via DI.
π§± Integration with Mediator
When using Bondarukini.Mediator, validators will automatically execute before the corresponding handlers
through the ValidatorBehaviour<TRequest, TResponse> pipeline step.
Example registration:
services.AddTransient(typeof(IPipelineBehavior<,>), typeof(ValidatorBehaviour<,>));
π¦ Related Packages
| Package | Description |
|---|---|
| Bondarukini.Validator | Core validation engine |
| Bondarukini.Mediator | Lightweight mediator implementation |
| Bondarukini.Mediator.Behaviors | Validation & Transaction behaviors |
π§βπ» Author
Yurii Bondaruk
Clean, extensible, and minimalistic architecture tools for .NET πΊπ¦
| Product | Versions 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. |
-
net10.0
- Bondarukini.Validator (>= 10.0.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.0-preview.5.25277.114)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.