DryIoc is fast, small, full-featured IoC Container for .NET
Switch branches/tags
Nothing to show
Clone or download
Permalink
Failed to load latest commit information.
.nuget replacing old solutions by sdk csproj solution Oct 10, 2018
BuildScripts changed: Always reset DevMode in build.bat Oct 15, 2018
docs/DryIoc.Docs fixed: #50 and interception example both in tests and docs Nov 15, 2018
logo replacing old solutions by sdk csproj solution Oct 10, 2018
nuspecs wip: adding FEC v2.0 Nov 14, 2018
playground wip: adding FEC v2.0 Nov 14, 2018
samples replacing old solutions by sdk csproj solution Oct 10, 2018
src cleanup: Lambdas usages in Expression.cs Nov 15, 2018
test fixed: #50 and interception example both in tests and docs Nov 15, 2018
.editorconfig full-fledged .editorconfig Sep 17, 2018
.gitignore fixed: gitignore Oct 4, 2018
CONTRIBUTING.md skipci removed junk file Oct 10, 2018
Directory.Build.props playground benchmarks are working agaim, added couple of new results Nov 8, 2018
DryIoc.sln added: Plaground project back to solution Nov 8, 2018
DryIoc.sln.DotSettings removed: DryIoc.WebApi.UnitTests from solution as it causing a "Illeg… Nov 3, 2018
DryIoc.snk replacing old solutions by sdk csproj solution Oct 10, 2018
DryIoc.v3.ncrunchsolution wip: added ScopeTools Oct 18, 2018
LICENSE.txt replacing old solutions by sdk csproj solution Oct 10, 2018
NuGet.Config replacing old solutions by sdk csproj solution Oct 10, 2018
README.md skip fixed logo path in readme Oct 10, 2018
appveyor.yml skipci removed junk file Oct 10, 2018
build.bat changed: Doing packaging during build - simplifies the build.bat Nov 8, 2018

README.md

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

logo

Build status SOQnA Gitter Slack Follow on Twitter

Benchmarks

Performance

  • General use-cases optimized for max speed.
  • Memory footprint preserved as small as possible.

Code

  • No dependencies on the other libraries.
  • Public API is fully documented.

Reliability

  • 1000+ of acceptance tests.
  • Thread-safe and lock-free registrations and resolutions.
  • Detects recursive dependencies aka 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

  • Register interface/type mapping, additionally supported: registering service once, registration update, removing registration.
  • Register user-defined delegate factory and register existing instance.
  • Register implementation types from provided assemblies with automatically determined service types.
  • Register with service key of arbitrary type, or register multiple non-keyed services.
  • Register with resolution condition.
  • Register with associated metadata object of arbitrary type.
  • Resolve and ResolveMany.
  • Unknown service resolution:
    • Optional automatic concrete types resolution
  • Instance lifetime control or Reuse in DryIoc terms:
    • Nested disposable scopes with optional names
    • Ambient scope context
    • Supported out-of-the-box: Transient, Singleton, Scoped in multiple flavors, including scoped to specific service in object graph
    • useParentReuse and use useDecorateeReuse option for injected dependencies
    • Control reused objects behavior with preventDisposal and weaklyReferenced.
  • Extensive Open-generics support: constraints, variance, complex nested, recurring generic definitions
  • Constructor, and optional property and field injection.
  • Static and Instance factory methods in addition to constructor. Factory method supports parameter injection the same way as constructor!
  • Injecting properties and fields into existing object.
  • Creating concrete object without registering it in Container but with injecting its parameters, properties, and fields.
  • Generic wrappers:
    • Service collections: T[], IEnumerable<T>, LazyEnumerable<T>, and I(ReadOnly)Collection|List<T>.
    • Other: Lazy<T>, Func<T>, Meta<TMetadata, T> or Tuple<TMetadata, T>, KeyValuePair<TKey, T>, and user-defined wrappers.
    • Currying over constructor (or factory method) arguments: Func<TArg, T>, Func<TArg1, TArg2, T>, etc.
    • Nested wrappers: e.g. Tuple<SomeMetadata, Func<ISomeService>>[].
  • Composite pattern: Composite itself is excluded from result collection.
  • Decorator pattern.

Companions

DryIocAttributes

DryIocAttributes.dll NuGet Badge
DryIocAttributes (sources) NuGet Badge

  • Extends MEF attributes to cover DryIoc features: metadata, advanced reuses, context based registration, decorators, etc.
  • Does not depend on DryIoc and may be used by other IoC libraries.

DryIocZero

DryIocZero NuGet Badge

Slim IoC Container based on service factory delegates generated at compile-time by DryIoc.

  • Does not depend on DryIoc at run-time.
  • Ensures zero application bootstrapping time associated with IoC registrations.
  • Provides verification of DryIoc registration setup at compile-time by generating service factory delegates. Basically you can see how DryIoc is creating things.
  • Supports everything registered in DryIoc: reuses, decorators, wrappers, etc.
  • Much smaller and simpler than DryIoc itself. Works standalone without any run-time dependencies.
  • Allows run-time registrations too. You may register instances and delegates at run-time.

Extensions


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