我有两节课:
public class Person
{
public int Id{get;set;}
public string Name{get;set;}
public List<Order> Orders{get;set;}
}
public class Order
{
public int Id{get;set;}
public string Data{get;set;}
public decimal Sum{get;set;}
}
我使用休眠 Linq。如果我想获得 Persan.Name 过滤的订单总数,我这样做:
var result = (from person in personRepository.Query
from order in person.Orders
where person.Name.Contains("off")
select order).Sum(order => order.Sum);
如何使用流利的语法做同样的事情?