void bc_SqlRowsCopied(object sender, SqlRowsCopiedEventArgs e) { RowsCopiedEventArgs re = new RowsCopiedEventArgs(e.RowsCopied); re.Abort = e.Abort; BulkCopy bc = sender as BulkCopy; bc.RowsCopied?.BeginInvoke(sender, re, null, null); }
protected void bc_RowsCopied <T>(object sender, T eventArgs) where T : System.EventArgs { _completedCount++; if (_completedCount % NotifyAfter != 0) { return; } var RowsCopied = (long)eventArgs.GetType().GetProperty("RowsCopied").GetValue(eventArgs, null); RowsCopiedEventArgs re = new RowsCopiedEventArgs(RowsCopied); var Abort = (bool)eventArgs.GetType().GetProperty("Abort").GetValue(eventArgs, null); re.Abort = Abort; BulkCopy bc = sender as BulkCopy; bc.RowsCopied?.BeginInvoke(sender, re, null, null); }