JAAvila.FluentOperations.DependencyInjection
1.5.0
dotnet add package JAAvila.FluentOperations.DependencyInjection --version 1.5.0
NuGet\Install-Package JAAvila.FluentOperations.DependencyInjection -Version 1.5.0
<PackageReference Include="JAAvila.FluentOperations.DependencyInjection" Version="1.5.0" />
<PackageVersion Include="JAAvila.FluentOperations.DependencyInjection" Version="1.5.0" />
<PackageReference Include="JAAvila.FluentOperations.DependencyInjection" />
paket add JAAvila.FluentOperations.DependencyInjection --version 1.5.0
#r "nuget: JAAvila.FluentOperations.DependencyInjection, 1.5.0"
#:package JAAvila.FluentOperations.DependencyInjection@1.5.0
#addin nuget:?package=JAAvila.FluentOperations.DependencyInjection&version=1.5.0
#tool nuget:?package=JAAvila.FluentOperations.DependencyInjection&version=1.5.0
JAAvila.FluentOperations.DependencyInjection
Dependency Injection extensions for JAAvila.FluentOperations Quality Blueprints. Simplifies blueprint registration in IServiceCollection.
Installation
dotnet add package JAAvila.FluentOperations.DependencyInjection
Usage
Register a single blueprint
builder.Services.AddBlueprint<CreateOrderBlueprint>();
Blueprints are registered as singletons since they are stateless and reusable.
Register multiple blueprints at once
builder.Services.AddBlueprints(
typeof(CreateOrderBlueprint),
typeof(UpdateCustomerBlueprint),
typeof(PaymentRequestBlueprint)
);
Register a composite blueprint
Compose N independent blueprints for the same model type T. The composite is the only IBlueprintValidator registered for T, so integration filters (AspNetCore, MediatR, gRPC) find and execute it automatically.
// Individual blueprints registered as concrete type only (NOT as IBlueprintValidator).
// The composite is registered as both its concrete type and IBlueprintValidator.
builder.Services.AddCompositeBlueprint<User>(
typeof(NameBlueprint),
typeof(EmailBlueprint),
typeof(AgeBlueprint));
Or with a factory for custom resolution:
builder.Services.AddCompositeBlueprint<User>(sp =>
[
sp.GetRequiredService<NameBlueprint>(),
sp.GetRequiredService<EmailBlueprint>()
]);
Important: Do NOT call
AddBlueprint<T>()for blueprints that are part of a composite. Doing so registers them asIBlueprintValidator, which causes filters to find the individual blueprint instead of the composite for typeT.
Full example
var builder = WebApplication.CreateBuilder(args);
builder.Services
.AddBlueprint<CreateOrderBlueprint>()
.AddBlueprint<UpdateCustomerBlueprint>();
var app = builder.Build();
app.Run();
API Reference
| Method | Description |
|---|---|
AddBlueprint<TBlueprint>() |
Registers a single blueprint as singleton |
AddBlueprints(params Type[]) |
Registers multiple blueprint types as singletons |
AddCompositeBlueprint<T>(params Type[]) |
Registers a CompositeBlueprint<T> from the given blueprint types |
AddCompositeBlueprint<T>(Func<IServiceProvider, IEnumerable<IBlueprintValidator>>) |
Registers a CompositeBlueprint<T> using a factory |
Requirements
| Dependency | Version |
|---|---|
| .NET | 8.0+ |
| JAAvila.FluentOperations | (same major version) |
| Microsoft.Extensions.DependencyInjection.Abstractions | 6.0.0+ |
License
Apache-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 was computed. 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 was computed. 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. |
-
net8.0
- JAAvila.FluentOperations (>= 1.5.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 6.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.