Roar.DependencyInjection
1.0.1
dotnet add package Roar.DependencyInjection --version 1.0.1
NuGet\Install-Package Roar.DependencyInjection -Version 1.0.1
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="Roar.DependencyInjection" Version="1.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Roar.DependencyInjection" Version="1.0.1" />
<PackageReference Include="Roar.DependencyInjection" />
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 Roar.DependencyInjection --version 1.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Roar.DependencyInjection, 1.0.1"
#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 Roar.DependencyInjection@1.0.1
#: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=Roar.DependencyInjection&version=1.0.1
#tool nuget:?package=Roar.DependencyInjection&version=1.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Roar.DependencyInjection
Compile-time service registration for .NET.
Replaces large blocks of manual AddScoped, AddSingleton, AddTransient, AddHostedService, and MapGrpcService calls with architectural conventions and compile time generated wiring.
Features
- Convention-based automatic registration
- Compile-time source generation (AOT and trimming safe)
- Interface driven roles
- Deterministic service composition
- Zero reflection runtime wiring
- Web, gRPC, worker, and class library friendly
Installation
dotnet add package Roar.DependencyInjection
Basic usage
Mark services by role
using Roar.DependencyInjection;
public class OrderService : IScopedService
{
}
This will generate:
builder.Services.AddScoped<OrderService>();
Explicit interface mapping:
public class OrderService : IScopedService<IOrderService>
{
}
This will generate:
builder.Services.AddScoped<IOrderService, OrderService>();
Register all services
builder.Services.AddRoarServices();
gRPC endpoints
public class OrderGrpcService : OrderServiceContract.OrderServiceContractBase, IGrpcService
{
}
This will generate:
app.MapGrpcService<OrderGrpcService>();
Register all services
app.MapRoarEndpoints();
Lifetime roles
| Role interface | Lifetime |
|---|---|
IScopedService |
Scoped |
ISingletonService |
Singleton |
ITransientService |
Transient |
IBackgroundWorker |
Background |
IGrpcService |
gRPC endpoint |
License
MIT
| 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net10.0
- No dependencies.
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.1 | 21 | 1/16/2026 |
| 1.0.0 | 38 | 1/16/2026 |
| 1.0.0-preview.4 | 40 | 1/10/2026 |
| 1.0.0-preview.3 | 35 | 1/10/2026 |
| 1.0.0-preview.2 | 44 | 1/10/2026 |
| 1.0.0-preview.1 | 40 | 1/10/2026 |
- Add attribute for generrated classes.