Pure.DI.Templates
2.1.59
Prefix Reserved
dotnet new install Pure.DI.Templates::2.1.59
Pure.DI is a compile-time dependency injection (DI) code generator. Supports .NET starting with .NET Framework 2.0, released 2005-10-27, and all newer versions.
Usage Requirements
- .NET SDK 6.0.4+
Required for compilation. Projects can target older frameworks (e.g., .NET Framework 2.0). - C# 8+
Only required for projects using the Pure.DI source generator. Other projects support any C# version.
Key Features
✔️ Zero Overhead
Pure.DI is a .NET code generator designed to produce clean, efficient dependency injection logic. By leveraging basic language constructs, it generates straightforward code indistinguishable from manual implementation—essentially composing objects through nested constructor invocations. Unlike traditional DI frameworks, Pure.DI avoids reflection and dynamic instantiation entirely, eliminating performance penalties associated with runtime overhead.
✔️ Compile-Time Validation
All analysis of object, constructor, and method graphs occurs at compile time. Pure.DI proactively detects and alerts developers to issues such as missing dependencies, cyclic references, or dependencies unsuitable for injection—ensuring these errors are resolved before execution. This approach guarantees that developers cannot produce a program vulnerable to runtime crashes caused by faulty dependency wiring. The validation process operates seamlessly alongside code development, creating an immediate feedback loop: as you modify your code, Pure.DI verifies its integrity in real time, effectively delivering tested, production-ready logic the moment changes are implemented.
✔️ Works everywhere
The pure dependency injection approach introduces no runtime dependencies and avoids .NET reflection , ensuring consistent execution across all supported platforms. This includes the Full .NET Framework 2.0+, .NET Core, .NET 5+, UWP/Xbox, .NET IoT, Unity, Xamarin, Native AOT, and beyond. By decoupling runtime constraints, it preserves predictable behavior regardless of the target environment.
✔️ Familiar Syntax
The Pure.DI API is intentionally designed to closely mirror the APIs of mainstream IoC/DI frameworks. This approach ensures developers can leverage their existing knowledge of dependency injection patterns without requiring significant adaptation to a proprietary syntax.
✔️ Precise Generics
Pure.DI recommends utilizing dedicated marker types rather than relying on open generics. This approach enables more precise construction of object graphs while allowing developers to fully leverage the capabilities of generic types.
✔️ Transparency
Pure.DI allows to view and debug the generated code, making debugging and testing easier.
✔️ Built-in BCL Support
Pure.DI provides native support for numerous Base Class Library (BCL) types out of the box without any extra effort.
When to Use Pure.DI
✔️ High-Performance Applications
Pure.DI is designed for high-performance applications where speed and minimal memory consumption are critical.
✔️ Projects with a Focus on Clean Code
Pure.DI is suitable for projects where code cleanliness and minimalism are important factors.
✔️ Applications with Complex Dependencies
Pure.DI can handle complex dependencies and provides flexible configuration options.
✔️ Ideal for Libraries
Its high performance, zero memory consumption/preparation overhead, and lack of dependencies make it ideal for building libraries and frameworks.
NuGet packages
NuGet package | Description |
---|---|
Pure.DI | DI source code generator |
Pure.DI.Abstractions | Abstractions for Pure.DI |
Pure.DI.Templates | Template package, for creating projects from the shell/command line |
Pure.DI.MS | Add-ons on Pure.DI to work with Microsoft DI |
-
.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 |
---|---|---|
2.1.59 | 128 | 2/27/2025 |
2.1.58 | 138 | 2/25/2025 |
2.1.57 | 114 | 2/20/2025 |
2.1.56 | 402 | 2/7/2025 |
2.1.55 | 128 | 2/5/2025 |
2.1.54 | 122 | 2/4/2025 |
2.1.53 | 242 | 1/25/2025 |
2.1.52 | 154 | 1/22/2025 |
2.1.51 | 141 | 1/17/2025 |
2.1.50 | 153 | 1/16/2025 |
2.1.49 | 146 | 1/10/2025 |
2.1.47 | 185 | 12/27/2024 |
2.1.46 | 123 | 12/26/2024 |
2.1.45 | 119 | 12/24/2024 |
2.1.44 | 156 | 12/20/2024 |
2.1.43 | 121 | 12/19/2024 |
2.1.42 | 138 | 12/17/2024 |
2.1.41 | 228 | 11/28/2024 |
2.1.40 | 138 | 11/21/2024 |
2.1.38 | 192 | 11/15/2024 |
2.1.36 | 745 | 9/13/2024 |
2.1.35 | 140 | 9/5/2024 |
2.1.34 | 143 | 8/28/2024 |
2.1.33 | 168 | 8/24/2024 |
2.1.32 | 148 | 8/21/2024 |
2.1.31 | 171 | 8/12/2024 |
2.1.30 | 142 | 8/10/2024 |
2.1.29 | 118 | 8/2/2024 |
2.1.28 | 142 | 7/24/2024 |
2.1.25 | 230 | 7/2/2024 |
2.1.24 | 147 | 6/26/2024 |
2.1.23 | 223 | 6/7/2024 |
2.1.22 | 335 | 5/23/2024 |
2.1.21 | 166 | 5/21/2024 |
2.1.20 | 134 | 5/20/2024 |
2.1.19 | 226 | 5/17/2024 |
2.1.18 | 146 | 5/16/2024 |
2.1.17 | 129 | 5/15/2024 |
2.1.15 | 342 | 5/7/2024 |
2.1.14 | 166 | 4/27/2024 |
2.1.11 | 137 | 4/26/2024 |
2.1.10 | 143 | 4/18/2024 |
2.1.4 | 714 | 3/7/2024 |
2.1.3 | 317 | 2/29/2024 |
2.1.2 | 219 | 2/27/2024 |
2.0.5 | 1,878 | 12/29/2023 |
2.0.4 | 230 | 12/27/2023 |
2.0.3 | 1,599 | 11/5/2023 |
2.0.1 | 249 | 11/4/2023 |
2.0.0 | 444 | 7/18/2023 |
1.0.5 | 709 | 10/16/2022 |
1.0.4 | 573 | 6/19/2022 |
1.0.3 | 465 | 6/17/2022 |
1.0.2 | 443 | 9/30/2021 |
1.0.1 | 562 | 8/26/2021 |