I develop a project that uses Castle Windsor WCF Integration Facility as DDD architecture. There are a single container project, single domain project, several implementation projects and an executable console. Dependency tree can be shown like below:
Console(exe) -> Container(windsor) -> { Implementations -> DomainInterfaces }
Console project invokes Container.Bootstrapper.Initialize() and castle installers search this assembly in this method. In debug mode, it works successfully, windsor loads all dependencies and creates WCF service. When cursor enters into Initialize, I can see newly loaded modules in Modules window.
Dependency installation code is shown below:
public void Install(IWindsorContainer container, IConfigurationStore store)
{
container = new WindsorContainer().AddFacility<WcfFacility>()
.Register
(
Component.For<IDataProvider>().Instance(new DataProvider(s_DataConfigurationElement)).LifeStyle.Singleton,
Component.For<IUserRepository>().ImplementedBy<UserRepository>().LifeStyle.Singleton,
Component.For<IDomainManager>().ImplementedBy<DomainManager>().LifeStyle.Singleton,
Component.For<IGateway>().ImplementedBy<Gateway>().LifeStyle.PerThread.AsWcfService()
);
}
Problem is in release mode. I could't set breakpoint to this method and installers couldn't work, so nothing was loaded in Modules Window. In release mode, it works only if code optimization is unchecked and full-pdb debug info is checked in the project options of Console project. Is this a known issue or bug?
Thanks in advance.
You should never reassign
container
parameter in installer class. It is mystery for me, why it worked inDEBUG
mode.Try this instead: