title: Get SQL code from an Entity Framework Core IQueryable<T>
body: <p>I am using Entity Framework Core and I need to see which SQL code is being generated. In previous versions of Entity Framework I could use the following:</p>
  
  <pre class="lang-cs prettyprint-override"><code>string sql = ((System.Data.Objects.ObjectQuery)query).ToTraceString();
  </code></pre>
  
  <p>Where query is an IQueryable object ... But ToTraceString is not available in EF Core.</p>
  
  <p>How can I do something similar in EF Core?</p>