title: Entity Framework - inspect foreach/update query
body: <p>I have the following query:</p>
  
  <pre><code>db.Context.SomeTable
      .Where(x =&gt; x.abc == someAbc &amp;&amp; x.zyx == someZyx)
      .ForEach(y =&gt;
      {
          y.AuditId = newAuditId;
          y.TimeStamp = newTimestamp;
      });
  </code></pre>
  
  <p>I would like to get the actual SQL query out of the <code>ForEach</code> statement.</p>
  
  <p>If I do just the following:</p>
  
  <pre><code>var selectQuery = db.Context.SomeTable
          .Where(x =&gt; x.abc == someAbc &amp;&amp; x.zyx == someZyx);
  </code></pre>
  
  <p>I can get the following query from selectQuery variable:</p>
  
  <pre><code>SELECT 
      [Extent1].[abc] AS [abc], 
      [Extent1].[zyx] AS [zyx] 
      --skipping some [Extent1]. statements for simplicity here
  FROM 
      [dbo].[SomeTable] AS [Extent1]
  WHERE 
      ([Extent1].[abc] = @p__linq__0) AND ([Extent1].[zyx] = @p__linq__1)
  </code></pre>
  
  <p>Which I can then run outside of Visual Studio, analyze the performance of it, etc.</p>
  
  <p>How would I do this for the <code>ForEach</code> statement?</p>