-
Notifications
You must be signed in to change notification settings - Fork 10
Home
Peter Csajtai edited this page Mar 2, 2017
·
33 revisions
Stashbox is a lightweight, portable dependency injection framework for .NET based solutions.
- Fluent interface - for faster and easier configuration, attributes also can be used.
- Interface/type mapping - single service, existing instance registration, remapping registrations also supported.
- Resolution via delegates - any number of parameters can be injected, they will be reused for subdenpendency resolution as well.
- Registering with name - multiple registration with the same service type, can be addressed at resolution time via attributes as well.
-
Multiple service resolution - all registered type of a service can be obtained as an
IEnumerable<T>
orIEnumerable<object>
with theResolveAll()
method. - Unknown type resolution - unregistered services can be resolved or injected.
- Default and optional value injection - primitive types or dependencies with default or optional value can be injected.
- Open generic type resolution - concrete generic types can be resolved from open generic definitions, constraint checking and nested generic definitions also supported.
- Constructor, property and field injection - supports attribute driven injection and attributeless injection as well, where there is no chance to decorate members with attributes.
-
Injection method - methods decorated with
InjectionMethod
attribute will be called at resolution time. - Wiring into container - member injection can be executed on existing instance with every resolve call.
- Building up existing instance - member injection can be executed on existing instance without registering it into the container.
- Child scopes - for managing scoped registrations.
-
Lifetime management - including
Singleton
,Transient
andScoped
lifetime, custom user defined lifetimes also can be used. - Conditional resolution - attribute, parent-type and custom user defined conditions can be specified.
-
IDisposable object tracking -
IDisposable
objects are being disposed by the container. - Circular dependency tracking - the container checks the dependency graph for circular dependencies, specific excpetion will be thrown if found any.
- Special types - generic wrappers:
- Collections: everything assignable to
IEnumerable<T>
e.g.T[]
,ICollection<T>
,IReadOnlyCollection<T>
,IList<T>
etc. -
Lazy<>
,Func<>
,Tuple<>
- Parameter injection over factory method arguments e.g.
Func<TParam, TService>
,Func<TParam1, TParam2, TService>
, etc. applied to subdependencies as well. - Nesting support e.g.
Tuple<TService, IEnumerable<Func<TParam, Lazy<TService1>>>>
. - Custom resolvers - the existing resolution operations can be extended by custom resolvers.
- Container extensions - the functionality of the container can be extended by custom extensions, e.g. Decorator extension
- Custom configuration - the behavior of the container can be controlled by custom configuration.
- Service registration
- Factory registration
- Assembly registration
- Composition
- Fluent registration api
- Service resolution
- Resolution by attributes
- Conventional resolution
- Delegate resolution
- Conditional resolution
- Multi resolution
- Lifetimes
- Generics
- Generic wrappers
- Decorators
- Resolvers
- Scopes
- Container configuration
- Container diagnostics
- Exceptions