Exemple #1
0
        public IList <T> GetAllBy(T obj, string whereClause, DGCParameter[] parameters)
        {
            IList <T> sessions = new List <T>();
            IFactory  factory  = DBHelper.CreateFactory();

            try
            {
                string    query = GenerateQuery.CommandTextList(obj, whereClause);
                DbCommand cmd   = factory.MakeCommand(query);
                GenerateQuery.PrepareParametersList(cmd, parameters);
                IDataReader dre = factory.ExecuteReader(cmd);
                sessions = Results(dre);
            }
            catch (Exception ex)
            {
                Write2Log.WriteLogs("Generic<T>", string.Format("GetAllBy({0} obj, string whereClause, DGCParameter[] parameters)", typeof(T).Name), ex.Message);
            }
            finally
            {
                factory.Release();
            }
            return(sessions);
        }