在 openrasta get 方法中传递对象作为参数
OpenRasta 处理程序是否可以接受资源作为参数。
对于(例如)“/search/”的 URI,我可以传递类似以下的内容:
public class SearchRequest
{
public string Term { get; set; }
public string[] Categories { get; set; }
public int LimitPerPage { get; set; }
public int CurrentPage { get; set; }
}
在我的处理程序中,有类似的内容:
public List<SearchResult> Get(SearchRequest request)
或者我是否可以更好地用这些作为查询字符串的参数来组合我的 URI?
Is it possible for an OpenRasta handler to have accept a resource as a parameter.
For a URI of (for example) "/search/" could I pass something like:
public class SearchRequest
{
public string Term { get; set; }
public string[] Categories { get; set; }
public int LimitPerPage { get; set; }
public int CurrentPage { get; set; }
}
In my handler, have something like:
public List<SearchResult> Get(SearchRequest request)
Or am I better composing my URI with those as parameters for the querystring?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您有 GET,则必须在 URI 中声明您期望的参数。您只需在
AtUri
中声明 /search?page={CurrentPage} 即可。If you have a GET you'll have to declare the parameters you expect in the URI. You can simply have /search?page={CurrentPage} declared in
AtUri
.