score:0
change your lomodel to join all three tables. then, you will need one foreach
only.
score:0
try something like this:
from client_uo in userobjects
join client_obj in objects on client_uo.objectid == client_obj.objectid
join p in problems on p.objectid == clt_obj.objectid
join pu in problemusers on p.problemid == pu.problemid
join assignee in users on pu.userid == assignee.userid
where client_obj.userid == clientuserid
that should produce a multi join that gets you from clientuserid to client-userobjects to problemobjects to problems to problemusers (assignees?) to users, with all the data available at one go. you may want to group it together, either by object, by problem, or by assigned user, depending on the display you're trying to produce.
Source: stackoverflow.com
Related Query
- How can I make sure my LINQ queries execute when called in my DAL, not in a delayed fashion?
- How can I make my Many-to-Many queries faster?
- How can i make this code more optimized - How can i replace the forloop.?
- How can I make sure that FirstOrDefault<KeyValuePair> has returned a value
- How many Include I can use on ObjectSet in EntityFramework to retain performance?
- How can I use Nhibernate to retrieve data when the "WHERE IN()" have thousands of values? (too many parameters in the sql)
- How can I build Entity Framework queries dynamically?
- How can I directly execute SQL queries in linq
- How can Entity Framework queries be reused (using methods)?
- How can I switch that code to use LINQ
- How can I make my Linq select return values if the value selected is null?
- How can I combine this code into one or two LINQ queries?
- How can I merge two Linq IEnumerable<T> queries without running them?
- How can I write the following code more elegantly using LINQ query syntax?
- How can I further simplify this piece of LINQ code
- How can I code an outer join using LINQ and EF6?
- How can I modify this C# code so that Visual Studio recognizes that I'm not an idiot?
- How can I make this LINQ search method handle more than two terms?
- How can I code a Linq query to do an upward Include?
- How can I combine IObservable<T>.Throttle() with some other event source using Reactive Extensions?
- How do I make LINQ queries to an SQLite database?
- How can I make certain properties of my EF code-first classes internal to my DAL?
- How can I make it possible to use a dynamic Lambda in Dynamic LINQ
- How can I write a simple LINQ report for a many to many relationship?
- How can i copy data table records of different field name based on mapping list evaluating condition on source data table?
- How can I change this StringBuilder-to-XML code to LINQ-to-XML?
- sub linq query is making this take a very long time, how can I make this faster?
- How can I make a dictionary, with keys, from an array and list?
- How can I make my procedure for finding the Nth most frequent element in an array more efficient and compact?
- How can I make a more efficient Entity Framework LINQ call than a nested loop
More Query from same tag
- Composing Linq to Entity Query from multiple parameters
- Grouping Data with counts
- Group by and Select with Models
- RavenDB index for nested query
- LINQ Join 2 Datatables and With SUM AND GROUP BY
- Avanced Entity Framework Query Example
- How can I get the first value of an IEnumerable iff the length is exactly one, or default otherwise?
- Group List of Objects based on Property using Linq?
- dataset to List<T>using linq
- How to use one C# expression inside another C# expression for Entity Framework?
- LINQ Join Errors
- (Fluent) linq group by strong type
- Use LINQ let with null return values
- ASP.NET LINQ to Delete Rows
- How to await Parallel Linq actions to complete
- How to I combine multiple IEnumerable list together
- Linq query that finds duplicates and removed them from a list
- Invoking Generic Method with the parameter of IEnumerable<T>
- Get subset x elements before and x elements after LINQ
- Joining or Including multiple tables with Entity Framework Core LINQ to Entities - One to Many and then Many to One
- Linq - search string in entity or sub-entity
- How to get IEnumerable<Foo> instead of IEnumerable<string> from LINQ?
- c# limiting listbox items
- Insert Record into two tables with one to many relation by using linq to ado.net entity froamwork
- LINQ Select Based on Another Select
- How do I return a single entity with a self-join using LINQ (in VB.NET)?
- Adding string to IEnumerable of type string using LINQ to entities
- Linq Include of child object properties
- linq select field type unknown
- Ordering Items by Known Parent