WCF REST:UriTemplate路径段的变量必须具有“字符串"类型. [英] WCF REST: Variables for UriTemplate path segments must have type 'string'.

查看:158
本文介绍了WCF REST:UriTemplate路径段的变量必须具有“字符串"类型.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么不能在UriTemplate路径段中使用强类型参数,即:

Why is it not possible to use strongly typed parameters in UriTemplate path segments, i.e.:

[OperationContract]
[WebGet(UriTemplate = "Entity/{id}")]
Entity Find(Int32 id);


为什么id必须为String类型?


Why does id have to be of type String?

推荐答案

感谢您的发布!目前,用于UriTemplate路径段的变量的类型仅限于字符串"类型.对于以上示例,您可以将ID移至查询部分:

Thank you for posting! Currently, the type of variables for UriTemplate path segments is limited to type 'string'. For above sample, you can move id to query part:

[ OperationContract ]
[ WebGet ( UriTemplate = 实体/?id = {id}" )]]
实体 查找 ( Int32 id );

[OperationContract]
[WebGet(UriTemplate = "Entity/?id={id}")]
Entity Find(Int32 id);

您还可以在 用户语音网站,以便其他用户可以对其进行投票,并让产品团队了解您的需求.谢谢.

You can also submit a feedback at user voice site, so that other users can vote it and let product team to know what would you like. Thanks. 


这篇关于WCF REST:UriTemplate路径段的变量必须具有“字符串"类型.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆