Ejemplo n.º 1
0
        public IList ListProc(Type entity, object parameter)
        {
            System.Type itemstype = System.Type.GetType("System.Collections.Generic.List`1");
            itemstype = itemstype.MakeGenericType(entity);
            IList result = (IList)Activator.CreateInstance(itemstype);

            Mappings.ProcDataReader dr = Mappings.ProcDataReader.GetDataReader(parameter.GetType(), entity);
            using (IDataReader reader = mHandler.ExecProcReader(parameter))
            {
                while (reader.Read())
                {
                    object item = Activator.CreateInstance(entity);
                    dr.ReaderToObject(reader, item);
                    result.Add(item);
                }
            }

            return(result);
        }
Ejemplo n.º 2
0
 public static ProcDataReader GetDataReader(Type proc, Type type)
 {
     lock (mReaders)
     {
         Hashtable rh = (Hashtable)mReaders[proc];
         if (rh == null)
         {
             rh = new Hashtable();
             mReaders.Add(proc, rh);
         }
         ProcDataReader reader = (ProcDataReader)rh[type];
         if (reader == null)
         {
             reader = new ProcDataReader(type);
             rh.Add(type, reader);
         }
         return(reader);
     }
 }
Ejemplo n.º 3
0
 public static ProcDataReader GetDataReader(Type proc, Type type)
 {
     lock (mReaders)
     {
         Hashtable rh = (Hashtable)mReaders[proc];
         if (rh == null)
         {
             rh = new Hashtable();
             mReaders.Add(proc, rh);
         }
         ProcDataReader reader = (ProcDataReader)rh[type];
         if (reader == null)
         {
             reader = new ProcDataReader(type);
             rh.Add(type, reader);
         }
         return reader;
     }
 }