Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I'm pretty certain EF doesn't have temp tables support - at least out of the box - but it's constantly changing. </p> <p>Your best bet is to do something like this... </p> <pre><code>dbcontext.Database.ExecuteSqlCommand("...") </code></pre> <p>...and I'm guessing there you could run an arbitrary SQL (I know most things can be passed in but I'm not sure about the limitations, but you could run a SP, create indexes etc.) - to set up a temp table. </p> <p>Then the next step would be to do the opposite side something like this.. </p> <pre><code>dbcontext.MyTable.SqlQuery("...").ToList() </code></pre> <p>...to map back the sql results into some entity of yours - or for a non-mapped entity to string or something. (<code>dbcontext.MyTable.SqlQuery&lt;T&gt;("...").ToList()</code>) </p> <p>The question is how to do it exactly - not sure of your specifics really. But you could create a temp table before hand and have it mapped - and use it for temp purposes. </p> <p>Basically, that's a DBA thinking - but EF is not perfect for such things (see something similar here <a href="https://stackoverflow.com/questions/5052053/recommed-usage-of-temp-table-or-table-variable-in-entity-framework-4-update-per">Recommed usage of temp table or table variable in Entity Framework 4. Update Performance Entity framework</a>) but you might be ok with a custom ran queries like the above. </p> <p>hope it helps </p> <p>EDIT: this might also help <a href="http://social.msdn.microsoft.com/Forums/en/adodotnetentityframework/thread/31223561-ad8a-42f2-8c56-e9c756fa120c" rel="nofollow noreferrer">from EF forums</a> but it's more involving. </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload