1
我想设置类似下面的东西,因为它是一个更干净的POCO设计,但似乎我只能通过创建int
的UserId
属性而不是延迟加载的POCO来完成此项工作。使用ServiceStack嵌套对象路由
[Route("/Accounts", "GET")] //Where I want to be able to do /Accounts?UserId=1234
[Route("/Accounts/{Id}", "GET")]
public class Account
{
public User User {get;set;}
public int Id {get;set;}
...
}
public class User
{
public int Id {get;set;}
...Lazily loaded values
}
这是唯一的选择?
public class Account
{
public int UserId {get;set;}
public int Id {get;set;}
...
}
Downvoted,因为我已经显示了我对基本路由的了解(这是Wiki中的内容)。我想要一个嵌套的项目是可识别的('Account.User.Id') –
只是试图帮助。 FTIW我只看过维基中提到的例子和单元测试。 – BrandonG