public IList <T> get_transformation_with_criteria <T>(DetachedCriteria detachedCriteria) { if (detachedCriteria == null) { Log.bound_to(this).log_a_warning_event_containing("Please ensure you send in a criteria when you want to get transformed records. Otherwise please consider using GetAll(). Returning empty list."); return(null); } IList <T> list; bool running_long_session = session == null; if (!running_long_session) { start(false); } ICriteria criteria = detachedCriteria.GetExecutableCriteria(session); list = criteria .SetResultTransformer(new AliasToBeanResultTransformer(typeof(T))) .List <T>(); if (!running_long_session) { finish(); } Log.bound_to(this).log_a_debug_event_containing("Repository found {0} records of type {1} with criteria {2}.", list.Count, typeof(T).Name, detachedCriteria.to_string()); return(list); }
public IList <T> get_with_criteria <T>(DetachedCriteria detachedCriteria) { if (detachedCriteria == null) { Log.bound_to(this).log_a_warning_event_containing("Please ensure you send in a criteria when you want to limit records. Otherwise please consider using GetAll(). Returning empty list."); return(null); } IList <T> list; bool not_running_outside_session = session == null; if (not_running_outside_session) { start(false); } ICriteria criteria = detachedCriteria.GetExecutableCriteria(session); list = criteria.List <T>(); if (not_running_outside_session) { finish(); } Log.bound_to(this).log_a_debug_event_containing("Repository found {0} records of type {1} with criteria {2}.", list.Count, typeof(T).Name, detachedCriteria.to_string()); return(list); }