Skip to content

Instantly share code, notes, and snippets.

@reharik
Created October 11, 2012 17:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save reharik/3874191 to your computer and use it in GitHub Desktop.
Save reharik/3874191 to your computer and use it in GitHub Desktop.
different ioc configs
==============================
private void Start()
{
var container = new WindsorContainer();
ServiceLocator.SetLocatorProvider(() => new WindsorServiceLocator(container));
container.Install(
new HLCCommonInstaller(),
new DataAccessInstaller(),
new WebUIInstaller(),
new HLCBusinessLogicInstaller()
);
}
AND
public class HLCCommonInstaller : IWindsorInstaller
{
public void Install(IWindsorContainer container, IConfigurationStore store)
{
container.Register(AllTypes
.FromAssemblyContaining<ThreadUserSessionManagement>()
.Where(type => type.IsPublic)
.WithService.FirstInterface()
.Configure(req => req.LifeStyle.Transient));
container.Register(Component.For<IWebStateProvider>().ImplementedBy<WebState>().LifeStyle.Singleton);
}
}
=====================
OR
=====================
private void Start()
{
var container = new WindsorContainer();
ServiceLocator.SetLocatorProvider(() => new WindsorServiceLocator(container));
container.Install(
new DataAccessInstaller(),
new WebUIInstaller(),
);
container.Register(AllTypes.FromAssemblyContaining<ThreadUserSessionManagement>().Where(type => type.IsPublic).WithService.FirstInterface().Configure(req => req.LifeStyle.Transient));
container.Register(AllTypes.FromAssemblyContaining<JobDescriptionDataService>().Where(type => type.IsPublic).WithService.FirstInterface().Configure(req => req.LifeStyle.Transient));
}
=====================
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment