Created
October 11, 2012 17:40
-
-
Save reharik/3874191 to your computer and use it in GitHub Desktop.
different ioc configs
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
============================== | |
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