How to track async database operations in Intellitrace events?

I am trying to see some requests that my application makes with EntityFramework . In my method, which is not async , I can see requests normally:

   public List<Tool> GetTools()
   {
        return EntityContext.ToList();
   }

enter image description here

But if it looks like:

  public Task<List<Tool>> GetTools(int quantity)
  {
        return EntityContext.Take(quantity).ToListAsync();
  }

Can I get async method requests in IntelliTrace Events?

Thanks.

+4
source share
2 answers

With EF, you can easily debug the output window and command line. Here is the quick access method I created.

    public void EnableDebugging()
    {
        Database.Log = s =>
                       {
                           Console.Write(s);//windows apps
                           Debug.Write(s);//website apps
                       };
    }
+1
source

Source: https://habr.com/ru/post/1623130/


All Articles