本文整理汇总了C#中BehaviorChain.Where方法的典型用法代码示例。如果您正苦于以下问题:C# BehaviorChain.Where方法的具体用法?C# BehaviorChain.Where怎么用?C# BehaviorChain.Where使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BehaviorChain
的用法示例。
在下文中一共展示了BehaviorChain.Where方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BuildBehaviorAverages
private IEnumerable<AverageBehaviorModel> BuildBehaviorAverages(BehaviorChain chain)
{
AverageBehaviorModel previousNode = null;
var report = _cache.GetReport(chain.UniqueId);
var averages = chain
.Where(node =>
node.BehaviorType.AssemblyQualifiedName != null
&& !node.BehaviorType.AssemblyQualifiedName.StartsWith("FubuMVC.Instrumentation")
&& !node.BehaviorType.AssemblyQualifiedName.StartsWith("FubuMVC.Diagnostics"))
.Reverse()
.Select(node =>
{
var behavior = new AverageBehaviorModel
{
Id = node.UniqueId,
BehaviorType = Description.For(node).Title
};
if (report != null && report.Reports.Any())
{
report.Reports
.Each(log =>
{
var startStep = log.FindStep<BehaviorStart>(s => s.Correlation.Node.UniqueId == node.UniqueId);
var endStep = log.FindStep<BehaviorFinish>(s => s.Correlation.Node.UniqueId == node.UniqueId);
if (startStep != null && endStep != null)
{
var span = endStep.Log.Time - startStep.Log.Time;
behavior.HitCount++;
behavior.TotalExecutionTime += span.TotalMilliseconds;
}
});
behavior.ActualTotalExecutionTime += previousNode != null
? behavior.TotalExecutionTime - previousNode.TotalExecutionTime
: behavior.TotalExecutionTime;
previousNode = behavior;
}
return behavior;
});
return averages.Reverse();
}