1

我们有一个自定义 IDispatchMessageFormatter(可以使用属性应用于任何特定方法)来处理与我们的 RESTful WCF 服务之间的 JSON 请求。我已经实现了 DeserializeRequest 方法,但只需要在运行时确定将查询字符串参数转换为什么类型。例如,如果方法是:

[MyCustomOperationBehavior]
[WebGet("/thethings/{thing1}/{thing2}/{number1}")]
public MyReturnThing Foo(string thing1, string thing2, int number1)

我需要知道 WebOperationContext.Current.IncomingRequest.UriTemplateMatch.BoundVariables 集合中的第三个参数应该是一个 int。WCF 堆栈显然可以做到这一点,但我不确定如何访问从调度格式化程序中调用的方法。对此的任何帮助将不胜感激!

4

0 回答 0