score:0
Accepted answer
I found a solution:
At first it seems that with the DataLoadOptions is something not okay, at second its not clever to load a table with 30 Coloumns when you only need 1.
To Solve this, I make a view which covers all nececeery fields and of course the join.
It reduces the time from 5.0 seconds to 230ms!
score:0
If you want to get rid of the LoadWith, you can select your field explicitly :
public static List<Tuple<UserPM, User> > GetAllPMsAsReciepient(Guid userID)
{
using (var dataContext = new RPGDataContext())
{
return (
from a in dataContext.UserPMs
where a.RecieverID == userID
&& !a.IsDeletedRec
orderby a.Timestamp descending
select Tuple.Create(a, a.User1)
).ToList();
}
}
Source: stackoverflow.com
Related Articles
- Entity-framework code is slow when using Include() many times
- Could not find an implementation of the query pattern for source type 'System.Data.Entity.DbSet'
- LINQ query to perform a projection, skipping or wrapping exceptions where source throws on IEnumerable.GetNext()
- Slow foreach() on a LINQ query - ToList() boosts performance immensely - why is this?
- [Optimize This]: Slow LINQ to Objects Query
- LINQ query is slow
- Is there any way to create a LINQ query as a variable without having the data source (yet)?
- Oracle query using Entity Framework is ridiculously slow
- Slow LINQ Query
- Slow LINQ query for .ToArray()
- LINQ Source Code Available
- prevent unnecessary cross joins in count query of generated sql code
- How to fix super slow EF/LINQ query executing multiple SQL statements
- .NET 4 Code Contracts: "requires unproven: source != null"
- EF Code First comparing null values generates strange query
- linq - how do you do a query for items in one query source that are not in another one?
- Optimizing a slow LINQ query
- How can I write the following code more elegantly using LINQ query syntax?
- How to dynamic add filters to a LINQ query against an Odata Source in C#
- Avoid extra loop and could not find implementation of query pattern for source type int Select not found
- C# Linq query help removing foreach loops creating cleaner code
- LINQ Query incredibly slow - why?
- Use a linq query as microsoft local report Data Source (WinForms)
- Slow performance in LINQ query
- Can I use a compiled query as a source in a second query?
- Determine the source DataContext for a Linq to Sql query
- Query expressions over source type 'dynamic' or with a join sequence of type 'dynamic' are not allowed
- LINQ query returns old results when source list is re-initialized
- How to query by where clause with EF code first
- How to get SQL query into LINQ form in C# code
- Linq - operating on lists of lists
- How to query this in SQL Server?
- How to convert string into Boolean flags in C# LinQ?
- LINQ to Entities does not recognize the method 'Boolean Exists(System.Predicate`1[Entities.Connection])' method
- The LINQ expression node type 'ArrayIndex' is not supported in LINQ to Entities. MVC User Profile Advice
- How to group by Year and Month?
- How to Attain a list of items of items not on another list
- How to convert multiple SQL joins to LINQ query
- Invalid column name when published on azure
- Linq query, select inner query into list?
- Pulling data from one SQL Azure table, add a column, then populate a different table
- How can I combine multiple refactored Select expressions in Linq (to EF or SQL)?
- How do I override the Contains method of IQueryable during a unit test?
- Is there any way to create a LINQ query as a variable without having the data source (yet)?
- Load class properties using LINQ
- How to write extension methods for anonymous types?
- Updating a single column in LINQ to SQL
- How to update node value in a linkedlist using linq
- Stored Functions with Linq to Entities
- Validating a simple login using LINQ