2013-08-31 44 views
1

我想设置类似下面的东西,因为它是一个更干净的POCO设计,但似乎我只能通过创建intUserId属性而不是延迟加载的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;} 
    ... 
} 

回答

-1

是您的请求dto帐户类?请参阅Wiki以了解如何用路线装饰您的请求,https://github.com/ServiceStack/ServiceStack/wiki/Routing

+0

Downvoted,因为我已经显示了我对基本路由的了解(这是Wiki中的内容)。我想要一个嵌套的项目是可识别的('Account.User.Id') –

+0

只是试图帮助。 FTIW我只看过维基中提到的例子和单元测试。 – BrandonG