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
criterea.Add(Expression.IsNull("ForumId"));
// 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>();
}