/unity

This repository contains development environment for the entire package. We welcome contributions!

Apache License 2.0Apache-2.0

Overview

The Unity Container (Unity) is a full featured, 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

Installation

Install Unity with the following command:

Install-Package Unity

Unity 5.x loosely follows Semantic Versioning — minor releases may introduce breaking changes. Floating version references should lock in the minor version in addition to the major version:

<PackageReference Include="Unity.Container" Version="5.9.*" />

The documentation is a work in progress. Some info is available here but more is coming... Feel free to open issues in Documentation project with all the questions you would like to be covered or questions you might have.

Performance Stats for v5.9.0

This release is all about optimizing performance. These are the latest benchmarks:

BenchmarkDotNet=v0.11.3, OS=Windows 10.0.17134.523 (1803/April2018Update/Redstone4)
Intel Core i7-6700K CPU 4.00GHz (Skylake), 1 CPU, 8 logical and 4 physical cores
Frequency=3914058 Hz, Resolution=255.4893 ns, Timer=TSC
  [Host]     : .NET Framework 4.7.2 (CLR 4.0.30319.42000), 64bit RyuJIT-v4.7.3260.0
  Job-NIEANE : .NET Framework 4.7.2 (CLR 4.0.30319.42000), 64bit RyuJIT-v4.7.3260.0

InvocationCount=100000  LaunchCount=1  RunStrategy=Throughput  
Method Version Mean Error StdDev
Singleton 4.0.1 455.53 ns 4.3610 ns 4.0793 ns
Singleton 5.8.13 127.87 ns 0.9838 ns 0.9203 ns
Singleton 5.9.0 76.19 ns 0.8752 ns 0.8187 ns
Unregistered 4.0.1 893.14 ns 3.9070 ns 3.6546 ns
Unregistered 5.8.13 128.18 ns 1.2329 ns 1.1532 ns
Unregistered 5.9.0 88.37 ns 0.8162 ns 0.7635 ns
Transient 4.0.1 906.03 ns 4.0031 ns 3.5487 ns
Transient 5.8.13 143.36 ns 1.7001 ns 1.5071 ns
Transient 5.9.0 96.90 ns 1.3002 ns 1.1526 ns
Mapping 4.0.1 776.70 ns 2.3000 ns 2.1514 ns
Mapping 5.8.13 141.33 ns 1.4194 ns 1.3278 ns
Mapping 5.9.0 122.58 ns 2.4451 ns 2.4014 ns
Array 4.0.1 8,725.32 ns 36.1246 ns 33.7909 ns
Array 5.8.13 642.21 ns 4.4079 ns 3.9075 ns
Array 5.9.0 605.97 ns 5.6593 ns 5.2937 ns
Enumerable 4.0.1 NA NA NA
Enumerable 5.8.13 739.89 ns 3.5254 ns 3.2977 ns
Enumerable 5.9.0 669.90 ns 5.6207 ns 4.6935 ns

New Features

Suggest new features or vote for the proposals you like, ADD your comments:

Feature Requests

Packages & Status

Unity library consists of multiple packages. For information about each package please follow the links


Package Build status NuGet
Unity (Composite) Build status NuGet
Unity.Abstractions Build status NuGet
Unity.Container Build status NuGet
Unity.Configuration Build status NuGet
Unity.Interception Build status NuGet
Unity.Interception.Configuration Build status NuGet
Unity.RegistrationByConvention Build status NuGet
Unity.log4net Build status NuGet
Unity.NLog Build status NuGet
Unity.Microsoft.Logging Build status NuGet
Unity.Microsoft.DependencyInjection Build status NuGet
Unity.AspNet.WebApi Build status NuGet
Unity.Mvc Build status NuGet
Unity.ServiceLocation Build status NuGet
CommonServiceLocator Build status NuGet

Roadmap

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 emphasis is on compatibility. Once stabilized, this version will enter LTS status and will be patched and fixed for the next few years. v5 minor releases may contain breaking changes, in preparation for v6. There will be no significant development in this line.

To build v5.x locally please follow these steps:

  • git clone https://github.com/unitycontainer/unity.git
  • cd unity && git checkout v5.x && git submodule update --init --recursive
  • open package.sln in Visual Studio and build.

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.

To build v6.x locally please follow these steps:

  • git clone https://github.com/unitycontainer/unity.git
  • cd unity && git checkout v6.x && git submodule update --init --recursive
  • open package.sln in Visual Studio and build.

Release schedule and Long Time Support (LTS) 1

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.

Issues and Contributions

  • 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

Any feedback and contributions are welcome

If you have something you'd like to improve do not hesitate to send a Pull Request