DbUpdateJob_DoWork(object sender, DoWorkEventArgs e) { using (DbContextTransaction mdbtrans = Context.Database.BeginTransaction(IsolationLevel.Serializable)) { try { --- db operations with entityA - 1 ( Insert records ) DbUpdateJob.ReportProgress(20); --- db operations with entityB - 2 ( Insert records) DbUpdateJob.ReportProgress(40); --- db operations with entityC - 3 (Update records ) DbUpdateJob.ReportProgress(60); --- db operations wiwth entityD - 4 (Insert records) DbUpdateJob.ReportProgress(80); Context.SaveChanges(); mdbtrans.Commit(); DbUpdateJob.ReportProgress(100); } catch(Exception ex) { mdbtrans.Rollback(); DbUpdateJob.ReportProgress(0); } } } DbUpdateJob_ProgressChanged(object sender, ProgressChangedEventArgs e) { pbupdate.Value = e.ProgressPercentage; if (e.ProgressPercentage == 0) MessageBox.Show(e.Message); if (e.ProgressPercentage == 100) MessageBox.Show("Success..!!"); }
DbUpdateJob.ReportProgress(100)
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)