Consider this code (works):
var AddOns = from x in db.EVENTPACKAGEADDONs
where x.EVENTPACKAGEID ==
SessionData.OERUser.PackageID &&
x.PARENTCONTROL == null
select x;
Produces this SQL:
SELECT
"Extent1"."ADDONID" AS "ADDONID",
"Extent1"."EVENTPACKAGEID" AS "EVENTPACKAGEID",
"Extent1"."ITEMNUMBER" AS "ITEMNUMBER",
"Extent1"."ADDONHTML" AS "ADDONHTML",
"Extent1"."PARENTCONTROL" AS "PARENTCONTROL",
"Extent1"."CSSCLASS" AS "CSSCLASS",
CAST("Extent1"."CONTROLTYPE" AS SMALLINT) AS "C1",
"Extent1"."DEFAULTVALUE" AS "DEFAULTVALUE",
"Extent1"."CONTROLNAME" AS "CONTROLNAME"
FROM "EVENTPACKAGEADDON" AS "Extent1"
WHERE ("Extent1"."EVENTPACKAGEID" = @p__linq__0) AND
("Extent1"."PARENTCONTROL" IS NULL)
FirebirdClient: Parameters:
FirebirdClient: Name:p__linq__0 Type:Integer Used Value:5
However this code, notice the null is in a variable (does not work):
int? ControlLst = null;
var AddOns = from x in db.EVENTPACKAGEADDONs
where x.EVENTPACKAGEID ==
SessionData.OERUser.PackageID &&
x.PARENTCONTROL == ControlLst
select x;
Produces this SQL and does not work:
SELECT
"Extent1"."ADDONID" AS "ADDONID",
"Extent1"."EVENTPACKAGEID" AS "EVENTPACKAGEID",
"Extent1"."ITEMNUMBER" AS "ITEMNUMBER",
"Extent1"."ADDONHTML" AS "ADDONHTML",
"Extent1"."PARENTCONTROL" AS "PARENTCONTROL",
"Extent1"."CSSCLASS" AS "CSSCLASS",
CAST("Extent1"."CONTROLTYPE" AS SMALLINT) AS "C1",
"Extent1"."DEFAULTVALUE" AS "DEFAULTVALUE",
"Extent1"."CONTROLNAME" AS "CONTROLNAME"
FROM "EVENTPACKAGEADDON" AS "Extent1"
WHERE ("Extent1"."EVENTPACKAGEID" = @p__linq__0) AND
("Extent1"."PARENTCONTROL" = @p__linq__1)
FirebirdClient: Parameters:
FirebirdClient: Name:p__linq__0 Type:Integer Used Value:5
FirebirdClient: Name:p__linq__1 Type:Integer Used Value:<null>
The first LINQ returns records (correct) the second returns no records
(incorrect). Is their any way around this bug?
Michael
--
View this message in context:
http://firebird.1100200.n4.nabble.com/Linq-and-Nulls-bug-tp4017847p4017847.html
Sent from the firebird-net-provider mailing list archive at Nabble.com.
------------------------------------------------------------------------------
RSA(R) Conference 2012
Save $700 by Nov 18
Register now
http://p.sf.net/sfu/rsa-sfdev2dev1
_______________________________________________
Firebird-net-provider mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/firebird-net-provider