Here are just a few notes on NHibernate LINQ
- Does not support Intersect or Union - we generally get what we can using NHibernate and then perform these operations on in-memory collections.
- Does not support IndexOf - however Contains seems to be case insensitive so we just use this instead - we believe Contains becomes a SQL LIKE comparison so this only works if your Contains is executed within SQL - the in-memory operation is case sensitive but in this case IndexOf becomes available.
- NHibernate 3.1 is now compiled including LINQ - there's no need to reference NHibernate.Linq
7ee4396d-95c9-47cc-882d-82cecae749f1|0|.0
We tried to write a filter based on a DateTime? (nullable DateTime) property like
IList<Vacancy> vacancies = manager.Get<Vacancy>(v => v.StartDate.GetValueOrDefault(DateTime.MinValue) < DateTime.Today);
But NHibernate (or possibly NHibernate.Linq) threw a runtime error. It turns out that NHibernate(.Linq) handles all this for us so
IList<Vacancy> vacancies = manager.Get<Vacancy>(v => v.StartDate < DateTime.Today);
Works perfectly!
314c30d1-540c-4488-aa1f-2c11261b7992|0|.0