Ejemplo n.º 1
0
 // Note: scheduled commands are already in batch commands
 private void SaveChangesInBatchMode(UpdateSet updateSet)
 {
     var session = updateSet.Session;
       var postExecActions = new List<Action>();
       var batchBuilder = new DbBatchCommandSetBuilder(this, updateSet);
       batchBuilder.Build();
       LogComment(session, "-- BEGIN BATCH ({0} rows, {1} batch command(s)) ---------------------------", updateSet.AllRecords.Count, updateSet.BatchCommands.Count);
       if (updateSet.BatchCommands.Count == 1) {
     ExecuteBatchSingleCommand(updateSet);
       } else {
     ExecuteBatchMultipleCommands(updateSet);
       }
       LogComment(session, "-- END BATCH --------------------------------------\r\n");
       //execute post-execute actions; it is usually handling output parameter values
       // Finalize records after update
       foreach (var rec in updateSet.AllRecords) {
     rec.CustomTag = null; //clear temp ref that batch process has set
     rec.SubmitCount++;
     rec.EntityInfo.SaveEvents.OnSubmittedChanges(rec);
       }
 }