The Unity Container (Unity) is a lightweight, extensible dependency injection container. It facilitates building loosely coupled applications and provides developers with the following advantages:
- Simplified object creation, especially for hierarchical object structures and dependencies
- Abstraction of requirements; this allows developers to specify dependencies at run time or in configuration and simplify management of crosscutting concerns
- Increased flexibility by deferring component configuration to the container
- Service location capability; this allows clients to store or cache the container
- Instance and type interception
- Registration by convention
This release is all about optimizing performance. These are the latest benchmarks:
BenchmarkDotNet=v0.10.12, OS=Windows 7 SP1 (6.1.7601.0)
Intel Xeon CPU E3-1240 V2 3.40GHz, 1 CPU, 8 logical cores and 4 physical cores
Frequency=3312851 Hz, Resolution=301.8548 ns, Timer=TSC
[Host] : .NET Framework 4.6.1 (CLR 4.0.30319.42000), 64bit RyuJIT-v4.6.1076.0
Job-CLJHLJ : .NET Framework 4.6.1 (CLR 4.0.30319.42000), 64bit RyuJIT-v4.6.1076.0
UnrollFactor=1
Method | Version | Mean | Error | StdDev |
---|---|---|---|---|
ChildContainer | 4.0.1 | 606.6 ns | 8.0293 ns | 7.5106 ns |
ChildContainer | 5.6.1 | 250.5 ns | 2.6140 ns | 2.4451 ns |
ChildContainer | 5.7.1 | 131.0 ns | 1.0502 ns | 0.9310 ns |
Object | 4.0.1 | 1,263.6 ns | 18.4935 ns | 16.3940 ns |
Object | 5.6.1 | 794.7 ns | 5.4100 ns | 5.0605 ns |
Object | 5.7.1 | 165.4 ns | 3.3337 ns | 3.7054 ns |
Unregistered | 4.0.1 | 1,258.5 ns | 8.0816 ns | 7.5595 ns |
Unregistered | 5.6.1 | 818.7 ns | 12.8366 ns | 11.3793 ns |
Unregistered | 5.7.1 | 175.6 ns | 1.9537 ns | 1.8275 ns |
Transient | 4.0.1 | 1,264.0 ns | 3.9698 ns | 3.5192 ns |
Transient | 5.6.1 | 616.6 ns | 11.9444 ns | 13.7551 ns |
Transient | 5.7.1 | 178.0 ns | 1.2784 ns | 1.1958 ns |
MappedService | 4.0.1 | 1,361.7 ns | 6.2127 ns | 5.1879 ns |
MappedService | 5.6.1 | 1,004.2 ns | 9.6214 ns | 8.9998 ns |
MappedService | 5.7.1 | 177.9 ns | 2.3800 ns | 2.1098 ns |
ReResolve | 4.0.1 | 1,261.5 ns | 12.7684 ns | 11.9436 ns |
ReResolve | 5.6.1 | 1,061.6 ns | 5.1320 ns | 4.5494 ns |
ReResolve | 5.7.1 | 171.5 ns | 0.8011 ns | 0.6689 ns |
Singleton | 4.0.1 | 740.4 ns | 3.6187 ns | 3.3849 ns |
Singleton | 5.6.1 | 321.3 ns | 1.7380 ns | 1.6257 ns |
Singleton | 5.7.1 | 129.3 ns | 1.6182 ns | 1.4345 ns |
Suggest new features or vote for the proposals you like, ADD your comments:
Unity library consists of multiple packages. For information about each package please follow the links
Version 4.x is dead. Loss of original signing certificate made it impossible to release anything compatible with v4.0.1 release. To give original developers a credit only about 60 issues were found during two years in production. To move on and enable further development version v5 has been created.
Version 5.x is created as replacement for v4.0.1. Assemblies and namespaces are renamed and refactored but otherwise it is compatible with the original. v5.0.0 release fixes most of the issues found in v4.0.1 and implements several optimizations but the accent was on compatibility and if optimization would break API it was omitted. Once stabilized, this version will enter LTS status and will be patched and fixed for the next few years. There will be no significant development in this line.
This is where all new development will be done. The compatibility would not be a driving factor so better performance and functionality could be achieved.
Release | LTS Status | Active LTS Start | Maintenance Start | Maintenance End |
---|---|---|---|---|
v3.x | No LTS | - | - | 2012 |
v4.x | End-of-Life | - | - | 2015 |
v5.x | Active | 2018-10-18 | March 2018 | December 2019 |
[6.x] | Pending | 2019-01-01 | January 2019 |
- 1: All scheduled dates are subject to change.
The documentation is a work in progress. Some info is available here but more is coming... I am a bit busy working on v6.x engine and will not be able to dedicate any time to writing docs any time soon. I could really use some help with it. If you feel you could contribute, it would be very welcome. I've considered an idea of crowd sourcing enough funds to hire a professional editor but this takes tame too, so...
- If something is broken and you know how to fix it, send a pull request.
- If you have no idea what is wrong, create an issue
If you have something you'd like to improve do not hesitate to send a Pull Request