Sanity check here...
Shouldn't these two linq queries return the same results?
Query #1:
int stateId = 2;
var streets = from s in ctx.tblStreet
where s.State_Id == stateId
&& s.ParentStreet_Id == (int?)null
select s;
Query #2:
int stateId = 2;
int? parentStreetId = (int?)null;
var streets = from s in ctx.tblStreet
where s.State_Id == stateId
&& s.ParentStreet_Id == parentStreetId
select s;
====== EDIT ==========
The first linq query yields the records that I expect it to, while the second linq query does not. I would expect both of them to yield the same results, but they don't.
====== EDIT #2 ==========
tblStreet definition...
int State_Id not null
int ParentStreet_id null
====== EDIT #3 ==========
The generated sql is different for the two queries, but I would expect it to not matter in this case, because @p1 (parentStreetId) equals (int?)null. Please note that in the queries below I removed all of the select fields and replaced them with an asterisk in order to shorten up the select and just show the where clause.
Query #1:
SELECT * WHERE ([t0].[State_Id] = @p0) AND ([t0].[ParentStreet_Id] IS NULL)
Query #2:
SELECT * WHERE ([t0].[State_Id] = @p0) AND ([t0].[ParentStreet_Id] = @p1)