在Castle ActiveRecord中按ID进行选择

时间:2010-04-17 09:53:35

标签: .net nhibernate castle-activerecord orm

如何编写标准以返回属于特定用户的所有订单?

public class User
{
  [PrimaryKey]
  public virtual int Id { get; set; }
}

public class Order
{
  [PrimaryKey]
  public virtual int Id { get; set; }

  [BelongsTo("UserId")]
  public virtual User User { get; set; }
}


return ActiveRecordMediator<Order>.FindAll(
  // What criteria should I write here ?
);

1 个答案:

答案 0 :(得分:0)

找到答案:

Restrictions.Eq("User.Id", userId),