Example #1
0
 /// <summary>
 /// Resets the resource connection provider to its original state
 /// </summary>
 public static void Reset()
 {
     if (AppConfigurationManager.IsSectionDefined(DEFAULT_SECTION_NAME))
     {
         Configure(DEFAULT_SECTION_NAME);
     }
 }
Example #2
0
        public void IsSeectionDefinedWorksAsExpected()
        {
            // --- Act
            var test1 = AppConfigurationManager.IsSectionDefined("TypeResolver");
            var test2 = AppConfigurationManager.IsSectionDefined("nonExisting");

            // --- Assert
            test1.ShouldBeTrue();
            test2.ShouldBeFalse();
        }
        /// <summary>
        /// Configures the configurable part of the service manager from the
        /// specified section
        /// </summary>
        /// <param name="sectionName">Name of the configuration section</param>
        public static void ConfigureFrom(string sectionName)
        {
            var registry = new DefaultServiceRegistry();

            if (AppConfigurationManager.IsSectionDefined(sectionName))
            {
                registry.GetConfigurableContainer().ConfigureFrom(AppConfigurationManager
                                                                  .GetSettings <ServiceContainerSettings>(sectionName));
            }
            ServiceRegistry = registry;
        }