Exemplo n.º 1
0
        public static ProcBuilder GetBuilder(Type type)
        {
            ProcBuilder result = (ProcBuilder)mBuilders[type];

            if (result != null)
            {
                return(result);
            }
            return(createBuilder(type));
        }
Exemplo n.º 2
0
 private static ProcBuilder createBuilder(Type type)
 {
     lock (mBuilders)
     {
         ProcBuilder result = (ProcBuilder)mBuilders[type];
         if (result == null)
         {
             result = new ProcBuilder(type);
             mBuilders.Add(type, result);
         }
         return(result);
     }
 }
Exemplo n.º 3
0
        public IDataReader ExecProcReader(object parameter)
        {
            Mappings.ProcBuilder pb = Mappings.ProcBuilder.GetBuilder(parameter.GetType());
            IDataReader          reader;
            IDbCommand           cmd = Driver.Command;

            cmd.CommandText = pb.Name;
            cmd.CommandType = CommandType.StoredProcedure;
            IDataParameter[] dps = pb.GetParamters(parameter, Driver);
            for (int i = 0; i < dps.Length; i++)
            {
                cmd.Parameters.Add(dps[i]);
            }
            OnInitCommand(cmd);
            reader = cmd.ExecuteReader();
            pb.UpdateParameters(parameter, cmd);
            return(reader);
        }