/// <summary> /// Executes the task. /// </summary> /// <returns>Indicating if the task was successful.</returns> public override bool Execute() { BizTalkCatalogExplorer bizTalkCatalogExplorer = new BizTalkCatalogExplorer(ManagementDatabaseConnectionString); if (bizTalkCatalogExplorer.ApplicationExists(ApplicationName)) { BizTalkApplication bizTalkApplication = new BizTalkApplication( ManagementDatabaseConnectionString, ApplicationName); if (this.TerminateOrchestrations) { Log.LogMessage("Disabling all Receive Locations for BizTalk application '{0}'.", ApplicationName); bizTalkApplication.DisableAllReceiveLocations(); Log.LogMessage("Terminating all Orchestrations for BizTalk application '{0}'.", ApplicationName); bizTalkApplication.TerminateAllOrchestrations(); } Log.LogMessage("Bringing BizTalk application '{0}' to a complete stop.", ApplicationName); bizTalkApplication.StopAll(); } else { Log.LogMessage("Skipping stopping of BizTalk application '{0}' as none exist matching that name.", ApplicationName); } return true; }
/// <summary> /// Executes the task. /// </summary> /// <returns>Indicating if the task was successful.</returns> public override bool Execute() { BizTalkCatalogExplorer bizTalkCatalogExplorer = new BizTalkCatalogExplorer(ManagementDatabaseConnectionString); if (bizTalkCatalogExplorer.ApplicationExists(ApplicationName)) { Log.LogMessage("A BizTalk application with the name '{0}' already exists.", ApplicationName); return false; } Log.LogMessage("Creating a BizTalk application with the name '{0}'.", ApplicationName); bizTalkCatalogExplorer.CreateApplication(this.ApplicationName); return true; }
/// <summary> /// Executes the task. /// </summary> /// <returns>Indicating if the task was successful.</returns> public override bool Execute() { BizTalkCatalogExplorer bizTalkCatalogExplorer = new BizTalkCatalogExplorer(ManagementDatabaseConnectionString); if (ApplicationName.EndsWith("*", StringComparison.OrdinalIgnoreCase)) { string applicationNameToMatch = ApplicationName.Substring(0, ApplicationName.Length - 1); string[] applicationNames = bizTalkCatalogExplorer.GetApplicationNames(); foreach (string applicationName in applicationNames) { if (applicationName.StartsWith(applicationNameToMatch, StringComparison.OrdinalIgnoreCase)) { Log.LogMessage("Removing BizTalk application '{0}'...", applicationName); bizTalkCatalogExplorer.RemoveApplication(applicationName); Log.LogMessage("...BizTalk application '{0}' successfully removed.", applicationName); } } } else if (bizTalkCatalogExplorer.ApplicationExists(ApplicationName)) { Log.LogMessage("Removing BizTalk application '{0}'...", ApplicationName); bizTalkCatalogExplorer.RemoveApplication(ApplicationName); Log.LogMessage("...BizTalk application '{0}' successfully removed.", ApplicationName); } else { Log.LogMessage("No matches were found for BizTalk application named '{0}', skipping removal.", ApplicationName); } return true; }