One repository method needs some love

The following works when the input has a value, but not otherwise. I fear I’m doing it wrong. Help?

public IEnumerable<Forum> SelectByForumId(int? forumId = null)
ICriteria criterea = session.CreateCriteria<Forum>();
if (forumId.HasValue) // get parented items
criterea.Add(Expression.Eq("ForumId", forumId.Value));
else // get only unparented items
// this part here was just watching the values
IList<Forum> results = criterea.List<Forum>();
return results;
// this is the real return
// return criterea.Future<Forum>();

No that’s not it. It isn’t being treated the same as comparing a nullable int.

There’s something specific to NHibernate that I’m not doing right.

Post #7: