/// <summary> /// Get the composite service. /// </summary> /// <param name="section">The config section group and section name.</param> /// <returns>The service; else null.</returns> public CompositeServiceTypeCatalogCollection GetServiceTypes(string section = "CompositeGroup/CompositeServices") { CompositeServiceTypeCatalogCollection serviceCol = null; try { //Refreshes the named section so the next time that it is retrieved it will be re-read from disk. System.Configuration.ConfigurationManager.RefreshSection(section); // Create a new default host type // an load the values from the configuration // file into the default host type. CompositeServices defaultHost = (CompositeServices)System.Configuration.ConfigurationManager.GetSection(section); // Get the list of assembly paths used to load the composite servers. serviceCol = defaultHost.ServiceTypeCatalogSection; return(serviceCol); } catch (Exception) { return(null); } }
/// <summary> /// Get the composite service. /// </summary> /// <param name="name">The specific service name to search for the path.</param> /// <param name="section">The config section group and section name.</param> /// <returns>The service; else null.</returns> public CompositeServiceTypeCatalogElement GetServiceType(string name, string section = "CompositeGroup/CompositeServices") { CompositeServiceTypeCatalogElement service = null; try { //Refreshes the named section so the next time that it is retrieved it will be re-read from disk. System.Configuration.ConfigurationManager.RefreshSection(section); // Create a new default host type // an load the values from the configuration // file into the default host type. CompositeServices defaultHost = (CompositeServices)System.Configuration.ConfigurationManager.GetSection(section); // Get the list of assembly paths used to load the composite servers. CompositeServiceTypeCatalogCollection serviceCol = defaultHost.ServiceTypeCatalogSection; // If a service has not been found. if (service == null) { if (serviceCol != null) { // For each service found foreach (CompositeServiceTypeCatalogElement item in serviceCol) { // If a name has been specified. if (item.Name.ToLower() == name.ToLower()) { // Return this service. service = item; break; } } } } return(service); } catch (Exception) { return(null); } }