DateTimeOffset causing problems
-
Saturday, May 22, 2010 4:49 PM
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
All Replies
-
Monday, May 24, 2010 8:36 AMModerator
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] -
Wednesday, May 26, 2010 8:08 PM
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 -
Thursday, May 27, 2010 8:04 AMModerator
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]- Marked As Answer by Vitek Karas - MSFTMicrosoft Employee, Moderator Thursday, June 03, 2010 8:46 AM
-
Sunday, August 22, 2010 11:14 AM
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
-
Wednesday, September 01, 2010 8:45 AM
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
-
Monday, July 25, 2011 3:46 PM
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...
-
Tuesday, April 10, 2012 10:48 AM
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
-
Tuesday, April 10, 2012 12:04 PMModerator
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]
- Marked As Answer by Matt Meehan - MSFTMicrosoft Employee, Moderator Tuesday, April 10, 2012 9:09 PM
-
Thursday, July 26, 2012 5:20 AM
Hi Vitek,
After installing WCF Data Services 5.0 RTM, I still encountered the issue reported by clintsinger.
Any other suggestion?
Thanks,
lisa
-
Thursday, July 26, 2012 7:19 AMModerator
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]
-
Friday, July 27, 2012 9:54 AM
Hi Vitek,
After making the project reference the latest assemblies, it works.
Thanks for your help!
Lisa

