我开发了一个使用 Castle Windsor WCF 集成设施作为 DDD 架构的项目。有一个容器项目、一个域项目、几个实现项目和一个可执行控制台。依赖树可以如下图所示:
控制台(exe)-> 容器(windsor)-> { 实现 -> 域接口 }
控制台项目调用 Container.Bootstrapper.Initialize() 并且城堡安装程序在此方法中搜索此程序集。在调试模式下,它工作成功,windsor 加载所有依赖项并创建 WCF 服务。当光标进入 Initialize 时,我可以在 Modules 窗口中看到新加载的模块。
依赖安装代码如下图:
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()
);
}
问题在于发布模式。我无法为此方法设置断点,安装程序也无法工作,因此模块窗口中没有加载任何内容。在发布模式下,只有在控制台项目的项目选项中未选中代码优化并选中完整pdb调试信息时才有效。这是一个已知问题还是错误?
提前致谢。