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);
     }
 }
Exemple #2
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;
 }
Exemple #3
0
 protected static CommandErrorEventArgs OnCommandError(CommandErrorEventArgs e)
 {
     var eh = Database.CommandError;
     if (eh != null)
     {
         eh(null, e);
     }
     return e;
 }
Exemple #4
0
 protected void CatchException(CommandErrorEventArgs e)
 {
     Database.OnCommandError(e);
     if (e.ThrowException == true)
     {
         var ex = this.CreateException(e);
         throw ex;
     }
 }
Exemple #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;
 }