BoltDI.AspNetCore
0.1.0
dotnet add package BoltDI.AspNetCore --version 0.1.0
NuGet\Install-Package BoltDI.AspNetCore -Version 0.1.0
<PackageReference Include="BoltDI.AspNetCore" Version="0.1.0" />
<PackageVersion Include="BoltDI.AspNetCore" Version="0.1.0" />
<PackageReference Include="BoltDI.AspNetCore" />
paket add BoltDI.AspNetCore --version 0.1.0
#r "nuget: BoltDI.AspNetCore, 0.1.0"
#:package BoltDI.AspNetCore@0.1.0
#addin nuget:?package=BoltDI.AspNetCore&version=0.1.0
#tool nuget:?package=BoltDI.AspNetCore&version=0.1.0
BoltDI
Lightning-fast, source-generated dependency injection for .NET. BoltDI generates strongly-typed containers at compile time—no reflection, no runtime registration.
Features
- Compile-time container generation driven by attributes.
- Deterministic lifetimes (Transient / Scoped / Singleton) with automatic disposal.
- Roslyn diagnostics that catch graph issues before you press F5.
- Drop-in ASP.NET Core integration via
BoltServiceProviderFactory<TContainer>. - Samples and benchmarks that compare BoltDI to Microsoft.Extensions.DependencyInjection.
Quick Start
Install the packages:
dotnet add package BoltDI
dotnet add package BoltDI.Abstractions
dotnet add package BoltDI.Generators
Declare a container:
using BoltDI;
[DiContainer]
[Singleton(typeof(IGreeter), typeof(Greeter))]
[Scoped(typeof(IClock), typeof(UtcClock))]
internal partial class AppContainer : BoltContainerBase
{
}
internal interface IGreeter
{
string SayHello();
}
internal sealed class Greeter(IClock clock) : IGreeter
{
public string SayHello() => $"Hello from {clock.Now:O}";
}
internal interface IClock
{
DateTime Now { get; }
}
internal sealed class UtcClock : IClock
{
public DateTime Now => DateTime.UtcNow;
}
Resolve services:
var container = new AppContainer();
var greeter = container.GetRequiredService<IGreeter>();
Console.WriteLine(greeter.SayHello());
using var scope = container.CreateScope();
var clock = scope.ServiceProvider.GetRequiredService<IClock>();
Console.WriteLine(clock.Now);
See Getting Started for a deeper walkthrough.
ASP.NET Core integration
var builder = WebApplication.CreateBuilder(args);
builder.Host.UseBoltDI<AppContainer>();
var app = builder.Build();
app.UseBoltDI();
app.MapGet("/", ([FromServices] IGreeter greeter) => Results.Text(greeter.SayHello()));
app.Run();
The factory replaces the default service provider, honours request scopes, and surfaces BoltDI diagnostics during build. Review samples/02-AspNetCore for a complete example.
Documentation
- Getting Started
- Lifetimes
- Diagnostics catalogue
- NativeAOT guide
- Roadmap
- Release notes
- RFCs (design history and decisions)
Diagnostics
BoltDI validates your container graph at compile time. Browse the diagnostics table for examples and remediation steps.
Samples & Benchmarks
samples/01-Console– minimal console program using BoltDI-generated scopes.samples/02-AspNetCore– ASP.NET Core host using BoltDI for dependency resolution.benchmarks/BoltDI.Benchmarks– BenchmarkDotNet scenarios comparing BoltDI with Microsoft.Extensions.DependencyInjection (dotnet run -c Release).
Target frameworks
BoltDI.Abstractions:netstandard2.0.BoltDI:netstandard2.0,net8.0.BoltDI.Generators:netstandard2.0analyzer (works in modern IDEs and SDKs).BoltDI.AspNetCore:net8.0,net9.0.
Roadmap
Upcoming features such as collection injection, factory helpers, and analyzers are tracked in the roadmap. Feedback is welcome—file an issue or start a discussion.
License
BoltDI is distributed under the MIT License.
| 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 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
- BoltDI (>= 0.1.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 9.0.9)
-
net9.0
- BoltDI (>= 0.1.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 9.0.9)
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 |
|---|---|---|
| 0.1.0 | 198 | 10/13/2025 |