Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DateTimeOffset instead of DateTime #244

Closed
juergstaub opened this issue Oct 19, 2015 · 2 comments
Closed

DateTimeOffset instead of DateTime #244

juergstaub opened this issue Oct 19, 2015 · 2 comments
Assignees
Milestone

Comments

@juergstaub
Copy link

My database has a table with a CreatedTime column of type datetime, nullable. Via RESTier I try to return this as a property of type DateTimeOffset? I receive an exception that the conversion is a problem. Then, I tried to install my own ValueConverter, but it never gets called. Lats but not least I tried to add a not mapped propterty of type DateTimeOffset to my class but I can get this one to be exposed to the service if it is not a mapped property. I am using 0.3.0-beta2.

The exception is:
The 'CreatedTime' property on 'TaskRun' could not be set to a 'System.DateTime' value. You must set this property to a non-null value of type 'System.DateTimeOffset'.

@lewischeng-ms
Copy link
Contributor

Hi @juergstaub Can you try to add the following attribute to your property:

[Column("CreatedTime", TypeName = "DateTime")]
public DateTimeOffset CreatedTime {get;set;}

For installing your own converter, please inherit ODataDomainPayloadValueConverter instead of ODataPayloadValueConverter.

Related doc: http://odata.github.io/RESTier/#03-15-Date

Thanks.

@lewischeng-ms
Copy link
Contributor

Related issue: #273

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants