Skip to content

jgauffin/Griffin.Container

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Griffin.Container

Inversion of control container with (almost) zero configuration.

The container configuration is validated when the container is built, to make sure that all dependencies have been registered.

Support for .NET Standard 2.0 and .NET 4.5.2.

Typical setup:

  1. Add the [Component] attribute on your classes:
[Component]
public class MyService : IShoppingService
{
    public MyService(IShoppingRepository repos)
	{
	}
	
	// [...]
}

[Component]
public class SqlServerShoppingRepository : IShoppingRepository
{
    public SqlServerShoppingRepository()
	{
	}
	
	// [...]
}
  1. Register all decorated classes in the container:
var registrar = new ContainerRegistrar();
registrar.RegisterComponents(Lifetime.Scoped, Assembly.GetExecutingAssembly());

var container = registrar.Build();

Features

  • The usual =)
  • Configuration validation
  • Commands
  • Decorators
  • Interceptors
  • Modules
  • Domain events
  • Quick enough

Installation

Install using nuget:

  • Core: install-package griffin.container
  • MVC5: install-package griffin.container.mvc5
  • WCF: install-package griffin.container.wcf
  • WebApi v2: install-package griffin.container.webapi2

Documentation

Pull requests are welcome.