【发布时间】:2013-12-05 05:43:00
【问题描述】:
在 Windsor 2.1 中,当代码在 wcf 上下文中执行时,我有以下代码可以将所有服务的生活方式更改为 PerWcfOperation:
container.Kernel.ComponentModelBuilder.AddContributor(
new CustomLifestyleLevelingContributeComponentModelConstruction(typeof (PerWcfOperationLifestyle))
CustomLifestyleLevelingContributeComponentModelConstruction 在哪里:
public class CustomLifestyleLevelingContributeComponentModelConstruction : IContributeComponentModelConstruction
{
private readonly Type customLifestyleType;
private readonly List<LifestyleType> ignoredLifetyles;
public CustomLifestyleLevelingContributeComponentModelConstruction(Type customLifestyleType)
{
this.customLifestyleType = customLifestyleType;
}
public void ProcessModel(IKernel kernel, ComponentModel model)
{
model.LifestyleType = LifestyleType.Custom;
model.CustomLifestyle = customLifestyleType;
}
}
我的问题是 class PerWcfOperationLifestyle 已从 Windsor 3.0 中删除。谁能告诉我如何使用 Windsor 3.x 实现相同的目标?
【问题讨论】:
-
你有没有想过这个问题?我正在尝试做同样的事情。
-
是的,我刚刚为那些需要做同样事情的人添加了一个答案:)
标签: wcf castle-windsor windsor-3.0 windsor-facilities