Skip to content
Peter Csajtai edited this page Feb 11, 2016 · 33 revisions

Stashbox is a lightweight, portable dependency injection framework for .NET based solutions.

Features:

  • Fluent interface and attributes for easier configuration
  • Child container
  • Lifetime scopes
  • Conditional resolution
  • IDisposable object tracking
  • Special type resolution like IEnumerable, arrays, Lazy<T>, generics
  • Custom resolvers can be added
  • Can be extended by container extensions

Supported platforms:

  • .NET 4.5 and above
  • Windows 8/8.1/10
  • Windows Phone Silverlight 8/8.1
  • Windows Phone 8.1
  • Xamarin (Android/iOS/iOS Classic)

Sample usage

class Wulfgar : IBarbarian
{
    public Drizzt(IWeapon weapon)
    {
        //...
    }
}

container.RegisterType<IWeapon, AegisFang>();
container.RegisterType<IBarbarian, Wulfgar>();

var wulfgar = container.Resolve<IBarbarian>();