Cannot determine type of local variable in EF query
Posted: Thu 08 May 2014 21:15
I am trying to run the following code using DotConnect EF5:
However the query hits the following error when trying to execute:
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.
Code: Select all
var intVariable = 0;
var results = this.DataContext.Table<Message>()
.Select(m => intVariable)
.ToList();
Query it executed:could not determine data type of parameter $1
Code: Select all
SELECT
$1 AS C1
FROM messages AS Extent1
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.