【发布时间】:2010-06-23 12:03:16
【问题描述】:
您知道使用 EntLib 的 Unity 及其拦截机制测量方法执行时间的模式吗?
【问题讨论】:
标签: profiling unity-container aop
您知道使用 EntLib 的 Unity 及其拦截机制测量方法执行时间的模式吗?
【问题讨论】:
标签: profiling unity-container aop
您可以像下面这样创建ICallHandler(或在Unity 2.0 中非常相似的IInterceptionBehavior)实现并将其添加到对象的执行时间线中
public class MeasurementHandler : ICallHandler
{
public IMethodReturn Invoke(IMethodInvocation input,
GetNextHandlerDelegate getNext)
{
StartTimer(); // implement it :)
IMethodReturn msg = getNext()(input, getNext);
StopTimer(); // implement it :)
return msg;
}
}
【讨论】: