DateTimeOffset causing problems
-
2010年5月22日 下午 04:49
Hi,
I am trying to use the DateTimeOffset with my DataService but without success. The entity model is able to successfully map to the type but when I query my WCF Data Service it just returns some html saying that there was a problem at the server. This is true even when just querying for the metadata. In the OData developer guide it says that Edm.DateTimeOffset is a primitive type.
Any chance that the WCF Data Services doesn't support the full OData protocol? (I have set the service to use V2 of the OData protocol).
Cheers,
Clint
clintsinger
所有回覆
-
2010年5月24日 上午 08:36版主
Hi,
WCF Data Services currently doesn't support the DataTimeOffset primitive type. We are aware of this limitation, but if you want to express your interest in this feature please vote for it here: https://connect.microsoft.com/dataplatform/content/content.aspx?ContentID=15540&wa=wsignin1.0
If DataTime would be enough for you, please expose your column as DateTime instead and WCF Data Services should work just fine.
Thanks,
Vitek Karas [MSFT] -
2010年5月26日 下午 08:08
Hi Vitek,
Thanks for the information. Just out of curiosity, what is the relationship to the OData protocol and the WCF Data Services? I was under the impression that the OData protocol was defined by the WCF Data Services team, which is why I was surprised when I found a entity primitive in the OData spec that wasn't supported. I thought that the OData was proposed as a standard after it was designed for use for the WCF Data Services.
Cheers,
Clint
clintsinger -
2010年5月27日 上午 08:04版主
Hi Clint,
You're right OData protocol was defined by us (the WCF Data Services team). But it being a protocol means that it should be implementation agnostic. As a result WCF Data Services is just one implementation which is not yet fully supporting the protocol. When we defined the protocol we knew about a few things we were not able to do in the product yet, but we knew that we want them in the protocol. So we added these. There are really just a very few of these though, the DateTimeOffset being one.
Thanks,
Vitek Karas [MSFT]- 已標示為解答 Vitek Karas - MSFTMicrosoft Employee, Moderator 2010年6月3日 上午 08:46
-
2010年8月22日 上午 11:14
Hi Vitek
I'm trying to find out if there is any recommended workaround for supporting DateTimeOffset with WCF Data Services, other than changing the datatype to using DateTime instead. Unfortunately I am unable to change the datatype in the SQL database, so I have to be able to support DateTimeOffset in some way or another.
Also, is there any timeframe that we can expect support for DateTimeOffset in WCF Data Services? Can we expect to see it in the near future?
Your help is much appreciated.
Thanks, Richard
-
2010年9月1日 上午 08:45
Hi Richard, Vitek
Did you find a workaround for supporting DateTimeOffset with WCF Data Services?
When you use a DateTime instead of a DateTimeOffset in SQL Database, timezones indicated in lexical representations are converted to UTC during conversion of literals to values. Is there a way to represent the Edm.DateTime with timezone as reccommended by ISO 8601? I found the following sample in http://msdn.microsoft.com/en-us/library/ff478141.aspx:
DateTime <d:foo m:type="Edm.DateTime">2010-02-26T17:08:53.0900752-08:00</d:foo> A date and time with value ranging from 12:00:00 midnight, January 1, 1753 A.D. through 11:59:59 P.M, December 9999 A.D.
How can I configure my WCF Data Service in order to have this representation?
Thanks in advance for your help.
Regards, Marcello
-
2011年7月25日 下午 03:46
It has been more than a year since this was asked for. If it is in the protocol, how long till you support it?
It is silly really that SQL Server and EF Support it (the primary way for WCF Data Services to be setup) but that WCF Data Services does not support it...
Now I have to go do some crazy hack to my data to try and separate datetime and the offset into two different values. This will make my team look less favorably on using OData...
-
2012年4月10日 上午 10:48
That link is broken now....if you want to express your interest in this feature please vote for it here: https://connect.microsoft.com/dataplatform/content/content.aspx?ContentID=15540&wa=wsignin1.0
-
2012年4月10日 下午 12:04版主
Hi,
The new release : http://blogs.msdn.com/b/astoriateam/archive/2012/04/09/wcf-data-services-5-0-rtm-release.aspx
Should support DateTimeOffset now.
Thanks,
Vitek Karas [MSFT]
- 已標示為解答 Matt Meehan - MSFTMicrosoft Employee, Moderator 2012年4月10日 下午 09:09
-
2012年7月26日 上午 05:20
Hi Vitek,
After installing WCF Data Services 5.0 RTM, I still encountered the issue reported by clintsinger.
Any other suggestion?
Thanks,
lisa
-
2012年7月26日 上午 07:19版主
Note that the 5.0 release renamed the assemblies (from System.Data.Services to Microsoft.Data.Services). So just installing the new assemblies onto your machine doesn't actually change anything. In order to use the new release you need to point your project to use the new assemblies.
I would suggest you use NuGet to manage the dependencies for the 5.0 for you. That way it's also very easy to get updates and the redistribution of the assemblies with your app is also very simple. See this post for details: http://blogs.msdn.com/b/astoriateam/archive/2012/05/17/nuget-and-bin-deploy.aspx
Vitek Karas [MSFT]
-
2012年7月27日 上午 09:54
Hi Vitek,
After making the project reference the latest assemblies, it works.
Thanks for your help!
Lisa

