Questions tagged [linq.compiledquery]

21 questions
11
votes
2 answers

Executing queries in parallel throws "The underlying provider failed on open." error

Sometimes, not always, I'm getting following error: "The underlying provider failed on open." This is my situation: I have a list of integer keys I process in parallel to be used as parameter in a compiled select query. I use this in a RIA…
ssanchezz23
  • 381
  • 3
  • 10
7
votes
1 answer

Compiled queries and "Parameters cannot be sequences"

I thought that compiled queries would perform the same query translation as DataContext. Yet I'm getting a run-time error when I try to use a query with a .Contains method call. Where have I gone wrong? //private member which holds a compiled…
Amy B
  • 108,202
  • 21
  • 135
  • 185
6
votes
3 answers

DataContext compiled query problem with .NET 4

My project (UI layer is asp.mvc) was developed using .NET 3.5. After upgrading to .NET 4.0 I have got problem with compiled queries: [ArgumentException: Query was compiled for a different mapping source than the one associated with the specified…
marcinn
  • 1,879
  • 2
  • 22
  • 46
4
votes
1 answer

Linq-to-sql Compiled Query returns object NOT belonging to submitted DataContext?

Compiled query: public static class Machines { public static readonly Func QueryMachineById = CompiledQuery.Compile((OperationalDataContext db, short machineID) => …
3
votes
2 answers

Entity Framework Core 2.2 Compiled Query Struct Parameter Evaluating Locally

I've been looking into compiled queries using Entity Framework Core. I'm on the current latest stable version 2.2.2. I was reading through this article…
Adam
  • 1,202
  • 11
  • 25
3
votes
1 answer

Entity framework make compiled query generic

I use entity framework and Im trying to make such a query generic, so it can be used for any entity type (with an assumption that each entity has property int Id). I tried something like this, but there is no collection ctx.TEntity or something…
John Smith
  • 1,783
  • 6
  • 22
  • 36
3
votes
1 answer

Do Compiled Queries Cache?

Much of my application uses complied queries to retrieve data. In these queries I'll often refer to the current user. I'm noticing that if a user, B, logs in after another user, A, then user B will see user A's information. I have queries much like…
Adam Ritenauer
  • 3,151
  • 4
  • 33
  • 40
2
votes
2 answers

LINQ-to-SQL "Member access not legal on type" exception with unioned and compiled query

I have multiple queries that I'd like to union together, then compile the entire thing. The uncompiled query runs fine, but an "InvalidOperationException: Member access 'Int32 Id' of 'UserQuery+Foo' not legal on type…
MikeWyatt
  • 7,842
  • 10
  • 50
  • 71
2
votes
1 answer

Filter list as a parameter in a compiled query

I have the following compiled query that I want to return a list of "groups" that don't have a "GroupID" that's contained in a filtered list: CompiledQuery.Compile(ConfigEntities contexty, List list) => from c in context.Groups where…
JK.
  • 185
  • 2
  • 15
2
votes
1 answer

How to execute a LINQ to SQL Compiled Query that contains a conditional operator?

I need to compile a LINQ-to-SQL query that contains a conditional "?:" operator. I'm able to compile such a query, but the problem is that it fails when I try to execute it. Here is a simple repro: MyContext myContext = new…
Dan Ling
  • 2,965
  • 2
  • 29
  • 43
2
votes
1 answer

Compiled Linq to SQL Queries in MVC Webapplication

I have build a web application with mvc 4. First i implemented the application without compiled queries but to increase the performance i want to use compiled queries. But i can´t use the queries because of the DataContext. I have a class for the…
PX Roth
  • 139
  • 2
  • 16
2
votes
1 answer

Is necessary to compile linq queries in subsonic?

I'd like to know if it's necessary to compile linq queries to the subsonic entities? For example would I'd need to compile the following linq query? var comments = from a in All() where a.ParentCommentId ==…
Raúl Roa
  • 12,061
  • 13
  • 49
  • 64
1
vote
1 answer

Compiled queries in Linq to Devart Entity Framework

For Compiled Queries, In LINQ to Object Entity FrameWork basically it allows the queries to compile at one time and then it can be re-used without compiling another time. For Example: using System.Data.Objects; public static Func
1
vote
1 answer

Compiled query in a static method used by biztalk

I am having a orchestration which will call a static method in a static class. I just discovered that if you need to run a Linq query a lot of times it is a good idea to make it into a compiled query. And my orchestration will be spawned a lot of…
user640691
  • 11
  • 1
1
vote
3 answers

Does applying additional clauses to a compiled query cause a recompile?

If I have a compiled entities query via CompiledQuery.Compile and I then tack on another .Where() clause or .OrderBy() clause, do these addition clauses force a full recompile, a partial recompile, or no recompile?
Orion Adrian
  • 19,053
  • 13
  • 51
  • 67
1
2