views:

24

answers:

1

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 should I write here ?
);
A: 

Found the answer:

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