如何生成的xs:日期在WCF OperationContract的参数 [英] How to generate xs:Date in WCF OperationContract parameter

查看:340
本文介绍了如何生成的xs:日期在WCF OperationContract的参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有关参数的重新present的OperationContract的日期只(没有时间组件或时区标志符),它是需要使用的xs:日期,以避免任何歧义或问题,客户端和服务器之间的时区转换

For parameters to an OperationContract that represent a date only (no time component or timezone designator), it is desirable to use xs:Date, to avoid any ambiguity or problems with timezone conversion between client and server.

WCF目前只支持XS:日期时间序列化的DateTime参数

WCF currently only supports xs:DateTime for serializing DateTime parameters.

什么是生成一个OperationContract的使用将被序列化为XS参数的最简单的方法:日期

What is the easiest way to generate an OperationContract with a parameter that will be serialized as xs:Date?

我想有一个自定义的.NET类型公共结构DateOnly或类似的,与隐式转换到/从一个标准的日期时间,即会以某种方式自动生成WSDL为XS:日期

I'm thinking of having a custom .NET Type "public struct DateOnly" or similar, with implicit casting to/from a standard DateTime, that will somehow automatically generate wsdl as xs:Date.

这是可能的,而且我将如何去实现它?

Is this possible, and how would I go about implementing it?

如果有可能,我怀疑的解决办法可能涉及使用XmlSchemaProviderAttribute上的自定义类型,但我对这个属性中找到的任何文件似乎有点不透明的。

If it is possible, I suspect the solution might involve using XmlSchemaProviderAttribute on the custom type, but any documentation I've found on this attribute seems a bit opaque.

更新

我觉得很难相信它会增加得到一个解决方案的probablity,但我会按照该网站的意见,并开始一个赏金。

I find it difficult to believe it will increase the probablity of getting a solution, but I'll follow the site's advice and start a bounty.

为了清楚起见,对于赏金条件是要提供必要建立一个解决方案的所有信息,这样的参数,一个WCF OperationContract的可以是:

For clarity's sake, the condition for the bounty is to provide all the information necessary to construct a solution so that a parameter to a WCF OperationContract can be:

  • 序列化为WS:日期,并在生成的WSDL描述为这样

  • serialized as ws:Date and described as such in the generated WSDL.

或者是一个System.DateTime的值,或者可以隐式转换为/从日期时间。

is either a System.DateTime value or can be cast implicitly to/from DateTime.

推荐答案

现在,这已经到了我的注意,我在连接创建了一个新的建议,在的Please完全支持的xs:日期的日期,只有参数和数据成员的。我这评为四星级(重要)。

Now that this has come to my attention, I have created a new Suggestion in Connect, at Please Fully Support xs:Date for Date-Only Parameters and DataMembers. I rated this with four stars (important).

如果有人读这觉得这是很重要的(或者不同意),那么请使用Connect表决,或对其进行评论。

If anyone reading this feels this is important (or else disagrees), then please use Connect to vote on it or comment on it.

这篇关于如何生成的xs:日期在WCF OperationContract的参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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