I'm seeing a strange behavior in an EF query adn I'm wondering why it is happening. With the following code I don't get any results:
if (category.Parent == null)
{
return Db.EventCategories.Where(c => c.Parent == category.Parent);
}
But with this code it does return the expected results:
if (category.Parent == null)
{
return Db.EventCategories.Where(c => c.Parent == null);
}
What is the difference? Isn't null always null? or does the EF treats them as different elements when the value is a nullable (Parent is of type int?).
categoryobject before you actually run the query?