BoltDI.Generators 0.1.0

dotnet add package BoltDI.Generators --version 0.1.0
                    
NuGet\Install-Package BoltDI.Generators -Version 0.1.0
                    
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="BoltDI.Generators" Version="0.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="BoltDI.Generators" Version="0.1.0" />
                    
Directory.Packages.props
<PackageReference Include="BoltDI.Generators" />
                    
Project file
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 BoltDI.Generators --version 0.1.0
                    
#r "nuget: BoltDI.Generators, 0.1.0"
                    
#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 BoltDI.Generators@0.1.0
                    
#: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=BoltDI.Generators&version=0.1.0
                    
Install as a Cake Addin
#tool nuget:?package=BoltDI.Generators&version=0.1.0
                    
Install as a Cake Tool

BoltDI

NuGet – BoltDI.Generators Build License

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

Diagnostics

BoltDI validates your container graph at compile time. Browse the diagnostics table for examples and remediation steps.

Samples & Benchmarks

Target frameworks

  • BoltDI.Abstractions: netstandard2.0.
  • BoltDI: netstandard2.0, net8.0.
  • BoltDI.Generators: netstandard2.0 analyzer (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 Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.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
0.1.0 198 10/13/2025