Cannot determine type of local variable in EF query

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for PostgreSQL
Post Reply
nsidawy
Posts: 6
Joined: Thu 08 May 2014 21:12

Cannot determine type of local variable in EF query

Post by 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.

Shalex
Site Admin
Posts: 8248
Joined: Thu 14 Aug 2008 12:44

Re: Cannot determine type of local variable in EF query

Post by Shalex » Mon 12 May 2014 13:50

Thank you for your report. We will investigate the issue and notify you about the result.

Shalex
Site Admin
Posts: 8248
Joined: Thu 14 Aug 2008 12:44

Re: Cannot determine type of local variable in EF query

Post by 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.

nsidawy
Posts: 6
Joined: Thu 08 May 2014 21:12

Re: Cannot determine type of local variable in EF query

Post by nsidawy » Wed 28 May 2014 15:11

Awesome! Thank you very much for the quick turnaround.

Shalex
Site Admin
Posts: 8248
Joined: Thu 14 Aug 2008 12:44

Re: Cannot determine type of local variable in EF query

Post by 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/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.

Post Reply