A filter query like $filter=TimeRequested eq datetime'2012-12-17' OR $filter=TimeRequested eq datetime'2012-12-17T08:36:06'
is erroring out with
Microsoft.Data.OData.ODataException: A binary operator with incompatible types was detected. Found operand types 'Edm.String' and 'Edm.DateTime' for operator kind 'Equal'.
The OData package is the latest (RC) released last week.
I've looked into http://aspnetwebstack.codeplex.com/workitem/396 and ensured that ODataLib is the latest 5.2 version (released 12/17)
Like public class SomeClass { public string TimeRequested {get;set;}} and few other properties. I am using Mongo as the data store. BTW the action is something like public IEnumerable<SomeDTO> Get(ODataQueryOptions options) of course with HttpGet / Queryable
attributes.
I can actually put a break point in the first line of the action and verify that the error is shown on hovering over options.
vvittal_h
0 Points
3 Posts
WebAPI OData DateTime error
Dec 19, 2012 04:26 AM|LINK
A filter query like $filter=TimeRequested eq datetime'2012-12-17' OR $filter=TimeRequested eq datetime'2012-12-17T08:36:06'
is erroring out with
Microsoft.Data.OData.ODataException: A binary operator with incompatible types was detected. Found operand types 'Edm.String' and 'Edm.DateTime' for operator kind 'Equal'.
The OData package is the latest (RC) released last week.
I've looked into http://aspnetwebstack.codeplex.com/workitem/396 and ensured that ODataLib is the latest 5.2 version (released 12/17)
raghuramn
Member
248 Points
64 Posts
Microsoft
Re: WebAPI OData DateTime error
Dec 19, 2012 06:53 AM|LINK
what does you model look like ?
vvittal_h
0 Points
3 Posts
Re: WebAPI OData DateTime error
Dec 20, 2012 10:15 AM|LINK
It is a POCO and not an Entity Framework Model.
Like public class SomeClass { public string TimeRequested {get;set;}} and few other properties. I am using Mongo as the data store. BTW the action is something like public IEnumerable<SomeDTO> Get(ODataQueryOptions options) of course with HttpGet / Queryable attributes.
I can actually put a break point in the first line of the action and verify that the error is shown on hovering over options.
GONeale
Member
3 Points
3 Posts
Re: WebAPI OData DateTime error
Jan 29, 2013 05:45 AM|LINK
vvittal_h,
Just out of curiousity, where did you learn to cast as datetime?
I can't find casting mentioned anywhere in the docs - http://www.odata.org/media/30002/OData.html.
Have been tearing my hair out until I stumbled upon your post.
vvittal_h
0 Points
3 Posts
Re: WebAPI OData DateTime error
Jan 29, 2013 10:54 AM|LINK
I don't exactly remember but you can check out this link http://msdn.microsoft.com/en-us/library/hh169248(v=nav.70).aspx
Search for datetime, you should find it somewhere near the end.