Esempio n. 1
0
        public IQueryable <T> SelectAll()
        {
            List <T>      list = new List <T>();
            StringBuilder sb   = new StringBuilder();

            sb.Append("Select * From ").Append(Entity.TableName);
            IDataReader dr = null;

            try
            {
                IDbCommand cmd = connection.CreateCommand();
                cmd.CommandType = CommandType.Text;
                cmd.CommandText = sb.ToString();
                dr   = cmd.ExecuteReader();
                list = new MappingColumn(Entity).MappingWithoutInclud <T>(dr);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            finally
            {
                dr.Close();
            }
            return(list.AsQueryable <T>());
        }
Esempio n. 2
0
        public IQueryable <T> ExecuteStoreProcedureQuery(string storeProcedure)
        {
            List <T>    list = new List <T>();
            IDataReader dr   = null;

            try
            {
                IDbCommand cmd = connection.CreateCommand();
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.CommandText = "CallEmployee";
                dr   = cmd.ExecuteReader();
                list = new MappingColumn(Entity).MappingWithoutInclud <T>(dr);
            }
            catch (Exception ex)
            {
                throw new SystemException(ex.Message);
            }
            finally
            {
                if (dr != null)
                {
                    dr.Close();
                }
            }
            return(list.AsQueryable <T>());
        }