score:1
Wouldn't something like this work?
from main in Main
select new {
Title = main.Title,
Details = main.Details.Count(),
Messages = main.Details.Sum( d => d.Messages.Count())
}
If you have foreign key constraints, LINQ should generate the child-relationships automatically, so you could access main.Details for each Detail associated with main, and main.Messages for each Message associated with main.
Source: stackoverflow.com
Related Query
- SQL to LINQ with multiple join, count and left join
- Linq, double left join and double count
- LINQ left join with group by and correct count
- LINQ Left Join with group by and count
- Left join and count based on multiple values using linq c#
- I want to print Count using Groupby and Left join in linq
- LINQ Left Outer Join Multiple Tables with Group Count and Row Concatenation
- How to group by with left join by multiple columns using linq and get count of grouped records?
- LINQ : Left Join And Right Join with a double selection
- Using group by left join and count using linq
- LINQ Left Outer Join with Group By and Count Producing Error
- Linq left join and count - How To
- LINQ - Left Join, Group By, and Count
- Left join on two Lists and maintain one property from the right with Linq
- Linq with Left Join on SubQuery containing Count
- Linq to SQL Left Join, Order and Group By Count
- linq query to join two tables and get the count from one table values from the other
- Left outer join using LINQ -- understanding the code
- JOIN and LEFT JOIN equivalent in LINQ
- JOIN and LEFT JOIN equivalent in LINQ with Method Syntax
- What's the difference between left side and right side of the equals in a LINQ join
- LINQ left join, group by and Count generates wrong result
- Using LINQ left join with multiple conditions and subquery
- How can I code an outer join using LINQ and EF6?
- linq join and count
- Left outer join null using VB.NET and LINQ
- C# Linq Join 2 tables on multiple columns and GROUP BY for count
- LINQ right join and left join
- How to add left outer join to grouped and summed LINQ query
- How make LINQ query with GroupBy and LEFT JOIN
More Query from same tag
- LINQ TO Nhibernate Count
- Linq-To-Sql LoadWith commands
- Query Date Time Range with interval
- Query MongoDB in C# using LINQ
- LINQ select using .split()
- How do I reference a field in Linq based on a dynamic fieldname
- Hierarchical select in Entity Framework with lambda expression
- Linq query to get disjoint set in a many to many relation
- Get grouped comma separated values with linq
- Linq filter a list of objects based on another list
- Other options than setting IEnumerable to optional
- Linq query with 'åäö' returns all items in table
- How to make efficient search with LINQ in MVC4?
- I'm not geting the right results from a stored procedure
- Find third Max salary using Linq
- How to build a Linq Expression for selecting nested objects?
- Why is DataItem always null in the Page_Load handler?
- Select a property parameter (Function) from a Generic Item
- Is it possible to write subqueries with LinQ?
- Link a reflection property to a variable
- Create anonymous LINQ Lambda sort expression
- Sequence contains no records in Entity Framework
- LINQ to PostgreSQL errors when using DbLINQ
- Sub Query Where X in (from...?
- Dynamic Predicate for Selecting Different Columns of an Entity
- Which is fast : Query Syntax vs. Loops
- variable is referenced from scope, but not defined LINQ expression tree
- Bind Kendo Grid using Linq to EF query in MVC 5
- ERROR Static method requires null instance, non-static method requires non-null instance
- Send lambda expression from client to server