Home Dashboard Directory Help
Search

WCF RIA Services should support DateTimeOffset by kiwibart


Status: 

Active


31
0
Sign in
to vote
Type: Suggestion
ID: 512975
Opened: 11/20/2009 5:17:23 PM
Access Restriction: Public
1
Workaround(s)
view

Description

When attempting to return a type with a DateTimeOffset property, Microsoft.Ria.Client.targets gives the following error during compilation:

Entity '<type>' has a property '<property>' with an unsupported type.

This occurs with both the CTP and Beta of RIA Services.
Details
Sign in to post a comment.
Posted by TK_WA on 10/12/2010 at 8:03 PM
I cant get this work around to work. I have learnt about shared files though.
http://msdn.microsoft.com/en-us/library/ee707371%28VS.91%29.aspx

I get a couple of errors that i am changing between.
1. [tablename] already contains a definition for property dateTimeOffset
2. in the shared file on the client side -> [TableName] does not contain a definition for DateTime and [TableName] does not contain a definition for Offset
3. and the original one.....Entity '<type>' has a property '<property>' with an unsupported type.

Has anyone else got this working?
Posted by benkoffel on 9/2/2010 at 7:01 PM
Yeah this would be a show stopper my company too.

Our new platform is internationalized so we use DateTimeOffset all over the place.

Don't know how microsoft can not support a base data type...
Posted by mamadero2 on 8/3/2010 at 2:19 AM
I can't believe this is still an issue with the RTM. I can't understand why is it an issue if WCF can perfectly handle this type and Silverlight supports it....
Posted by mhellem on 2/27/2010 at 3:25 PM
I've experienced this issue as well, and it is indeed a show stopper. I have changed all my datatimeoffset types to datetime while waiting for anticipated support in the rtm. I sure hope it's there!
Posted by Ruslan Urban on 1/4/2010 at 10:11 AM
Ideally, WCF RIA Services should support all SQL database types that can be represented by Entity framework, or provide an option to ignore fields that cannot be used by WCF RIA Services.
Posted by Philipp.Sumi on 12/27/2009 at 4:47 AM
Outch, that a show stopper. Given DateTimeOffset has been added to the framework especially to resolve potential issues that are likely to occur with distributed systems, this really should be supported.
Posted by Microsoft on 11/23/2009 at 3:28 AM
Thank you for your feedback. We are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com).

Sign in to post a workaround.
Posted by mamadero2 on 8/3/2010 at 2:26 AM
You could add a DateTimeOffset property in a .shared file and mark it as Excluded (in the metadata file). Then create two more properties to hold the DateTime and another one with a TimeSpan for the OffSet. The shared code will work in Silverlight and the Server so your code could just deal with a DateTimeOffset and ignore the other two that are there just to keep RIA happy.

// In the regular (non shared) file
public DateTime DateTime{get;set;}
public TimeSpan Offset{get;set;}

// In the shared file
public DateTimeOffset DateTimeOffset
{
get{ reutrn new DateTimeOffset(DateTime, Offset);}
set
{
    DateTime = value.DateTime;
    OffSet = value.Offset;
}
}

// In the metadata file
[Exclude]
public DateTimeOffset DateTimeOffset{get;set;}