title: How to execute SqlQuery with Entity Framework Core 2.1?
body: <p>In Entity Framework 6, I can execute a raw SQL query on the database using the following command:</p>
  
  <pre><code>IEnumerable&lt;string&gt; Contact.Database.SqlQuery&lt;string&gt;("SELECT a.title FROM a JOIN b ON b.Id = a.aId WHERE b.Status = 10");
  </code></pre>
  
  <p>On a new project, I am trying to use Entity Framework Core 2.1. I have a need to execute raw SQL query. While googling, I can see that the extension <code>SqlQuery</code> was changed to <code>FromSql</code>. However, <code>FromSql</code> only exists on the <code>DbSet&lt;&gt;</code> not on the <code>DbContext.Database</code>.</p>
  
  <p>How can I run <code>FromSql</code> outside the <code>DbSet&lt;&gt;</code>? The method <code>FromSql</code> does not exists on the database object <code>DbContext.Database.FromSql&lt;&gt;</code>.</p>