开发者

Selecting by ID in Castle ActiveRecord

开发者 https://www.devze.com 2022-12-27 10:24 出处:网络
How can I write a criteria to return all Orders that belong to a specific User? public class User { [PrimaryKey]

How can I write a criteria to return all Orders that belong to a specific User?

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 shou开发者_StackOverflow社区ld I write here ?
);


Found the answer:

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

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号