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 Query
- Slow foreach() on a LINQ query - ToList() boosts performance immensely - why is this?
- Why is My One to Many Query So Slow with Linq to Entities?
- MVC 5 - Why is my linq code selecting an entire query instead of a single value?
- 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'
- Why is Array.Sort() so slow compared to LINQ?
- Why does adding an unnecessary ToList() drastically speed this LINQ query up?
- Why IEnumerable slow and List is fast?
- LINQ query to perform a projection, skipping or wrapping exceptions where source throws on IEnumerable.GetNext()
- Why does LINQ query throw an exception when I attempt to get a count of a type
- Why does not null in LINQ query still return null records?
- A query body must end with a select clause or a group clause why is here an error?
- Why is one character missing in the query result?
- why is this linq query return a boolean and not the first result of the select?
- Why is this Cross Join so Slow in Linq?
- Why does a GC after a LINQ query free the WhereListIterator but not the Func representing the condition?
- Why is this LINQ query not executed when using foreach?
- Why is my code doing lazy loading even after I turned it off at every possible point?
- Why doesn't this code compile in VS2010 with .NET 4.0?
- [Optimize This]: Slow LINQ to Objects Query
- LINQ: why does this query not work on an ArrayList?
- LINQ query is slow
- why .ToList().Distinct() throws error but not the .Distinct().ToList() with linq query
- LINQ Query - Explanation needed of why these examples are different
- Is there any way to create a LINQ query as a variable without having the data source (yet)?
- Why one query works and not the other?
- Why does LINQ-to-Entities put this query in a sub-select?
- Oracle query using Entity Framework is ridiculously slow
- Why does this LINQ-to-SQL query get a NotSupportedException?
- Why is this code with PredicateBuilder not working?
More Query from same tag
- Multiply filtering in MongoDB
- Unable to search a SQL database under ASP.NET
- Locate the record closest top 5000 meters before
- LINQ Query to find all tags?
- How can I concatenate the array content with its index value
- How to select max and min value of any column of datagridview
- how to select dynamic field by linq?
- Linq select - handle situation where out of bounds exception would be thrown
- Recommended way to check if a sequence is empty
- Querying objects properties with .NET DocumentDB SDK
- LINQ Where(predicate) vs. FirstOrDefault(predicate)
- How to search for "Not Contains" condition on collection of objects in RavenDB
- Extracting text from an IEnumerable<T>
- How to build a LINQ query from text at runtime?
- what is a projection in LINQ, as in .Select()
- This overload of the method 'System.Linq.Queryable.TakeLast' is currently not supported
- linq xml error handling
- LINQ to SQL query in C#
- .net Core 3.1 Linq Expression "...could not be translated." Exception
- How can I combine data from rows in a list using LINQ?
- Searching for records in several tables using EF TPT
- Why a .Union() changes the order of the items?
- Create tree hierarchy in json.net with LINQ using c#
- EF orderby / thenby combo extension method
- How to get length of possibly null database field
- LINQ for IDictionary<TKey, TValue>? Is there an AddIf that I just can't seem to find?
- How to do sum of a column with LINQ?
- Optimisation of LinqToXml
- Select a row in a DataTable and change the header name to a new name and order by first and last names
- Puzzling Problem - C# Lambda Delegates disappearing after