EFProf用法

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语句


可以按星标查询

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

}
posted @ 2019-08-29 10:10  【唐】三三  阅读(227)  评论(0编辑  收藏  举报