Questions tagged [compiled-query]

CompiledQuery is a .NET helper class for the Entity Framework, which enables compilation of of database queries for better performance.

CompiledQuery is a .NET helper class for the Entity Framework. It enables user code to compile a query to the source (based on a method signature), to be re-used efficiently with different parameter values.

68 questions
1
vote
0 answers

Simple Linq to SQL Compiled.query for count

I have a function that does a database count every minute and I would like to compile the query to do so. The table is being written to (and deleted from) by multiple sources constantly and I want to gather results on the number of unique rows in…
vwdewaal
  • 975
  • 2
  • 11
  • 25
1
vote
2 answers

Dynamic Order (SQL ORDERBY) in LINQ CompiledQuery

how can I create a dynamic ORDERBY in my LINQ CompiledQuery (e.g. supply Order Field and Direction as parameters for the compiled query)?
Alex
  • 75,813
  • 86
  • 255
  • 348
1
vote
1 answer

Rewriting Include() to a linq join

As it's (at this moment) impossibe to use Include() in a compiled query, I'm trying to rewrite them to joins. But it doesn't seem to work out quite as I would want it to. Say I have this relation: Order OrderState Id Id …
fuaaark
  • 541
  • 8
  • 21
1
vote
0 answers

Include in a compiled query

I'm trying to identify and improve some hotspots in a WCF-service. One of the queries uses an awful lot of Include statements. SQL server performance is sunshine and lollipops, but EF performance is really bad. Breaking this monster down into…
1
vote
1 answer

Converting Linq2SQL simple queries to CompiledQueries to increase app performance

I am writing a Silverlight for Windows Phone (SDK 7.1) app and I am displaying data from a CompactSQL DB in a LongListSelectorcontrol from the Silverlight Toolkit for Windows Phone. Once the list becomes about 150 items long, The app really slows…
Styff
  • 113
  • 1
  • 9
0
votes
1 answer

Linq compiled query and performance issue

I am having some performance issue of linq compiled query. using (var txn = new TransactionScope(TransactionScopeOption.Required, new TransactionOptions { IsolationLevel = System.Transactions.IsolationLevel.ReadUncommitted })) { …
Pankaj Mishra
  • 20,197
  • 16
  • 66
  • 103
0
votes
0 answers

EF Compile Query and Configurable Constraints

I have been looking into this, and I haven't been able to find an answer. We are using EF 6.0 in C#, I was hoping to use the EF Compiled query to avoid some Dynamic SQL. We have a set of Constraint defined to find recommendable data. and Those…
Mark Daly
  • 1
  • 1
0
votes
1 answer

Entity Framework Large Query - split into compiled subqueries?

I've got an ASP .NET web forms application that collects information to eventually give a calculated premium for a car insurance quote. I've got about 10 screens in which we populate our root CarRisk object, this has properties such as…
0
votes
1 answer

In Linq to SQL how do you prevent Compiled queries from recompiling

I am using compiled queries. As expected they take extra time to compile for the first time however what I have also noticed is that they recompile after not being called for approximately 30 minutes. Is it possible to control when queries recompile…
0
votes
1 answer

Linq to SQL Transaction Insert then Select really, really slow

I'm developing a piece of a system that basically migrates data from one set of tables to another set. Everything works fine, but I've decided to employ transactions instead of just failing on things that are partially completed. (That is, if some…
Russell Patterson
  • 622
  • 3
  • 10
  • 23
0
votes
1 answer

Rewrite a LinqToSql query to return same instances without LoadWith

I'm investigating CompiledQuery performance, but CompiledQuery is allergic to LoadWith. using (CustomDataContext myDC = new CustomDataContext()) { DataLoadOptions options = new DataLoadOptions(); options.LoadWith(c => c.Orders) …
Amy B
  • 108,202
  • 21
  • 135
  • 185
0
votes
3 answers

Linq-to-Entities match ID in list of integers in a compiled query

I'm trying to find a way to implement a Linq-to-Entities compiled query of the form: Func, IQueryable> query = System.Data.Objects.CompiledQuery.Compile( (MyEntities entities, List IDs) => ( (from au…
sipsorcery
  • 30,273
  • 24
  • 104
  • 155
0
votes
2 answers

Entity Framework use CompiledQuery but allow runtime filter values

I'm attempting to refactor a cumbersome LINQ-to-SQL data layer with an entity framework one. The database schema behind the model is big and a typical query might have 20 to 30 Includes. The EF generates massive SQL statements for such queries, the…
sipsorcery
  • 30,273
  • 24
  • 104
  • 155
0
votes
1 answer

Help with linq to sql compiled query

I am trying to use compiled query for one of my linq to sql queries. This query contains 5 to 6 joins. I was able to create the compiled query but the issue I am facing is my query needs to check if the key is within a collection of keys passed as…
stackoverflowuser
  • 22,212
  • 29
  • 67
  • 92
0
votes
0 answers

Linq to Sql CompiledQuery references disposed DataContext

In our backend app based on .NET 4.6, we use a lot of Linq To Sql compiled queries. Analyzing my application with dotMemory, I noticed that some of them have a reference to the (now disposed) DataContext with which the query was originally compiled.…
Urs Meili
  • 618
  • 7
  • 19