Pure.DI
2.1.46
Prefix Reserved
See the version list below for details.
dotnet add package Pure.DI --version 2.1.46
NuGet\Install-Package Pure.DI -Version 2.1.46
<PackageReference Include="Pure.DI" Version="2.1.46"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> </PackageReference>
paket add Pure.DI --version 2.1.46
#r "nuget: Pure.DI, 2.1.46"
// Install Pure.DI as a Cake Addin #addin nuget:?package=Pure.DI&version=2.1.46 // Install Pure.DI as a Cake Tool #tool nuget:?package=Pure.DI&version=2.1.46
Supports .NET starting with .NET Framework 2.0, released 2005-10-27, and all newer versions.
Usage requirements
.NET SDK 6.0.4 or later is installed. At the same time, you can develop .NET projects even for older versions like .NET Framework 2.0
C# 8 or later. This requirement only needs to be met for projects that reference the Pure.DI source code generator, other projects can use any version of C#.
Key features
Pure.DI is not a framework or library, but a C# source code generator for creating object compositions in the Pure DI paradigm. To make them accurate, the developer uses a set of intuitive hints from the Pure.DI API. At the compilation stage, Pure.DI determines the optimal graph structure, checks its correctness, and generates partial class code to create object compositions using only basic language constructs. The resulting code is robust, works everywhere, does not create exceptions, does not depend on .NET library calls or .NET reflections, is efficient in terms of performance and memory consumption, and is ready for all optimizations. This code can be easily integrated into an application as it does not use unnecessary delegates, additional calls to any methods, type conversions, boxing/unboxing, etc.
- DI without any IoC/DI containers, frameworks, dependencies and hence no performance impact or side effects.
Pure.DI is actually a .NET code generator. It uses basic language constructs to create simple code as well as if you were doing it yourself: de facto it's just a bunch of nested constructor calls. This code can be viewed, analyzed at any time, and debugged.
- A predictable and verified dependency graph is built and validated on the fly while writing code.
All logic for analyzing the graph of objects, constructors and methods takes place at compile time. Pure.DI notifies the developer at compile time of missing or cyclic dependencies, cases when some dependencies are not suitable for injection, etc. The developer has no chance to get a program that will crash at runtime because of some exception related to incorrect object graph construction. All this magic happens at the same time as the code is written, so you have instant feedback between the fact that you have made changes to your code and the fact that your code is already tested and ready to use.
- Does not add any dependencies to other assemblies.
When using pure DI, no dependencies are added to assemblies because only basic language constructs and nothing more are used.
- Highest performance, including compiler and JIT optimization and minimal memory consumption.
All generated code runs as fast as your own, in pure DI style, including compile-time and run-time optimization. As mentioned above, graph analysis is done at compile time, and at runtime there are only a bunch of nested constructors, and that's it. Memory is spent only on the object graph being created.
- It works everywhere.
Since the pure DI approach does not use any dependencies or .NET reflection at runtime, it does not prevent the code from running as expected on any platform: Full .NET Framework 2.0+, .NET Core, .NET, UWP/XBOX, .NET IoT, Xamarin, Native AOT, etc.
- Ease of Use.
The Pure.DI API is very similar to the API of most IoC/DI libraries. And this was a conscious decision: the main reason is that programmers don't need to learn a new API.
- Superfine customization of generic types.
In Pure.DI it is proposed to use special marker types instead of using open generic types. This allows you to build the object graph more accurately and take full advantage of generic types.
- Supports the major .NET BCL types out of the box.
Pure.DI already supports many of BCL types like
Array
,IEnumerable<T>
,IList<T>
,IReadOnlyCollection<T>
,IReadOnlyList<T>
,ISet<T>
,IProducerConsumerCollection<T>
,ConcurrentBag<T>
,Func<T>
,ThreadLocal
,ValueTask<T>
,Task<T>
,MemoryPool<T>
,ArrayPool<T>
,ReadOnlyMemory<T>
,Memory<T>
,ReadOnlySpan<T>
,Span<T>
,IComparer<T>
,IEqualityComparer<T>
and etc. without any extra effort. - Good for building libraries or frameworks where resource consumption is particularly critical.
Its high performance, zero memory consumption/preparation overhead, and lack of dependencies make it ideal for building libraries and frameworks.
Learn more about Target Frameworks and .NET Standard.
This package has no dependencies.
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Pure.DI:
Package | Downloads |
---|---|
Shinya.Core
Shinya.Framework |
GitHub repositories (3)
Showing the top 3 popular GitHub repositories that depend on Pure.DI:
Repository | Stars |
---|---|
BAndysc/AvaloniaVisualBasic6
A recreation of the classic Visual Basic 6 IDE and language in C# with Avalonia
|
|
danielpalme/IocPerformance
Performance comparison of .NET IoC containers
|
|
DevTeam/Pure.DI
Pure DI for .NET
|
Version | Downloads | Last updated |
---|---|---|
2.1.47 | 0 | 12/27/2024 |
2.1.46 | 50 | 12/26/2024 |
2.1.45 | 118 | 12/24/2024 |
2.1.44 | 222 | 12/20/2024 |
2.1.43 | 130 | 12/19/2024 |
2.1.42 | 144 | 12/17/2024 |
2.1.41 | 432 | 11/28/2024 |
2.1.40 | 253 | 11/21/2024 |
2.1.39 | 137 | 11/20/2024 |
2.1.38 | 245 | 11/15/2024 |
2.1.37 | 908 | 11/5/2024 |
2.1.36 | 990 | 9/13/2024 |
2.1.35 | 269 | 9/5/2024 |
2.1.34 | 1,013 | 8/28/2024 |
2.1.33 | 278 | 8/24/2024 |
2.1.32 | 187 | 8/21/2024 |
2.1.31 | 296 | 8/12/2024 |
2.1.30 | 147 | 8/10/2024 |
2.1.28 | 1,088 | 7/24/2024 |
2.1.27 | 3,058 | 7/20/2024 |
2.1.26 | 117 | 7/20/2024 |
2.1.25 | 2,775 | 7/2/2024 |
2.1.24 | 2,125 | 6/26/2024 |
2.1.23 | 280 | 6/7/2024 |
2.1.22 | 828 | 5/23/2024 |
2.1.21 | 239 | 5/21/2024 |
2.1.20 | 1,360 | 5/20/2024 |
2.1.19 | 320 | 5/17/2024 |
2.1.18 | 163 | 5/16/2024 |
2.1.17 | 238 | 5/15/2024 |
2.1.15 | 436 | 5/7/2024 |
2.1.14 | 262 | 4/27/2024 |
2.1.11 | 143 | 4/26/2024 |
2.1.10 | 464 | 4/18/2024 |
2.1.9 | 421 | 4/13/2024 |
2.1.8 | 360 | 4/3/2024 |
2.1.7 | 599 | 3/17/2024 |
2.1.6 | 158 | 3/14/2024 |
2.1.5 | 397 | 3/8/2024 |
2.1.4 | 362 | 3/7/2024 |
2.1.3 | 377 | 2/29/2024 |
2.1.2 | 327 | 2/19/2024 |
2.1.1 | 159 | 2/16/2024 |
2.1.0 | 187 | 2/14/2024 |
2.0.49 | 361 | 2/8/2024 |
2.0.48 | 222 | 2/1/2024 |
2.0.47 | 391 | 1/21/2024 |
2.0.46 | 197 | 1/20/2024 |
2.0.45 | 285 | 1/18/2024 |
2.0.44 | 168 | 1/17/2024 |
2.0.43 | 160 | 1/17/2024 |
2.0.42 | 246 | 1/16/2024 |
2.0.41 | 145 | 1/16/2024 |
2.0.40 | 176 | 1/15/2024 |
2.0.39 | 376 | 1/12/2024 |
2.0.38 | 219 | 1/10/2024 |
2.0.37 | 163 | 1/9/2024 |
2.0.36 | 259 | 1/5/2024 |
2.0.35 | 324 | 12/29/2023 |
2.0.34 | 238 | 12/28/2023 |
2.0.32 | 175 | 12/27/2023 |
2.0.31 | 153 | 12/27/2023 |
2.0.30 | 359 | 12/25/2023 |
2.0.29 | 213 | 12/21/2023 |
2.0.28 | 146 | 12/21/2023 |
2.0.27 | 297 | 12/18/2023 |
2.0.26 | 372 | 12/3/2023 |
2.0.24 | 932 | 11/18/2023 |
2.0.23 | 908 | 11/3/2023 |
2.0.22 | 319 | 10/25/2023 |
2.0.21 | 326 | 10/24/2023 |
2.0.20 | 299 | 10/16/2023 |
2.0.19 | 686 | 9/23/2023 |
2.0.17 | 254 | 9/22/2023 |
2.0.15 | 1,548 | 8/22/2023 |
2.0.14 | 730 | 8/11/2023 |
2.0.13 | 262 | 8/11/2023 |
2.0.12 | 378 | 8/8/2023 |
1.1.64 | 3,776 | 6/22/2023 |
1.1.63 | 4,370 | 12/29/2022 |
1.1.62 | 631 | 11/18/2022 |
1.1.61 | 403 | 11/12/2022 |
1.1.60 | 495 | 10/22/2022 |
1.1.59 | 521 | 10/16/2022 |
1.1.58 | 421 | 10/13/2022 |
1.1.57 | 427 | 10/12/2022 |
1.1.56 | 475 | 10/10/2022 |
1.1.55 | 842 | 10/2/2022 |
1.1.54 | 460 | 10/1/2022 |
1.1.53 | 645 | 9/16/2022 |
1.1.52 | 540 | 9/11/2022 |
1.1.51 | 489 | 9/9/2022 |
1.1.50 | 582 | 9/2/2022 |
1.1.49 | 445 | 9/2/2022 |
1.1.48 | 471 | 9/2/2022 |
1.1.47 | 648 | 8/17/2022 |
1.1.46 | 565 | 8/7/2022 |
1.1.45 | 737 | 7/8/2022 |
1.1.44 | 592 | 6/24/2022 |
1.1.43 | 563 | 6/19/2022 |
1.1.42 | 489 | 6/19/2022 |
1.1.41 | 500 | 6/15/2022 |
1.1.40 | 523 | 6/10/2022 |
1.1.39 | 565 | 6/9/2022 |
1.1.38 | 522 | 6/8/2022 |
1.1.37 | 542 | 6/5/2022 |
1.1.35 | 976 | 3/4/2022 |
1.1.34 | 486 | 3/4/2022 |
1.1.33 | 508 | 3/1/2022 |
1.1.32 | 644 | 2/8/2022 |
1.1.31 | 477 | 2/7/2022 |
1.1.30 | 481 | 2/7/2022 |
1.1.29 | 493 | 2/7/2022 |
1.1.28 | 474 | 2/7/2022 |
1.1.27 | 476 | 2/6/2022 |
1.1.26 | 553 | 2/3/2022 |
1.1.25 | 545 | 1/28/2022 |
1.1.23 | 471 | 1/27/2022 |
1.1.22 | 525 | 1/21/2022 |
1.1.21 | 510 | 1/18/2022 |
1.1.20 | 510 | 1/11/2022 |
1.1.19 | 380 | 12/2/2021 |
1.1.18 | 379 | 11/16/2021 |
1.1.17 | 345 | 11/15/2021 |
1.1.16 | 366 | 11/12/2021 |
1.1.15 | 361 | 11/12/2021 |
1.1.14 | 439 | 11/8/2021 |
1.1.13 | 426 | 11/1/2021 |
1.1.11 | 440 | 10/26/2021 |
1.1.10 | 356 | 10/20/2021 |
1.1.9 | 390 | 10/19/2021 |
1.1.8 | 382 | 10/17/2021 |
1.1.7 | 402 | 10/17/2021 |
1.1.6 | 377 | 10/17/2021 |
1.1.5 | 412 | 10/16/2021 |
1.1.4 | 372 | 10/15/2021 |
1.1.3 | 437 | 10/7/2021 |
1.1.2 | 372 | 10/6/2021 |
1.1.1 | 507 | 10/3/2021 |
1.1.0 | 413 | 9/30/2021 |
1.0.6 | 374 | 9/23/2021 |
1.0.5 | 400 | 9/6/2021 |
1.0.4 | 429 | 8/6/2021 |
1.0.3 | 414 | 8/3/2021 |
1.0.2 | 373 | 8/2/2021 |
1.0.1 | 378 | 7/14/2021 |