Skip to content

jrjohn/Grace

 
 

Repository files navigation

Meet Grace

Grace is a feature rich Dependency Injection Container designed with ease of use and performance in mind.

   using Grace.DependencyInjection;

   DependencyInjectionContainer container = new DependencyInjectionContainer();

   container.Configure(c => c.Export<BasicService>().As<IBasicService>());

   IBasicService basicService = container.Locate<IBasicService>();

It's as easy as create, configure, and locate.

Getting Grace

NuGet package supports .Net 4.5, Windows Phone 8 and WinRT.

Visual Studio Templates are avaliable for creating new MVC 5, WCF, and Nancy applications

Documented Grace

Getting Started - A getting started guide for Grace as well as documentation for more complex topics

API Documentation - API document is hosted on NuDoq

Features in Grace

  • Fluent interface or Attributes for configuration allowing for maximum flexibility
  • Supports child containers and light weight lifetime scopes
  • Contextual binding support (similar to NInject)
  • IDisposable objects created by the container will be tracked and disposed by the container unless configured otherwise.
  • Performance characteristics that make it faster than most of the containers out there inluding Autofac, Castle Windsor, MEF, NInject, StructureMap and Unity. (Benchmarks)
  • Supports special types
    • IEnumerable<T> - supports resolving collections as IEnumerable<T> as well as most other types of collections List<T>, ReadOnlyCollection<T>, T[] and any collection that implements ICollection<T>
    • Func<T> - supports resolving Func<T> automatically
    • Lazy<T> - when resolved a Lazy<T> will be created that resolves T from the scope it was created in
    • Owned<T> - object resolved within a Owned<T> will have their disposal lifecycle tied to the Owned<T> (similar to autofac)
    • Meta<T> - objects resolved within a Meta<T> are resolved along with their metadata
    • Custom Delegates - any delegate that returns a type can be automatically resolved.
  • Many LifeStyles supported including Singleton, SingletonPerScope, SingletonPerRequest (MVC & WCF out of the box), SingletonPerAncestor<T>, WeakSingleton and more. If none of the provided life styles meet your need you can always implement your own ILifeStyle class.

Builds of Grace

Grace has public builds at CodeBetter

Nightly Build:

CI Build:

Metrics by Ohloh:

Ohloh project report for Grace IoC

About

Grace is a feature rich Dependency Injection container in a portable class library

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published