Closed Kronos11 closed 3 years ago
I believe adding DateTimeOffset here would potentially fix the issue: https://github.com/npgsql/efcore.pg/blob/099131b28bc2cf54951a2ee037f38a7afb6092a7/src/EFCore.PG/Query/ExpressionTranslators/Internal/NpgsqlJsonPocoTranslator.cs#L117
@Kronos11 thanks, makes sense. I've submitted #1884 to fix this (and improve the tests).
Thanks for the quick fix!
Problem When attempting a LINQ query using a nested POCO that has a DateTimeOffset? property, the linq query will fail to execute with an exception. It appears that the actual SQL generation succeeds (it's visible in the debugger output), but the actual generation of the query parameters fails. The exception is as follows:
Example:
where UserDetails is a poco that has AssignedDate as a DateTimeOffset
The strange thing is it generates SQL that is correct, but it blows up when validating the parameter
SELECT w."Id", w."UserDetails" FROM "WorkItems" AS w WHERE (w."Status" = 1) AND (w."UserDetails"->>'AssignedDate' > '2021-06-11T16:08:55.9793830+00:00' ) LIMIT 1