2010-04-17 94 views
0

如何編寫條件以返回屬於特定用戶的所有訂單?通過Castle ActiveRecord中的ID選擇

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 ? 
); 

回答

0

找到了答案:

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