Linq To Sql: Compiled Queries and Extension Methods

Posted by Beni on Stack Overflow See other posts from Stack Overflow or by Beni
Published on 2010-04-26T11:23:10Z Indexed on 2010/04/26 11:23 UTC
Read the original article Hit count: 333

Filed under:
|

Hi community,

I'm interessted, how does Linq2Sql handles a compiled query, that returns IQueryable.

If I call an extension method based on a compiled query like "GetEntitiesCompiled().Count()" or "GetEntitiesCompiled().Take(x)". What does Linq2Sql do in the background? This would be very bad, so in this situation I should write a compiled query like "CountEntitiesCompiled".

Does he load the result (in this case "GetEntitiesCompiled()") into the memory (mapped to the entity class like "ToList()")?

So what situations make sense, when the compiled queries return IQueryable, that query is not able to modify, before request to the Sql-Server. So in my opinion I can just as good return List.

Thanks for answers!

© Stack Overflow or respective owner

Related posts about linq-to-sql

Related posts about compiled-query