I em using Linq to EF and trying to get FirstOrDefault entitiy from ObjectSet. The query looks like this :
Notification not = new Notification();
........
//not.SubTypeID = null;
var elem = ent.Notifications.FirstOrDefault(p =>
p.ID == not.ID &&
p.SubTypeID == not.SubTypeID &&
p.Location == not.Location &&
p.TypeID == ns.TypeID
);
Sometimes SubTypeID can be null and in this case nothing is returnced in elem althogh p.SubTypeID and not.SubTypeID are both null.
But the strange thing is that when I run this query :
var elem = ent.Notifications.FirstOrDefault(p =>
p.ID == not.ID &&
p.SubTypeID == null &&
p.Location == not.Location &&
p.TypeID == ns.TypeID
);
everything works as expected and I see data in elem.
So what I am doing wrong and what is the difference between these 2 queries when not.SubTypeID is null.