string comparison parameter in the where clause is not being passed into the generated SQL after a previous execution with 'null' as the parameter value
Description
IList<Person> FindPerson(string id) { return (from obj in mySession.AsQueryable<Person>() where obj.ID==id select obj).ToList(); }
This sequence runs fine: FindPerson("0001"); //correctly returns person with id 0001 FindPerson(null); // correctly returns null FindPerson("0002"); //correctly returns person with id 0002
This sequence doesn't run fine: FindPerson(null); // correctly returns null FindPerson("0001"); // incorrectly returns null. In the generated SQL where clause there is only a IS NULL and the criteria '0001' is not there
IList<Person> FindPerson(string id)
{
return (from obj in mySession.AsQueryable<Person>() where obj.ID==id select obj).ToList();
}
This sequence runs fine:
FindPerson("0001"); //correctly returns person with id 0001
FindPerson(null); // correctly returns null
FindPerson("0002"); //correctly returns person with id 0002
This sequence doesn't run fine:
FindPerson(null); // correctly returns null
FindPerson("0001"); // incorrectly returns null. In the generated SQL where clause there is only a IS NULL and the criteria '0001' is not there