示例#1
0
 protected void CatchException(CommandErrorEventArgs e)
 {
     Database.OnCommandError(e);
     if (e.ThrowException == true)
     {
         var ex = this.CreateException(e);
         ExceptionDispatchInfo.Capture(ex).Throw();
     }
 }
示例#2
0
 protected void CatchException(CommandErrorEventArgs e)
 {
     Database.OnCommandError(e);
     if (e.ThrowException == true)
     {
         var ex = this.CreateException(e);
         throw ex;
     }
 }
示例#3
0
        protected static CommandErrorEventArgs OnCommandError(CommandErrorEventArgs e)
        {
            var eh = Database.CommandError;

            if (eh != null)
            {
                eh(null, e);
            }
            return(e);
        }
示例#4
0
        private void CatchException(MethodName methodName, String connectionString, Exception exception, Object executionContext, SqlBulkCopyContext sqlBulkCopyContext)
        {
            var e = new CommandErrorEventArgs(methodName, connectionString, exception, executionContext, sqlBulkCopyContext);

            SqlServerDatabase.OnCommandError(e);
            if (e.ThrowException == true)
            {
                var ex = CreateException(e);
            }
        }
示例#5
0
        protected override Exception CreateException(CommandErrorEventArgs e)
        {
            var exception = base.CreateException(e);
            var ex        = exception as DatabaseException;
            var ee        = e as MySqlScriptErrorEventArgs;

            if (ex != null && ee != null)
            {
                ex.Data["MySqlScript"] = ee.MySqlScript;
            }
            return(exception);
        }
示例#6
0
        protected virtual Exception CreateException(CommandErrorEventArgs e)
        {
            var exception = CreateException(e.Exception);
            var ex        = exception as DatabaseException;

            if (ex != null)
            {
                ex.MethodName       = e.MethodName;
                ex.ConnectionString = e.ConnectionString;
                ex.Command          = e.Command;
                ex.DataAdapter      = e.DataAdapter;
            }
            return(exception);
        }
示例#7
0
 private void CatchException(MethodName methodName, String connectionString, SqlBulkCopyContext context, Exception exception)
 {
     var e = new CommandErrorEventArgs(methodName, connectionString, exception, context);
     SqlServerDatabase.OnCommandError(e);
     if (e.ThrowException == true)
     {
         var ex = CreateException(e);
     }
 }
示例#8
0
 protected virtual Exception CreateException(CommandErrorEventArgs e)
 {
     var exception = CreateException(e.Exception);
     var ex = exception as DatabaseException;
     if (ex != null)
     {
         ex.MethodName = e.MethodName;
         ex.ConnectionString = e.ConnectionString;
         ex.Command = e.Command;
         ex.DataAdapter = e.DataAdapter;
         ex.Data["SqlBulkCopyContext"] = e.Context;
     }
     return exception;
 }
示例#9
0
 protected void CatchException(CommandErrorEventArgs e)
 {
     Database.OnCommandError(e);
     if (e.ThrowException == true)
     {
         var ex = this.CreateException(e);
         throw ex;
     }
 }
示例#10
0
 protected static CommandErrorEventArgs OnCommandError(CommandErrorEventArgs e)
 {
     var eh = Database.CommandError;
     if (eh != null)
     {
         eh(null, e);
     }
     return e;
 }
示例#11
0
 protected override Exception CreateException(CommandErrorEventArgs e)
 {
     var exception = base.CreateException(e);
     var ex = exception as DatabaseException;
     var ee = e as MySqlScriptErrorEventArgs;
     if (ex != null && ee != null)
     {
         ex.Data["MySqlScript"] = ee.MySqlScript;
     }
     return exception;
 }