Question

I have started using linq to sql and the entity framework and have found the development experience to be fairly good. Like the way you can break a query apart and combine different queries is quite nice - see pipes and filters.

But the problem that I have found is that performance can be greatly increased (in my case by a factor of about 4 which I can't ignore) if I use complied queries. But the problem I have found with compiled quires is that they don't like working with IQueryable...

Does anyone have any ideas on how I can get round this shortcoming??? The way I was working is that the Compiled Query just referenced other queries that used IQueryable, that way I could switch in and out of using compiled quires or not. But as I have found out this doesn't work so well.

Any ideas?

Cheers Anthony

Was it helpful?

Solution

No, you cannot compose the results of CompiledQuery with another IQueryable. Remember, the sole purpose of CompiledQuery is to cache the results of transforming an IQueryable into an Entity Framework canonical command tree. If you could then compose this with another IQueryable, then it would need to be recompiled for execution, which completely defeats the purpose of CompiledQuery.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top