zoukankan      html  css  js  c++  java
  • VisualStudio代码调试输出跟踪

    class EFIntercepterLogging : DbCommandInterceptor
        {
            private readonly Stopwatch _stopwatch = new Stopwatch();
            public override void ScalarExecuting(System.Data.Common.DbCommand command, DbCommandInterceptionContext<object> interceptionContext)
            {
                base.ScalarExecuting(command, interceptionContext);
                _stopwatch.Restart();
            }
            public override void ScalarExecuted(System.Data.Common.DbCommand command, DbCommandInterceptionContext<object> interceptionContext)
            {
                _stopwatch.Stop();
                if (interceptionContext.Exception != null)
                {
                     Trace.TraceError ("Exception:{1} 
     --> Error executing command: {0}", command.CommandText, interceptionContext.Exception.ToString());
                }
                else
                {
                    Trace.TraceInformation("
    执行时间:{0} 毫秒
    -->ScalarExecuted.Command:{1}
    ", _stopwatch.ElapsedMilliseconds, command.CommandText);
                }
                base.ScalarExecuted(command, interceptionContext);
            }
    }
    

      

  • 相关阅读:
    【算法】八皇后问题 Python实现
    【算法】摩尔投票
    【数据结构】 二叉树
    【Manacher算法】最长子回文串
    缓存 和 数据库 数据一致性
    python网络编程
    python网络编程
    python
    算法
    Docker使用
  • 原文地址:https://www.cnblogs.com/x-poior/p/5257962.html
Copyright © 2011-2022 走看看