Bootstrap example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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