Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/78.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Rest 使用ServiceStack的嵌套对象路由_Rest_Routes_<img Src="//i.stack.imgur.com/WM7S8.png" Height="16" Width="18" Alt="" Class="sponsor Tag Img">servicestack - Fatal编程技术网 servicestack,Rest,Routes,servicestack" /> servicestack,Rest,Routes,servicestack" />

Rest 使用ServiceStack的嵌套对象路由

Rest 使用ServiceStack的嵌套对象路由,rest,routes,servicestack,Rest,Routes,servicestack,我想设置如下内容,因为它是一个更干净的POCO设计,但似乎我只能通过创建一个int的UserId属性而不是延迟加载的POCO来实现这一点 [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 i

我想设置如下内容,因为它是一个更干净的POCO设计,但似乎我只能通过创建一个int的UserId属性而不是延迟加载的POCO来实现这一点

[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
}
这是唯一的选择吗


帐户类别是您的请求dto吗?查看wiki了解如何使用路由装饰请求dto,

否决,因为我已经展示了我对wiki中基本路由的理解。我想要一个嵌套项是可识别的Account.User.id。我只是想帮一下忙。FTIW我只看到了一些例子和单元测试,它们实现了wiki中提到的功能。
public class Account
{
  public int UserId {get;set;}
  public int Id {get;set;}
  ...
}