本文整理汇总了C#中BehaviorChain.OfType方法的典型用法代码示例。如果您正苦于以下问题:C# BehaviorChain.OfType方法的具体用法?C# BehaviorChain.OfType怎么用?C# BehaviorChain.OfType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BehaviorChain
的用法示例。
在下文中一共展示了BehaviorChain.OfType方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ExemptedFromAuthentication
public static bool ExemptedFromAuthentication(BehaviorChain chain)
{
if (chain.InputType() != null && chain.InputType().HasAttribute<NotAuthenticatedAttribute>()) return true;
if (chain.OfType<ActionCall>().Any(x => x.HasAttribute<NotAuthenticatedAttribute>())) return true;
// TODO -- Come up with a better way of doing this
if (chain.OfType<ActionCall>().Any(x => x.HandlerType.Name == "AssetWriter")) return true;
return false;
}
示例2: IsSagaChain
public static bool IsSagaChain(BehaviorChain chain)
{
if (chain is HandlerChain)
{
return chain.OfType<HandlerCall>().Any(IsSagaHandler);
}
return false;
}
示例3: alter_chain_with_more_overridden_vary_by
public void alter_chain_with_more_overridden_vary_by()
{
var chain = new BehaviorChain();
var call = ActionCall.For<CacheAttributeTester>(x => x.alter_chain_with_more_overridden_vary_by());
chain.AddToEnd(call);
call.As<IModifiesChain>().Modify(chain);
chain.OfType<OutputCachingNode>().Single().VaryByPolicies()
.ShouldHaveTheSameElementsAs(typeof (VaryByResource), typeof (VaryByThreadCulture));
}
示例4: alter_chain
public void alter_chain()
{
var chain = new BehaviorChain();
var call = ActionCall.For<CacheAttributeTester>(x => x.alter_chain());
chain.AddToEnd(call);
call.As<IModifiesChain>().Modify(chain);
chain.OfType<OutputCachingNode>().Single()
.VaryByPolicies().Single().ShouldEqual(typeof (VaryByResource));
}
示例5: Modify
public static void Modify(BehaviorChain chain)
{
// Not everything is hard
chain.Output.Remove();
if (chain.OfType<InputNode>().Any())
{
chain.Input.AddAfter(chain.Output);
}
else
{
chain.FirstCall().AddBefore(chain.Output);
}
}
示例6: Alter
public void Alter(BehaviorChain chain)
{
var node = chain.OfType<OutputCachingNode>().FirstOrDefault();
if (node == null)
{
node = new OutputCachingNode();
chain.AddToEnd(node);
}
if (_varyBy != null)
{
node.ReplaceVaryByRules(_varyBy);
}
}
示例7: Modify
public static void Modify(BehaviorChain chain)
{
if (chain.OfType<OutputCachingNode>().Any()) return;
chain.AddToEnd(new OutputCachingNode());
}