ServiceStack IReturn

编程入门 行业动态 更新时间:2024-10-23 21:32:18
本文介绍了ServiceStack IReturn的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我期待在新的API,就出来了2个星期前。这似乎是

I am looking at the new api that came out 2 weeks ago. It seems like

ReqDTO : IReturn<List<ResDTO>> { //... }

在IReturn位似乎是可选的?该DTO的在RazorRockstars示范项目工作离不开它。

The "IReturn" bit seems to be optional? The DTOs in RazorRockstars demo project works without it.

推荐答案

这是一个新增加的 ServiceStack的新API 它可以让你记录了预期的响应类型的请求DTO将返回,如与

This is a new addition in ServiceStack's New API which allows you to document the expected Response Type that the Request DTO will return, e.g. with

ReqDTO : IReturn<List<ResDTO>> { ... }

它允许您调用任何使用C#的客户服务与

Which lets you call using any of the C# Service Clients with:

List<ResDTO> response = client.Get(new ReqDto());

如果你没有足够的IReturn标记您的客户端调用必须是这样的:

If you didn't have the IReturn marker your client call would have to look like:

List<ResDTO> response = client.Get<List<ResDTO>>(new ReqDto());

这是后话了客户/消费者的服务需要了解。如果你有标记的DTO的响应类型是已知的。

Which is something the client/consumer of your service needs to know about. If you had the marker on the DTO the response type is already known.

在 IReturn&LT;&GT; 标记也被用来确定这是我们用来在HTTP响应中ServiceStack的响应DTO /元页。

The IReturn<> marker is also used to determine the Response DTO that's used in the HTTP Responses in ServiceStack's /metadata pages.

更多推荐

ServiceStack IReturn

本文发布于:2023-11-03 20:15:58,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1555985.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:ServiceStack   IReturn

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!