How to do temporary tables in Linq to Entity Framework

entity-frameworklinqstored-procedures

Our application queries the database primarily using Linq queries backed by Entity Framework but we sometimes call legacy stored procedures. Sometimes we want to replace an existing stored procedure with a Linq / Entity Framework query. Is this possible to do even if the stored procedure uses temporary tables? If so, how?

Best Answer

Honestly, why force a square peg into a round hole? Entity Framework supports calling stored procedures for a reason; because Entity Framework cannot address every use case that the database itself can support.

I would just use the right tool for the job (which in some of these cases appears to be stored procedures) and not worry about trying to create a faux "pure" architecture by forcing everything into Entity Framework.