LINQ Fluent NHIBERNATE .Contains() does not work in QueryOver<> but works in Query<>

I found the answer. Thanks to the post at: NHibernate using QueryOver with WHERE IN

var categories = _session.QueryOver<Data.Model.Category>()
                                     .WhereRestrictionOn(c => c.CategoryId).IsIn(ArrayofCategoryIds)
                                     .List()
                                     .Select(_categoryMapper.CreateCategory)
                                     .ToList();

I had to use the WhereRestrictionOn()


This is tangentially related issue and this seemed like the best place to put it.

_session.Query<SomeType>.Where(t => someEnumerable.Contains(t))

was not working.

In my case someEnumerable was NOT a List<SomeType>, but rather a HashSet<SomeType>. Apparently, NH really wants it to be a list. So, I did this instead and it worked.

var someEnumerableList = someEnumerable.ToList();
_session.Query<SomeType>.Where(t => someEnumerableList.Contains(t)

Also, FWIW, I was under the impression that Query<T> was the new preferred way to go and that QueryOver<T> was the less preferred way, because Query<T> returns IQueryable, meaning that it should be a little easier to test, and theoretically swap out ORMs.