I have what seems to be a simple linq statement:
Guid? parentGuid = null;
if (root != null)
parentGuid = root.ParentGuid;
var nodes = (from n in _db.Navigations where n.ParentGuid == parentGuid select n);
The problem is if the parent Guid is null, linq does not output sql correctly as I would expect ie. "select * from table where ParentGuid Is Null". It uses a comparison operator instead (select * from table where ParentGuid = @p1), which will not return rows because ansii_nulls is always set to on by default, and from what I understand I can't change this programmically without creating custom stored procs. I've tried changing ansi_nulls to off on my database, but the ado.net connection overrides the default.
Anyone have a solution to this problem? Thanks in advance.