public IList <T> get_with_criteria <T>(QueryOver <T> detachedCriteria) where T : class { 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; using (ensure_session_started()) { IQueryOver <T, T> criteria = detachedCriteria.GetExecutableQueryOver(session); list = criteria.List <T>(); } 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_transformation_with_criteria <T>(QueryOver <T> detachedCriteria) where T : class { 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); } IQueryOver <T, T> criteria = detachedCriteria.GetExecutableQueryOver(session); list = criteria .TransformUsing(Transformers.AliasToBean <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); }