Hi all,
I am struggling with a complex DetachedCriteria Query.....but I am stuck on it.
My domain has this classes:
- Customers (with a one-to-many of Orders)
- Orders (with a one-to-many of OrderDetails)
- OrderDetails (with a many-to-one of Orders and a many-to-one of Product)
- Product
OrderDetails has two propery Quantity and UnitPrice
I need to retrieve all Customers that bought a subset of products in a range of date and the sum of the "subset" of products must be between a range of decimal values
What I wrote is:
Code:
DetachedCriteria query = DetachedCriteria.For(typeof(Customer), "customer");
DetachedCriteria economicCriteria = query.CreateCriteria("Orders","orders");
economicCriteria.Add(Expression.Between("OrderDate", FirstDate, SecondDate));
DetachedCriteria detailCriteria = economicCriteria.CreateCriteria("Detail","detail");
detailCriteria.Add(Expression.And(Expression.In("Product", ProductIdList), ?????? MY PROBLEM IS HERE ??????));
Where you see the ??????????? is where I stuck.
What have I to write there to say to the criteria that the total import of products (ProductIdList) is between DecimalValue1 and DecimalValue2?
Thank you in advance[/u][/b]