title: Why is using a CTE with Include in Entity Framework Core causing this error: "The Include operation is not supported when calling a stored procedure"
body: <p>I realise that this question is similar to <a href="https://stackoverflow.com/questions/47122425/error-when-using-fromsql-and-include-the-include-operation-is-not-supported-wh">this one</a>, however (what I feel is) a key difference is that on the surface my code does not involve a stored procedure.</p>
  
  <p>Essentially I am trying to do this:</p>
  
  <pre><code>FormattableString fs = $"My Statment";
  
  var x = _myEntitySet.FromSql(fs)
                  .Include(a =&gt; a.SubTable)
                  .Include(a =&gt; a.OtherTable)
                  .ToList();
  </code></pre>
  
  <p>What I find is that if my SQL query includes a CTE (common table expression) - even one as simple as this:</p>
  
  <pre><code>FormattableString fs = $"WITH CTE AS (SELECT 1 AS [Column1]) SELECT * From MyTable}";
  </code></pre>
  
  <p>I get the following error:</p>
  
  <blockquote>
    <p>The Include operation is not supported when calling a stored procedure.</p>
  </blockquote>
  
  <p>As I am not (knowingly) calling a stored procedure I find the error odd and was wondering why it is happening and if there is some way to work around it so that I can use <code>Include</code> with a SQL statement that includes one or more CTEs.</p>
  
  <p>I am using Entity Framework Core 2.0.</p>