private void LoadEntities() { _systemComparer = new Logic.SystemComparer(SourceConnection, TargetConnection); WorkAsync(new WorkAsyncInfo { Message = "Getting Metadata", Work = (worker, args) => { LogInfo("Start retrieving metadata on Source"); SendMessageToStatusBar?.Invoke(this, new StatusBarMessageEventArgs(0, $"Fetching Metadata from Source {(_configuration.IncludeAllMetadata ? "with Attributes" : "without Attributes")}...")); _systemComparer.RetrieveMetadata(ConnectionType.Source, _configuration.IncludeAllMetadata, worker.ReportProgress); //_systemComparer.RetrieveOrganization(ConnectionType.Source, worker.ReportProgress); SendMessageToStatusBar?.Invoke(this, new StatusBarMessageEventArgs(5, $"Fetching Forms from Source...")); _systemComparer.RetrieveForms(ConnectionType.Source, _configuration.IncludeForms, worker.ReportProgress); SendMessageToStatusBar?.Invoke(this, new StatusBarMessageEventArgs(10, $"Fetching Views from Source...")); _systemComparer.RetrieveViews(ConnectionType.Source, _configuration.IncludeViews, worker.ReportProgress); LogInfo("Start retrieving metadata on Target"); SendMessageToStatusBar?.Invoke(this, new StatusBarMessageEventArgs(50, $"Fetching Metadata from Target {(_configuration.IncludeAllMetadata ? "with Attributes" : "without Attributes")}...")); _systemComparer.RetrieveMetadata(ConnectionType.Target, _configuration.IncludeAllMetadata, worker.ReportProgress); //_systemComparer.RetrieveOrganization(ConnectionType.Target, worker.ReportProgress); SendMessageToStatusBar?.Invoke(this, new StatusBarMessageEventArgs(55, $"Fetching Forms from Target...")); _systemComparer.RetrieveForms(ConnectionType.Target, _configuration.IncludeForms, worker.ReportProgress); SendMessageToStatusBar?.Invoke(this, new StatusBarMessageEventArgs(60, $"Fetching Views from Target...")); _systemComparer.RetrieveViews(ConnectionType.Target, _configuration.IncludeViews, worker.ReportProgress); SendMessageToStatusBar?.Invoke(this, new StatusBarMessageEventArgs($"Finished fetching Data!")); args.Result = _systemComparer; }, PostWorkCallBack = (args) => { LogInfo("Postprocessing Metadata"); if (args.Error != null) { LogError(args.Error.ToString(), args); MessageBox.Show(args.Error.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } var emds = (Logic.SystemComparer)args.Result; CreateListFromResults(emds); }, ProgressChanged = e => { SetWorkingMessage(e.UserState.ToString()); } }); }
private void CreateListFromResults(Logic.SystemComparer emds) { SendMessageToStatusBar?.Invoke(this, new StatusBarMessageEventArgs(0, $"Generating List")); comparisonListView.Items.Clear(); /*OrganizationComparer orgComparer = new OrganizationComparer(); * MetadataComparison orgComparison = null; * orgComparison = orgComparer.Compare("Organization", emds._sourceCustomizationRoot.Organizations, * emds._targetCustomizationRoot.Organizations);*/ if (_configuration.IncludeViews) { SendMessageToStatusBar?.Invoke(this, new StatusBarMessageEventArgs(0, "Processing Views...")); EntityComparer viewComparer = new EntityComparer(); MetadataComparison viewComparison = viewComparer.Compare("Views", emds.SourceCustomizationRoot.Views, emds.TargetCustomizationRoot.Views); AddItem(viewComparison, null); } if (_configuration.IncludeForms) { SendMessageToStatusBar?.Invoke(this, new StatusBarMessageEventArgs(33, "Processing Forms...")); EntityComparer formComparer = new EntityComparer(); MetadataComparison formComparison = formComparer.Compare("Forms", emds.SourceCustomizationRoot.Forms, emds.TargetCustomizationRoot.Forms); AddItem(formComparison, null); } SendMessageToStatusBar?.Invoke(this, new StatusBarMessageEventArgs(66, "Processing Forms...")); MetadataComparer comparer = new MetadataComparer(_configuration); MetadataComparison comparison = comparer.Compare("Entities", emds.SourceCustomizationRoot.EntitiesRaw, emds.TargetCustomizationRoot.EntitiesRaw); AddItem(comparison, null); SendMessageToStatusBar?.Invoke(this, new StatusBarMessageEventArgs("List generated!")); }
private void LoadEntities() { _systemComparer = new Logic.SystemComparer(_sourceConnection, _targetConnection); WorkAsync(new WorkAsyncInfo { Message = "Getting Metadata", Work = (worker, args) => { LogInfo("Start retrieving metadata on Source"); _systemComparer.RetrieveMetadata(ConnectionType.Source, _configuration.IncludeAttributeMetadata, worker.ReportProgress); //_systemComparer.RetrieveOrganization(ConnectionType.Source, worker.ReportProgress); _systemComparer.RetrieveForms(ConnectionType.Source, _configuration.IncludeForms, worker.ReportProgress); _systemComparer.RetrieveViews(ConnectionType.Source, _configuration.IncludeViews, worker.ReportProgress); LogInfo("Start retrieving metadata on Target"); _systemComparer.RetrieveMetadata(ConnectionType.Target, _configuration.IncludeAttributeMetadata, worker.ReportProgress); //_systemComparer.RetrieveOrganization(ConnectionType.Target, worker.ReportProgress); _systemComparer.RetrieveForms(ConnectionType.Target, _configuration.IncludeForms, worker.ReportProgress); _systemComparer.RetrieveViews(ConnectionType.Target, _configuration.IncludeViews, worker.ReportProgress); args.Result = _systemComparer; }, PostWorkCallBack = (args) => { LogInfo("Postprocessing Metadata"); if (args.Error != null) { LogError(args.Error.ToString(), args); MessageBox.Show(args.Error.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } var emds = (Logic.SystemComparer)args.Result; comparisonListView.Items.Clear(); /*OrganizationComparer orgComparer = new OrganizationComparer(); * MetadataComparison orgComparison = null; * orgComparison = orgComparer.Compare("Organization", emds._sourceCustomizationRoot.Organizations, * emds._targetCustomizationRoot.Organizations);*/ if (_configuration.IncludeViews) { EntityComparer viewComparer = new EntityComparer(); MetadataComparison viewComparison = viewComparer.Compare("Views", emds._sourceCustomizationRoot.Views, emds._targetCustomizationRoot.Views); AddItem(viewComparison, null); } if (_configuration.IncludeForms) { EntityComparer formComparer = new EntityComparer(); MetadataComparison formComparison = formComparer.Compare("Forms", emds._sourceCustomizationRoot.Forms, emds._targetCustomizationRoot.Forms); AddItem(formComparison, null); } MetadataComparer comparer = new MetadataComparer(); MetadataComparison comparison = comparer.Compare("Entities", emds._sourceCustomizationRoot.EntitiesRaw, emds._targetCustomizationRoot.EntitiesRaw); AddItem(comparison, null); }, ProgressChanged = e => { SetWorkingMessage(e.UserState.ToString()); } }); }