Example #1
0
        /// <summary>
        /// Default constructor.
        /// </summary>
        public CompositeServiceTypeCatalogCollection()
        {
            // Get the current host element.
            CompositeServiceTypeCatalogElement host =
                (CompositeServiceTypeCatalogElement)CreateNewElement();

            // Add the element to the collection.
            Add(host);
        }
Example #2
0
        /// <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);
            }
        }
Example #3
0
 /// <summary>
 /// Add a new host element type to the collection.
 /// </summary>
 /// <param name="element">The current host element.</param>
 public void Add(CompositeServiceTypeCatalogElement element)
 {
     // Add the element to the base
     // ConfigurationElementCollection type.
     BaseAdd(element);
 }