Linq Aggregate on object and List
Posted
by
Kris-I
on Stack Overflow
See other posts from Stack Overflow
or by Kris-I
Published on 2011-06-29T11:26:37Z
Indexed on
2011/06/30
8:22 UTC
Read the original article
Hit count: 242
I do this query with NHibernate:
var test = _session.CreateCriteria(typeof(Estimation))
.SetFetchMode("EstimationItems", FetchMode.Eager)
.List();
An "Estimation" can have several "EstimationItems" (Quantity, Price and ProductId)
I'd like a list of "Estimation" with these constraints :
- One line by "Estimation" code on the picture (ex : 2011/0001 and 2011/0003)
- By estimation (means on each line) the number of "EstimationItems"
- By Estimation (means on each line) the total price (Quantity * Price) for each "EstimationItems"
I hope the structure will be clearer with the picture below.
Thanks,
© Stack Overflow or respective owner