Category Archives: NHibernate

Sql Server DateTime Conversion

Suppose that your model requires selecting over a date range. It is frequently more convenient to store DateTime.MinValue than it is to store a NULL as this allows for easy selecting without doing a bunch of field < value or … Continue reading

Posted in c#, NHibernate | 1 Comment

ISession Extension for Saving Multiple Objects

Incredibly simple, but quite useful:         public static void Save(this ISession session, params object [] entities)         {             foreach (var o in entities)             {                 session.Save(o);             … Continue reading

Posted in c#, NHibernate | Leave a comment

CriteriaByLongAlias

This simple function cleans up a lot of the Alias sillyness I have fought with in NHibernate.         public static ICriteria CriteriaByLongAlias(this ICriteria criteria, string field)         {             ICriteria byAlias = criteria.GetCriteriaByAlias(criteria.Alias + “_” + … Continue reading

Posted in c#, NHibernate | Leave a comment