Page 1 of 1

Cannot determine type of local variable in EF query

Posted: Thu 08 May 2014 21:15
by nsidawy
I am trying to run the following code using DotConnect EF5:

Code: Select all

var intVariable = 0;
var results = this.DataContext.Table<Message>()
                   .Select(m => intVariable)
                   .ToList();
However the query hits the following error when trying to execute:
could not determine data type of parameter $1
Query it executed:

Code: Select all

SELECT 
$1 AS C1
FROM messages AS Extent1
If I replace the local variable with a property on the Message class everything works as expected, but DotConnect appears to be having an issue here determining the type of a variable passed in the "Select" if its a local variable.

Note: If I use that local variable in a Where clause (like 'Where(m => m.MessageId == intVariable)' ) the query executes just fine.

I am using version 7.3.135.0 of all the "Devar.Data.PostgreSql" DLLs.

Please let me know what other information you might require to diagnose this issue.

Re: Cannot determine type of local variable in EF query

Posted: Mon 12 May 2014 13:50
by Shalex
Thank you for your report. We will investigate the issue and notify you about the result.

Re: Cannot determine type of local variable in EF query

Posted: Wed 28 May 2014 14:25
by Shalex
The bug with determining the type of local variable used in LINQ query is fixed. We will notify you when the corresponding build of dotConnect for PostgreSQL is available for download.

Re: Cannot determine type of local variable in EF query

Posted: Wed 28 May 2014 15:11
by nsidawy
Awesome! Thank you very much for the quick turnaround.

Re: Cannot determine type of local variable in EF query

Posted: Thu 29 May 2014 14:31
by Shalex
New build of dotConnect for PostgreSQL 7.3.171 is available for download!
It can be downloaded from http://www.devart.com/dotconnect/postgr ... nload.html (trial version) or from Registered Users' Area (for users with active subscription only).
For more information, please refer to http://forums.devart.com/viewtopic.php?f=3&t=29685.