Cannot determine type of local variable in EF query

Cannot determine type of local variable in EF query

Postby nsidawy » Thu 08 May 2014 21:15

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.
nsidawy
 
Posts: 6
Joined: Thu 08 May 2014 21:12

Re: Cannot determine type of local variable in EF query

Postby Shalex » Mon 12 May 2014 13:50

Thank you for your report. We will investigate the issue and notify you about the result.
Shalex
Devart Team
 
Posts: 7654
Joined: Thu 14 Aug 2008 12:44

Re: Cannot determine type of local variable in EF query

Postby Shalex » Wed 28 May 2014 14:25

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.
Shalex
Devart Team
 
Posts: 7654
Joined: Thu 14 Aug 2008 12:44

Re: Cannot determine type of local variable in EF query

Postby nsidawy » Wed 28 May 2014 15:11

Awesome! Thank you very much for the quick turnaround.
nsidawy
 
Posts: 6
Joined: Thu 08 May 2014 21:12

Re: Cannot determine type of local variable in EF query

Postby Shalex » Thu 29 May 2014 14:31

New build of dotConnect for PostgreSQL 7.3.171 is available for download!
It can be downloaded from http://www.devart.com/dotconnect/postgresql/download.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.
Shalex
Devart Team
 
Posts: 7654
Joined: Thu 14 Aug 2008 12:44


Return to dotConnect for PostgreSQL