public void AddRuleSummary(RuleSummary summary) { lock (this.RuleSummaries) { this.ruleSummaries.Add(summary); } }
private void runExecutable(Object executableObject) { ExecutionUnit unit = (ExecutionUnit)executableObject; var executable = unit.Executable; if (unit.Finalize) { ((IDataExecutable)executable).Finalize(this.database, this.providerCollection); if (executable.IsProvider()) { this.providerCollection.AddProvider((IProvider)executable); } return; } if (executable.IsData() && unit.Table != null && unit.Table != this.currentTable) { this.currentTable = unit.Table; CurrentTableChanged(unit.Table); //Console.WriteLine("Finished: " + unit.Table.TableName); } var table = (DataTable)unit.Table; Stopwatch clock = new Stopwatch(); clock.Start(); FinishedStatus finishedStatus; //Execute (executables have different execute signatures) #if !DEBUG try { #endif if (executable.IsSchemaRule()) { ISchemaRule rule = (ISchemaRule)executable; rule.Execute(this.database, this.issueCollector, this.providerCollection); } else if (executable.IsSQLRule()) { SQLRule rule = (SQLRule)executable; rule.Execute(this.database, this.issueCollector); } else if (executable.IsDataRule()) { IDataRule rule = (IDataRule)executable; rule.Execute(table, this.issueCollector, this.providerCollection); } else if (executable.IsSchemaProvider()) { ISchemaProvider prov = (ISchemaProvider)executable; prov.Execute(this.database, this.providerCollection); } else if (executable.IsDataProvider()) { IDataProvider prov = (IDataProvider)executable; prov.Execute(table, this.providerCollection); } if (executable is IProvider && executable.IsSchema()) { this.providerCollection.AddProvider((IProvider)executable); } finishedStatus = FinishedStatus.Success; #if !DEBUG } catch (Exception e) { Console.WriteLine(e.StackTrace); finishedStatus = FinishedStatus.Failed; } #endif clock.Stop(); executionSummaryLock.EnterWriteLock(); if (executable.IsSchemaRule() || executable.IsSQLRule()) { var issues = this.issueCollector.GetIssues((IRule)executable); RuleSummary summary = new RuleSummary((IRule)executable, issues, finishedStatus, clock.Elapsed); this.executionSummary.AddRuleSummary(summary); } else if (executable.IsDataRule()) { IRule rule = (IRule)executable; var issues = this.issueCollector.GetIssues(rule); var sum = executionSummary.GetSummary(rule); if (sum == null) { sum = new RuleSummary(rule, null, finishedStatus, new TimeSpan()); this.executionSummary.AddRuleSummary(sum); } sum.ExecutionTime.Add(clock.Elapsed); sum.Issues = issues; } int pbefore = this.progressTracker.Progress; this.progressTracker.UpdateProgress(executable, table); this.ProgressUpdated(this.progressTracker.Progress); int pafter = this.progressTracker.Progress; //if (pbefore != pafter) // Console.WriteLine(pafter); executionSummaryLock.ExitWriteLock(); }