Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
D

DryIoc

> 数据库
Open source

DryIoc is fast, small, full-featured IoC Container for .NET

1.1K stars0 likes0 views
WebsiteGitHub

About

DryIoc is fast, small, full-featured IoC Container for .NET

DryIoc is fast, small, full-featured IoC Container for .NET

  • Designed for low-ceremony use, performance, and extensibility.

  • Targets: net45;netstandard2.0;netstandard2.1;net6.0;net8.0;net9.0

  • NuGet packages:

    • DryIoc.dll — includes Compile-time DI: on first dotnet build scaffolds T4 templates; run dotnet t4 to emit a reflection-free, AOT-friendly Container.Generated.cs. See samples/MinimalWeb for a working ASP.NET Minimal API example.

    • DryIoc (source code)

    • DryIoc.Internal (source code with public types made internal)

  • Release Notes :: Previous Versions

  • Pre-release .nupkg artifacts — download from the latest CI run (Windows job -> Artifacts -> packages)

  • Extensions and Companions

  • Live Documentation is created with CsToMd

  • Contribution guide

  • Two original parts of the DryIoc are now the separate projects: FastExpressionCompiler and ImTools

Benchmarks

Performance overview

Realistic scenario with the unit-of-work scope and object graph of 40 dependencies 4 levels deep

More details in #44 and #26.

The listed .MsDI packages are respective Microsoft.Extensions.DependencyInjection adapters

Cold start - Registering services then opening the scope and resolving the root scoped service (e.g. controller) for the first time

DryIoc 6.0.0 (.MsDI 8.0.0), MsDI 9.0.0, Grace 7.2.1 (.MsDI 7.1.0), Autofac 8.1.1 (.MsDI 10.0.0), Lamar 14.0.1

…

Older versions for the comparison

DryIoc 5.0.0 (.MsDI 6.0.0), MsDI 6.0.0, Grace 7.2.1 (.MsDI 7.1.0), Autofac 6.3.0 (.MsDI 7.2.0), Lamar 8.0.1

…

Hot run - Opening the scope and resolving the root scoped service for the Nth time

DryIoc 6.0.0 (.MsDI 8.0.0), MsDI 9.0.0, Grace 7.2.1 (.MsDI 7.1.0), Autofac 8.1.1 (.MsDI 10.0.0), Lamar 14.0.1

…

Older versions for the comparison

DryIoc 5.0.0 (.MsDI 6.0.0), MsDI 6.0.0, Grace 7.2.1 (.MsDI 7.1.0), Autofac 6.3.0 (.MsDI 7.2.0), Lamar 8.0.1

…

Reliability

  • More than 2000 of test cases covered.
  • Thread-safe and lock-free registrations and resolutions.
  • Detects recursive dependencies (cycles) in object graph.
  • Throws exceptions as early as possible with a lot of details.
  • Provides diagnostics for potential resolution problems via container.Validate().

Features

Incomplete feature list

  • Registration of service to implementation type mapping (additionally supported: registering once, registration replace, registration removal).
  • Registration of delegate factory and already created service instance.
  • Batch registration of types from the provided assemblies.
  • Registration identified with a service key of arbitrary type and registration of multiple non-keyed implementations for a single service.
  • Registration with the condition depending on context.
  • Registration with the associated metadata object of arbitrary type.
  • Resolve and ResolveMany.
  • Service lifetime control via Reuse and lifetime scoping:
    • Nested disposable scopes with optional names
    • Optional ambient scope context
    • Reuse types: Transient, Singleton, Scoped in multiple flavors including the scoping to the specific service ancestor in the object graph
    • Option to useParentReuse and to useDecorateeReuse (for decorators)
    • Option to preventDisposal and weaklyReferenced
  • Open-generics support including type constraints, variance, complex nesting and recurring definitions.
  • Constructor parameters injection and optional property and field injection.
  • Static and instance factory methods with the parameter injection similar to the constructor parameter injection.
  • Injection of properties and fields into the existing object.
  • Decorators:
    • Nested with the relative order control
    • Generic and non-generic
    • With the Reuse possibly different from the decorated service
    • Decorators of the Wrappers
  • Wrappers:
    • Service collections: T[], IEnumerable, LazyEnumerable, and I(ReadOnly)Collection|List
    • Single service wrappers: Lazy, Func, Meta or Tuple, KeyValuePair
    • Currying of constructor or factory method parameters with Func, Func, etc
    • Nested wrappers: e.g. Tuple[]
    • User-defined wrappers
    • Composite
  • User-provided strategies for resolution of unknown service.
    • Dynamic registration providers
    • Optional automatic concrete types resolution

Resolution options

DryIoc implements a service resolution and injection via expression compilation and interpretation. The interpretation is the only option for the target platforms without the System.Reflection.Emit like the Xamarin iOS. Check the Resolution Pipeline document for more details.


Icon made by Freepik from www.flaticon.com is licensed by CC 3.0 BY

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

C#dependency-injectiondi-ioc-containerdryiocinversion-of-control

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category数据库
PricingOpen source

> Related tools

P
PostgreSQL
功能强大的开源关系型数据库
R
Redis
内存数据结构存储,常用作缓存与队列
M
MySQL
广泛使用的开源关系型数据库