Exemplo n.º 1
0
        object Progress(CommandRun cmdAcs, string sqlText, params object[] paramers)
        {
            return(Command(cmd =>
            {
                cmd.Parameters.Clear();
                this.script = Script.Create(sqlText, paramers);
                switch (paramers.Length)
                {
                case 1:
                    if (paramers[0] is System.Collections.IDictionary)
                    {
                        cmd.CommandText = SqlParamer.Format(this.dbProvider, this.isAutoPfx, cmd, sqlText, (System.Collections.IDictionary)paramers[0]);
                    }
                    else
                    {
                        goto default;
                    }

                    break;

                default:
                    cmd.CommandText = SqlParamer.Format(this.dbProvider, this.isAutoPfx, cmd, sqlText, paramers);
                    break;
                }

                return cmdAcs(cmd);
            }));
        }
Exemplo n.º 2
0
        object CommandProgress(CommandRun cmdAcs)
        {
            DbCommand cmd = conOpen.CreateCommand();

            cmd.CommandTimeout = TimeOut;
            try
            {
                return(cmdAcs(cmd));
            }
            catch (System.Exception ex)
            {
                throw new DbException(ex, cmd);
            }
        }
Exemplo n.º 3
0
 object ConnectionProgress(CommandRun cmdAcs)
 {
     using (DbConnection con = Provider.DbFactory.CreateConnection())
     {
         con.ConnectionString = this.Provider.ConntionString;
         DbCommand cmd = con.CreateCommand();
         cmd.CommandTimeout = TimeOut;
         cmd.Connection.Open();
         try
         {
             return(cmdAcs(cmd));
         }
         catch (System.Data.Common.DbException ex)
         {
             throw new DbException(ex, cmd);
         }
         finally
         {
             con.Close();
         }
     }
 }
Exemplo n.º 4
0
        object TrasactionProgress(CommandRun cmdAcs)
        {
            this.TranCmd.CommandTimeout = TimeOut;
            this.TranCmd.Parameters.Clear();
            this.TranCmd.CommandText = String.Empty;
            switch (this.TranCmd.Connection.State)
            {
            case ConnectionState.Closed:
                return(ConnectionProgress(cmdAcs));

            default:

                try
                {
                    return(cmdAcs(this.TranCmd));
                }
                catch (System.Data.Common.DbException ex)
                {
                    throw new DbException(ex, this.TranCmd);
                }
            }
        }