我怎样才能实现自定义QueryStringConverter REST风格的WCF? [英] How can I implement a custom QueryStringConverter for RESTful WCF?

查看:167
本文介绍了我怎样才能实现自定义QueryStringConverter REST风格的WCF?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经实现了一个定制的QueryStringConverter类,并使用自定义的WebHttpBehavior子迷上它。当我做一个服务调用,它击中我的断点在CanConvert倍率(和我返回true此参数),但它从来没有要求我ConvertStringToValue覆盖,并最终刚好路过空的服务电话......这是为什么ConvertStringToValue永远叫我怎么能解决这个问题?

I've implemented a customized QueryStringConverter class and hooked it up using a customized WebHttpBehavior subclass. When I make a service call, it hits my breakpoint in the CanConvert override (and I return true for this parameter), but it never calls my ConvertStringToValue override, and ends up just passing null to the service call... why is ConvertStringToValue never called and how can I fix it?

推荐答案

我知道这是很老的问题。对于谁寻找一些答案的任何一个,你应该能够添加的TypeConverter到您的类,它可以转换的类型,并从字符串再presentation

I know it is quite old question. For any one who looking for some answer, you should be able to add the TypeConverter to your class which can convert type to and from string representation

<一个href="http://msdn.microsoft.com/en-us/library/system.servicemodel.dispatcher.querystringconverter.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/system.servicemodel.dispatcher.querystringconverter.aspx

类型,它们有一个TypeConverterAttribute,可以转换的类型   并从字符串再presentation。

Types that have a TypeConverterAttribute that can convert the type to and from a string representation.

这篇关于我怎样才能实现自定义QueryStringConverter REST风格的WCF?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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