# C1.Data.DataExtensions.ExecuteIn

## Content

<div class="doc-site-dotnet-api-container">



<h1 id="C1_Data_DataExtensions_ExecuteIn_" data-uid="C1.Data.DataExtensions.ExecuteIn*">ExecuteIn Method
</h1>
<div class="markdown level0 summary"></div>
<div class="markdown level0 conceptual"></div>



<a id="C1_Data_DataExtensions_ExecuteIn_" data-uid="C1.Data.DataExtensions.ExecuteIn*"></a>
<h4 id="C1_Data_DataExtensions_ExecuteIn__1_System_Collections_Generic_IEnumerable___0__C1_Data_ClientScope_" data-uid="C1.Data.DataExtensions.ExecuteIn``1(System.Collections.Generic.IEnumerable{``0},C1.Data.ClientScope)">ExecuteIn&lt;T&gt;(IEnumerable&lt;T&gt;, ClientScope)</h4>
<div class="markdown level1 summary"><p>Executes a <code class="paramref">query</code> in a <code class="paramref">scope</code>, so the loaded entities are pinned to the <code class="paramref">scope</code> (marked as needed)
by calling <a class="xref" href="C1.Data.ClientScope.AddRef.html#C1_Data_ClientScope_AddRef_System_Object_">AddRef(object)</a> for each of them.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public static IEnumerable&lt;T&gt; ExecuteIn&lt;T&gt;(this IEnumerable&lt;T&gt; query, ClientScope scope)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Shared Function ExecuteIn(Of T)(query As IEnumerable(Of T), scope As ClientScope) As IEnumerable(Of T)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Name</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1">IEnumerable</a>&lt;T&gt;</td>
      <td><span class="parametername">query</span></td>
      <td><p>The query to execute inside the <a class="xref" href="C1.Data.ClientScope.html">client scope</a>.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="C1.Data.ClientScope.html">ClientScope</a></td>
      <td><span class="parametername">scope</span></td>
      <td><p>The <a class="xref" href="C1.Data.ClientScope.html">client scope</a> to execute the query in.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 class="returns">Returns</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1">IEnumerable</a>&lt;T&gt;</td>
      <td><p>The query that will be executed inside the given <code class="paramref">scope</code>.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 class="typeParameters">Type Parameters</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Name</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><span class="parametername">T</span></td>
      <td><p>The type of items returned by the query.</p>
</td>
    </tr>
  </tbody>
</table>
</div>
