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 query.
Func<DataAccess.DataClasses1DataContext, List<int>, List<DataAccess.TestRecord>>
com...
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 informaiton.
I have querries much like this all through out the application
public static Func<DataContext, MyRecord> CurrentU...
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 == ArticleCommentId
select a;
...
Hi guys
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 fa...
Compiled query:
public static class Machines
{
public static readonly Func<OperationalDataContext, short, Machine>
QueryMachineById =
CompiledQuery.Compile((OperationalDataContext db, short machineID) =>
db.Machines.Where(m => m.MachineID == machineID).SingleOrDefault()
);
public s...
Hello All,
I have a pretty extensive reporting page that uses LINQ. There is one main function that returns an IQueryable object. I then further filter / aggregate the returned query depending on the report the user needs.
I changed this function to a compiled query, it worked great, and the speed increase was astonishing.
The only pr...
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<int> list) =>
from c in context.Groups
where (!csList.Contains(c.GroupID))
select c).ToList()
However I'm getting the following r...
I'm trying to find and run a CompiledQuery given the name. How do I access the compiled query by name and how do I then invoke the delegate?
Here's as far as I can get - I get the error 'Error binding to target method'
public class ActivityRepository
{
private readonly ActivityDataContext _db;
public ActivityRepository()
{...
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 'System.Linq.IQueryable`1[UserQuery+Foo]." exception is thrown when the same query is compiled and run.
How do I fix thi...
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?
...
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 DataContext.]
System.Data.Linq.CompiledQuery.ExecuteQuery(DataContext context, Object[] ...