parse-dotnet
parse-dotnet copied to clipboard
Query by Date
Is there a way to query by date with this library?
When I try something like:
ParseAPI.Objects.Query<GameScore>().Where(x => x.CreatedAt > from)
where "from" is a DateTime object
I get:
"The unary operator 'Convert' is not supported"
I've tried different combinations such as making "from" a nullable DateTime and directly accessing the "Value" of x.CreatedAt... these just result in different errors.
Thanks!
(I'm coding for WP7 or I'd use the supported library)
Never mind. I was mistaken. It does work if I use a nullable datetime for "from". The problem I think is that the JsonSerializer is not using the DateConverter for where clauses. Any particular reason for that?
I added the DateConverter to the where clause serialization. The next issue was that the CreatedAt property of the ParseObject I was trying to query was getting serialized as "CreatedAt" instead of "createdAt". I modified the WhereTranslator.VisitMemberAccess to check for a JsonProperty attribute on a member to use as the name.