我期待在新的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
发布评论