All Projects → Barsonax → Singularity

Barsonax / Singularity

Licence: lgpl-3.0
A extremely fast ioc container for high performance applications

Programming Languages

csharp
926 projects

Projects that are alternatives of or similar to Singularity

vesselize
⛵ A JavaScript IoC container that works seamlessly with Vue.js and React.
Stars: ✭ 22 (-65.08%)
Mutual labels:  ioc, dependency-injection, inversion-of-control, ioc-container, di
Typhoon
Powerful dependency injection for Objective-C ✨✨ (https://PILGRIM.PH is the pure Swift successor to Typhoon!!)✨✨
Stars: ✭ 2,711 (+4203.17%)
Mutual labels:  dependency-injection, ioc, ioc-container, inversion-of-control, di
diod
A very opinionated inversion of control (IoC) container and dependency injector for Typescript, Node.js or browser apps.
Stars: ✭ 36 (-42.86%)
Mutual labels:  ioc, dependency-injection, inversion-of-control, di
waiter
Dependency injection, Inversion of control container for rust with compile time binding.
Stars: ✭ 71 (+12.7%)
Mutual labels:  ioc, dependency-injection, inversion-of-control, di
ThunderboltIoc
One of the very first IoC frameworks for .Net that has no reflection. An IoC that casts its services before thunder casts its bolts.
Stars: ✭ 40 (-36.51%)
Mutual labels:  ioc, dependency-injection, inversion-of-control, ioc-container
DotNetDynamicInjector
💉 Dynamically reference external dlls without the need to add them to the project. Leave your project with low dependency and allowing specific dlls according to your business rule or database parameters.
Stars: ✭ 18 (-71.43%)
Mutual labels:  dependency-injection, netcore, net, netstandard
stashbox
A lightweight, fast, and portable dependency injection framework for .NET-based solutions.
Stars: ✭ 120 (+90.48%)
Mutual labels:  ioc, dependency-injection, inversion-of-control, di
iocgo
A lightweight Inversion of Control (IoC) (Dependency Injection) container for Golang
Stars: ✭ 36 (-42.86%)
Mutual labels:  ioc, dependency-injection, inversion-of-control, ioc-container
inject
[Archived] See https://github.com/goava/di.
Stars: ✭ 49 (-22.22%)
Mutual labels:  ioc, dependency-injection, ioc-container, di
Autofac
An addictive .NET IoC container
Stars: ✭ 3,713 (+5793.65%)
Mutual labels:  netstandard, netcore, dependency-injection, ioc-container
Ditranquillity
Dependency injection for iOS (Swift)
Stars: ✭ 317 (+403.17%)
Mutual labels:  dependency-injection, ioc, inversion-of-control, di
Ioc
🦄 lightweight (<1kb) inversion of control javascript library for dependency injection written in typescript
Stars: ✭ 171 (+171.43%)
Mutual labels:  dependency-injection, ioc, ioc-container, inversion-of-control
React Ioc
Hierarchical Dependency Injection with new React 16 Context API
Stars: ✭ 133 (+111.11%)
Mutual labels:  dependency-injection, ioc, ioc-container, inversion-of-control
Container Ioc
Inversion of Control container & Dependency Injection for Javascript and Node.js apps powered by Typescript.
Stars: ✭ 89 (+41.27%)
Mutual labels:  dependency-injection, ioc, inversion-of-control, di
Kangaru
🦘 A dependency injection container for C++11, C++14 and later
Stars: ✭ 297 (+371.43%)
Mutual labels:  dependency-injection, ioc, ioc-container, inversion-of-control
Reflex
Minimal dependency injection framework for Unity
Stars: ✭ 263 (+317.46%)
Mutual labels:  ioc, dependency-injection, ioc-container, di
di
🛠 A full-featured dependency injection container for go programming language.
Stars: ✭ 156 (+147.62%)
Mutual labels:  ioc, dependency-injection, ioc-container, di
Dryioc
DryIoc is fast, small, full-featured IoC Container for .NET
Stars: ✭ 555 (+780.95%)
Mutual labels:  netstandard, netcore, dependency-injection, inversion-of-control
Go Spring
基于 IoC 的 Go 后端一站式开发框架 🚀
Stars: ✭ 744 (+1080.95%)
Mutual labels:  dependency-injection, ioc, inversion-of-control
Poodinis
A dependency injection framework for D with support for autowiring.
Stars: ✭ 57 (-9.52%)
Mutual labels:  dependency-injection, ioc, ioc-container

Singularity

Discord NuGet Badge Build Status Azure DevOps tests (branch) Maintainability Rating Reliability Rating Security Rating coverage Beerpay

Features

  • Extreme performance, Singularity is one of the fastest if not the fastest dependency injection container out there. Don't believe me? Check out my benchmarks or if you want a second opinion check out the benchmarks that Daniel Palme made here.
  • Clean fluent API.
  • Source Link enabled
  • Generic wrappers:
    1. Func<T>
    2. Lazy<T>
    3. Expression<Func<T>>
    4. And any other generic wrapper you may have defined yourself.
  • Collection support:
    1. IEnumerable<T>
    2. IReadOnlyCollection<T>
    3. IReadOnlyList<T>
    4. T[]
    5. List<T>
    6. ICollection<T>
    7. IList<T>
    8. HashSet<T>
    9. ISet<T>
  • Supports open generics.
  • Supports resolving unregistered concrete types.
  • Supports decorators.
  • Supports method and property injection without forcing you to litter attributes all over your code base. All configuration is kept inside the container.
  • Supports dynamically picking the most suitable constructor based on the available types that can be resolved.
  • Auto dispose, this is off by default but can be turned on with With(DisposeBehavior)or adding the lifetimes you want to auto dispose to SingularitySettings.AutoDisposeLifetimes.
  • Custom finalizers with the WithFinalizer(Action<TInstance>) method.
  • Supports Transient, Singleton and Scope lifetimes.
  • Supports child containers.
  • Supports best fit constructor selection
  • Clear error messages and fail fast to point you in the right direction as fast as possible.

Getting started

Installation

Singularity can be installed through nuget. The packages that are available can be found in the nuget section

A simple example

Its easy to setup a container and request a instance:

var container = new Container(builder =>
{
    builder.Register<ITestService10, TestService10>();
});

var instance = container.GetInstance<ITestService10>();

However Singularity can do much more than this simple example. You can request the instance with different wrapper types such as Lazy<T>:

var lazyInstance = container.GetInstance<Lazy<ITestService10>>();

Or you can request the factory to create the instance:

var factory = container.GetInstance<Func<ITestService10>>();

You can even request the expression itself:

var instanceExpression = container.GetInstance<Expression<Func<ITestService10>>>();

Ofcourse its possible to combine these with for instance a collection type such as IEnumerable or IReadOnlyList:

var instanceExpressions = container.GetInstance<IReadOnlyList<Expression<Func<IPlugin>>>>(); //Returns all expressions for IPlugin registrations

Advanced scenarios such as open generics are also supported.

Documentation

More info about Singularity can be found on the documentation website which can be found here.

Other

Benchmarks

The code used in the benchmark can be found here

BenchmarkDotNet=v0.12.0, OS=Windows 10.0.18363
AMD Ryzen 9 3900X, 1 CPU, 24 logical and 12 physical cores
.NET Core SDK=3.1.200
  [Host]       : .NET Core 3.1.2 (CoreCLR 4.700.20.6602, CoreFX 4.700.20.6702), X64 RyuJIT
  LegacyJitX64 : .NET Framework 4.8 (4.8.4150.0), X64 RyuJIT
  RyuJitX64    : .NET Core 2.1.16 (CoreCLR 4.6.28516.03, CoreFX 4.6.28516.10), X64 RyuJIT

Platform=X64  IterationTime=1.0000 s

|    Method |          Job |       Jit |       Runtime |          Mean |       Error |      StdDev |  Gen 0 |  Gen 1 | Gen 2 | Allocated |
|---------- |------------- |---------- |-------------- |--------------:|------------:|------------:|-------:|-------:|------:|----------:|
| Singleton | LegacyJitX64 | LegacyJit |    .NET 4.7.2 |     10.539 ns |   0.1156 ns |   0.1082 ns |      - |      - |     - |         - |
| Transient | LegacyJitX64 | LegacyJit |    .NET 4.7.2 |     15.095 ns |   0.0562 ns |   0.0525 ns | 0.0145 |      - |     - |      24 B |
|  Combined | LegacyJitX64 | LegacyJit |    .NET 4.7.2 |     20.722 ns |   0.0707 ns |   0.0552 ns | 0.0338 |      - |     - |      56 B |
|   Complex | LegacyJitX64 | LegacyJit |    .NET 4.7.2 |     27.218 ns |   0.2894 ns |   0.2566 ns | 0.0580 |      - |     - |      96 B |
| Singleton |    RyuJitX64 |    RyuJit | .NET Core 2.1 |      9.569 ns |   0.0634 ns |   0.0593 ns |      - |      - |     - |         - |
| Transient |    RyuJitX64 |    RyuJit | .NET Core 2.1 |     14.755 ns |   0.1025 ns |   0.0959 ns | 0.0145 |      - |     - |      24 B |
|  Combined |    RyuJitX64 |    RyuJit | .NET Core 2.1 |     22.506 ns |   0.3656 ns |   0.3420 ns | 0.0337 |      - |     - |      56 B |
|   Complex |    RyuJitX64 |    RyuJit | .NET Core 2.1 |     26.756 ns |   0.3521 ns |   0.3294 ns | 0.0578 |      - |     - |      96 B |
| Singleton |    RyuJitX64 |    RyuJit | .NET Core 3.1 |     12.167 ns |   0.1213 ns |   0.1135 ns |      - |      - |     - |         - |
| Transient |    RyuJitX64 |    RyuJit | .NET Core 3.1 |     14.461 ns |   0.0698 ns |   0.0653 ns | 0.0029 |      - |     - |      24 B |
|  Combined |    RyuJitX64 |    RyuJit | .NET Core 3.1 |     20.933 ns |   0.2406 ns |   0.2251 ns | 0.0067 |      - |     - |      56 B |
|   Complex |    RyuJitX64 |    RyuJit | .NET Core 3.1 |     24.196 ns |   0.1059 ns |   0.0991 ns | 0.0115 |      - |     - |      96 B |

Nuget

Library Version
Singularity NuGet Badge
Singularity.Duality.core NuGet Badge
Singularity.Microsoft.DependencyInjection NuGet Badge
Singularity.AspNetCore.Hosting NuGet Badge
Singularity.AspNetCore.MVC NuGet Badge

Random info

GitHub repo size GitHub code size in bytes Lines of Code Duplicated Lines (%)

Build History

Donations

Paypal
paypal

Licensing

Licensed under LGPL.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].