SQL Server Profiler用来跟踪应用程序发送到SQL Server中的SQL语句,用于检测性能,查找问题。Entity Framework 也有它的跟踪工具EFProf,用于跟踪Entity Framework发送到Server中的SQL语句。

首先在代码中添加对程序集HibernatingRhinos.Profiler.Appender的引用,并添加如下方法

HibernatingRhinos.Profiler.Appender.EntityFramework.EntityFrameworkProfiler.Initialize();·

再打开EFProf程序,即可看到基于Entity Framework的程序向SQL Server发送的SQL语句

EFProf用法
EFProf用法

可以按星标查询
EFProf用法

 using (HibernatingRhinos.Profiler.Appender.ProfilerIntegration.StarStatements("Yellow"))
{  

}

相关文章:

  • 2021-10-23
  • 2021-07-11
  • 2022-12-23
  • 2022-12-23
  • 2021-10-27
  • 2021-08-07
  • 2022-02-28
猜你喜欢
  • 2022-02-06
  • 2021-12-28
  • 2022-03-10
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案