情况(以下是实体):
public class OrderItem
{
...
public Order Order
...
}
public class Order
{
...
public Customer Customer
....
}
public class Customer
{
public int Id
}
问题:如何创建条件,它为我提供了一些客户ID的所有OrderItem?
答案 0 :(得分:2)
ICriteria criteriacrit = session
.CreateCriteria<OrderItem>())
.CreateAlias("Order", "order")
.CreateAlias("order.Customer","customer")
.Add(Expression.Eq("customer.Id",id));
可能不适合您的型号,但这应该让您入门。 Link