我试图查看我的应用程序使用 EntityFramework 执行的一些查询。 在我的方法中, async 我可以正常查看查询:
public List<Tool> GetTools()
{
return EntityContext.ToList();
}
但如果它像:
public Task<List<Tool>> GetTools(int quantity)
{
return EntityContext.Take(quantity).ToListAsync();
}
是否可以在 IntelliTrace 事件中获取 async 方法的查询?
感谢。
答案 0 :(得分:4)
IntelliTrace目前不支持异步ADO.NET事件。请在此处投票赞成此功能:http://visualstudio.uservoice.com/forums/121579-visual-studio-2015/suggestions/11356578-add-intellitrace-support-for-async-ado-net-events
答案 1 :(得分:1)
使用EF,您可以轻松调试到输出窗口和命令行。这是我创建的快捷方法。
public void EnableDebugging()
{
Database.Log = s =>
{
Console.Write(s);//windows apps
Debug.Write(s);//website apps
};
}