如何在Intellitrace事件中跟踪异步数据库操作? [英] How to trace async database operations in Intellitrace Events?
本文介绍了如何在Intellitrace事件中跟踪异步数据库操作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试查看使用 EntityFramework 的应用程序所做的一些查询。
在我的方法中,不是 async ,我可以正常看到查询:
Im trying to see some queries that my application using EntityFramework does. In my method wich is not async i can see the queries normally:
public List<Tool> GetTools()
{
return EntityContext.ToList();
}
但是,如果喜欢的话:
public Task<List<Tool>> GetTools(int quantity)
{
return EntityContext.Take(quantity).ToListAsync();
}
是否可以获取异步的查询>方法是否在 IntelliTrace 事件中?
Is it possible to get the queries of a async method in IntelliTrace Events?
谢谢。
推荐答案
使用EF,您可以轻松调试到输出窗口和命令行。这是我创建的快捷方法。
With EF you can debug to the output window and command line easy enough. Here is a shortcut method I created.
public void EnableDebugging()
{
Database.Log = s =>
{
Console.Write(s);//windows apps
Debug.Write(s);//website apps
};
}
这篇关于如何在Intellitrace事件中跟踪异步数据库操作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文