I would like to use Castle Windsor for dependency injection for my solution consisting of the following projects:
Create and place Windsor installer classes (IWindsorInstaller interface implementations) in your class libraries, for example:
public class PostRepositoryInstaller: IWindsorInstaller
{
public void Install(IWindsorContainer container, IConfigurationStore store)
{
var allTypesFromBinDir = AllTypes
.FromAssemblyInDirectory(new AssemblyFilter(HttpRuntime.BinDirectory));
container.Register(allTypesFromBinDir
.BasedOn()
.WithService.FromInterface()
.Configure(c => c.LifeStyle.Transient));
}
}
Then in your Global.asax install your dependencies:
protected virtual void Application_Start()
{
new WindsorContainer().Install(FromAssembly.InDirectory(new AssemblyFilter(HttpRuntime.BinDirectory)));
}