Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Bootstrap example
public class Bootstrap : IDisposable
{
private readonly Lazy<IWindsorContainer> _container = new Lazy<IWindsorContainer>(() =>
{
var container = new WindsorContainer();
container.Install(FromAssembly.This());
container.Register(Component.For<IWindsorContainer>().Instance(container));
return container;
});
public IWindsorContainer Container
{
get { return _container.Value; }
}
public void AddFacility<TFacility>(Action<TFacility> onCreate) where TFacility : IFacility, new()
{
Container.AddFacility(onCreate);
}
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
protected virtual void Dispose(bool disposing)
{
if (disposing)
{
Container.Dispose();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment