The bug with SQL generation for the HasValue property of the Nullable<T> variable in LINQ to Entities queries is fixed. We will post here when the corresponding build of dotConnect for PostgreSQL is available for download. As a temporary workaround, please add "Protocol=Ver20;" to your connection string.
Be aware that there is a UseCSharpNullComparisonBehavior configuration option which allows to obtain a correct comparison of the nullable columns with parameters:
Code: Select all
var config = Devart.Data.PostgreSql.Entity.Configuration.PgSqlEntityProviderConfig.Instance;
config.QueryOptions.UseCSharpNullComparisonBehavior = true;
string stringValue = "test";
using (PostgreEntities context = new PostgreEntities(connectionString)) {
var query = context.Depts.Where(e => e.Dname == stringValue).ToList();
}
produces the following SQL
Code: Select all
SELECT
"Extent1".deptno,
"Extent1".dname,
"Extent1".loc
FROM public.dept AS "Extent1"
WHERE ("Extent1".dname = :p__linq__0) OR (("Extent1".dname IS NULL) AND (:p__linq__0 IS NULL))