如何使用PerWcfOperation生活方式在Castle Windsor 3.0中注册组件?我只能找到在代码中注册组件的示例。
这是我的配置:
<castle>
<facilities>
<facility id="wcf"
type="Castle.Facilities.WcfIntegration.WcfFacility, Castle.Facilities.WcfIntegration" />
</facilities>
<components>
<component id="Settings"
service="SomeNamespace.IApplicationSettings, SomeAssembly"
type="SomeOtherNamespace.ApplicationSettings, SomeOtherAssembly"
lifestyle="PerWcfOperation" />
</components>
</castle>
当我尝试在上面的配置中执行它时,我得到ConvertException'无法从'PerWcfOperation'转换为Castle.Core.LifestyleType。'
答案 0 :(得分:0)
它不受支持,因为XML配置被认为是遗留的。
请在代码中使用配置。
XML和代码通常大部分是等价的(尽可能这样)虽然这种情况是个例外 - 目前还没有开箱即用的方法来指定XML中的范围生活方式(这就是每个wcf操作生活方式)。
显然,这并不意味着没有办法让这个工作。使用简单的IContributeComponentModelConstruction
,您可以在少数LOC中实现对它的支持。