当前位置: 首页>>代码示例>>C#>>正文


C# DictionaryConfigurationSource.GetSection方法代码示例

本文整理汇总了C#中Microsoft.Practices.EnterpriseLibrary.Common.Configuration.DictionaryConfigurationSource.GetSection方法的典型用法代码示例。如果您正苦于以下问题:C# DictionaryConfigurationSource.GetSection方法的具体用法?C# DictionaryConfigurationSource.GetSection怎么用?C# DictionaryConfigurationSource.GetSection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Microsoft.Practices.EnterpriseLibrary.Common.Configuration.DictionaryConfigurationSource的用法示例。


在下文中一共展示了DictionaryConfigurationSource.GetSection方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Then_ConfigurationSourceContainsSecuritySettings

        public void Then_ConfigurationSourceContainsSecuritySettings()
        {
            IConfigurationSource source = new DictionaryConfigurationSource();
            configurationSourceBuilder.UpdateConfigurationWithReplace(source);

            Assert.IsNotNull(source.GetSection(SecuritySettings.SectionName));
        }
开发者ID:jmeckley,项目名称:Enterprise-Library-5.0,代码行数:7,代码来源:SecuritySettingsExtensionFixture.cs

示例2: Arrange

        protected override void Arrange()
        {
            base.Arrange();

            validator = new LogFormatterValidator();

            errors = new List<ValidationResult>();

            IConfigurationSource source = new DictionaryConfigurationSource();
            ConfigurationSourceBuilder sourceBuiler = new ConfigurationSourceBuilder();

            sourceBuiler.ConfigureExceptionHandling()
                            .GivenPolicyWithName("policy")
                                .ForExceptionType<Exception>()
                                    .LogToCategory("category")
                                        .UsingExceptionFormatter<BadImageFormatException>();

            sourceBuiler.UpdateConfigurationWithReplace(source);

            ExceptionHandlingSettings EhabSettings = (ExceptionHandlingSettings)source.GetSection(ExceptionHandlingSettings.SectionName);

            var sectionModel = SectionViewModel.CreateSection(Container, "Ehab Section", EhabSettings);

            properties = sectionModel.GetDescendentsOfType<LoggingExceptionHandlerData>().First().Properties;
        }
开发者ID:HondaBey,项目名称:EnterpriseLibrary6,代码行数:25,代码来源:when_selecting_a_formatter.cs

示例3: Arrange

        protected override void Arrange()
        {
            base.Arrange();

            var builder = new ConfigurationSourceBuilder();
            builder.ConfigureLogging()
                        .LogToCategoryNamed("category")
                            .SendTo
                                .EventLog("listener")
                        .SpecialSources
                            .AllEventsCategory
                                .SendTo
                                    .EventLog("listener")
                        .SpecialSources
                            .LoggingErrorsAndWarningsCategory
                                .SendTo
                                    .EventLog("listener")
                        .SpecialSources
                            .UnprocessedCategory
                                .SendTo
                                    .EventLog("listener");


            var source = new DictionaryConfigurationSource();
            builder.UpdateConfigurationWithReplace(source);

            ElementLookup = Container.Resolve<ElementLookup>();
            LoggingSection = (LoggingSettings)source.GetSection(LoggingSettings.SectionName);
        }
开发者ID:jmeckley,项目名称:Enterprise-Library-5.0,代码行数:29,代码来源:when_adding_a_new_element.cs

示例4: GetSecuritySettings

        protected SecuritySettings GetSecuritySettings()
        {
            IConfigurationSource source = new DictionaryConfigurationSource();
            configurationSourceBuilder.UpdateConfigurationWithReplace(source);

            return (SecuritySettings)source.GetSection(SecuritySettings.SectionName);
        }
开发者ID:jmeckley,项目名称:Enterprise-Library-5.0,代码行数:7,代码来源:AuthorizeUsingAzManExtensionFixture.cs

示例5: Arrange

        protected override void Arrange()
        {
            base.Arrange();

            IConfigurationSource source = new DictionaryConfigurationSource();
            ConfigurationSourceBuilder sourceBuiler = new ConfigurationSourceBuilder();

            sourceBuiler.ConfigureLogging()
                .WithOptions.DisableTracing()
                .DoNotRevertImpersonation()
                .FilterOnPriority("prio filter").StartingWithPriority(10)
                .FilterOnCategory("categoryFiler").AllowAllCategoriesExcept("cat1")
                .LogToCategoryNamed("General")
                .SendTo.EventLog("Event Log Listener")
                .FormatWith(new FormatterBuilder().TextFormatterNamed("Default"))
                .LogToCategoryNamed("Critical")
                .SendTo.SharedListenerNamed("Event Log Listener")
                .SendTo.Custom<MyCustomListener>("Custom Listener")
                .SendTo.Email("Email Listener")
                .SendTo.SystemDiagnosticsListener("system diagnostics")
                .LogToCategoryNamed("msmq")
                .SendTo.Msmq("msmq");

            sourceBuiler.UpdateConfigurationWithReplace(source);
            LoggingSection = (LoggingSettings)source.GetSection(LoggingSettings.SectionName);
        }
开发者ID:HondaBey,项目名称:EnterpriseLibrary6,代码行数:26,代码来源:LoggingConfigurationContext.cs

示例6: Then_ConfigurationSourceContainsTypeRegistrationProviderSettings

        public void Then_ConfigurationSourceContainsTypeRegistrationProviderSettings()
        {
            IConfigurationSource source = new DictionaryConfigurationSource();
            base.ConfigurationSourceBuilder.UpdateConfigurationWithReplace(source);

            Assert.IsNotNull(source.GetSection(TypeRegistrationProvidersConfigurationSection.SectionName));
        }
开发者ID:jmeckley,项目名称:Enterprise-Library-5.0,代码行数:7,代码来源:TypeRegistrationProviderConfigurationSourceBuilderExtensionFixture.cs

示例7: Then_ConfigurationSourceContainsLoggingSettings

        public void Then_ConfigurationSourceContainsLoggingSettings()
        {
            var configurationSource = new DictionaryConfigurationSource();
            ConfigurationSourceBuilder.UpdateConfigurationWithReplace(configurationSource);

            Assert.IsNotNull(configurationSource.GetSection(LoggingSettings.SectionName));
        }
开发者ID:jmeckley,项目名称:Enterprise-Library-5.0,代码行数:7,代码来源:ConfigurationSourceBuilderFixture.cs

示例8: GetExceptionPolicyData

        protected ExceptionPolicyData GetExceptionPolicyData()
        {
            var source = new DictionaryConfigurationSource();
            configurationSourceBuilder.UpdateConfigurationWithReplace(source);

            return ((ExceptionHandlingSettings)source.GetSection(ExceptionHandlingSettings.SectionName))
                .ExceptionPolicies.Get(policyName);
        }
开发者ID:jmeckley,项目名称:Enterprise-Library-5.0,代码行数:8,代码来源:ConfigurationSourceBuilderExtensionsFixture.cs

示例9: Then_ThereAreNoTypeRegistrations

        public void Then_ThereAreNoTypeRegistrations()
        {
            IConfigurationSource source = new DictionaryConfigurationSource();
            base.ConfigurationSourceBuilder.UpdateConfigurationWithReplace(source);

            TypeRegistrationProvidersConfigurationSection section = (TypeRegistrationProvidersConfigurationSection)source.GetSection(TypeRegistrationProvidersConfigurationSection.SectionName);

            Assert.AreEqual(0, section.TypeRegistrationProviders.Count);
        }
开发者ID:jmeckley,项目名称:Enterprise-Library-5.0,代码行数:9,代码来源:TypeRegistrationProviderConfigurationSourceBuilderExtensionFixture.cs

示例10: Arrange

        protected override void Arrange()
        {
            base.Arrange();

            var builder = new ConfigurationSourceBuilder();
            builder.ConfigureData()
                .ForDatabaseNamed("SomeOracleDatabase")
                    .ThatIs.AnOracleDatabase()
                    .WithConnectionString("SomeOracleConnectionString")
                .ForDatabaseNamed("SomeOleDbDatabase")
                    .ThatIs.AnOleDbDatabase()
                    .WithConnectionString("Some OleDb ConnectionString")
                    .AsDefault();

            var source = new DictionaryConfigurationSource();
            builder.UpdateConfigurationWithReplace(source);

            var configSourceModel = Container.Resolve<ConfigurationSourceModel>();
            configSourceModel.AddSection(DatabaseSettings.SectionName, source.GetSection(DatabaseSettings.SectionName));
            ConnectionStringSection = configSourceModel.AddSection("connectionStrings", source.GetSection("connectionStrings"));
        }
开发者ID:HondaBey,项目名称:EnterpriseLibrary6,代码行数:21,代码来源:when_picking_existing_connection.cs

示例11: Arrange

        protected override void Arrange()
        {
            base.Arrange();

            ConfigurationSourceBuilder builder = new ConfigurationSourceBuilder();
            builder.ConfigureSecurity()
                .AuthorizeUsingCustomProviderNamed("custom authz", typeof(IAuthorizationProvider))
                .AuthorizeUsingRuleProviderNamed("ruleProvider")
                .SpecifyRule("rule1", "true")
                .SpecifyRule("rule2", "false")
                .CacheSecurityInCacheStoreNamed("cache Storage").WithOptions.UseSharedCacheManager("cache");

            DictionaryConfigurationSource source = new DictionaryConfigurationSource();
            builder.UpdateConfigurationWithReplace(source);


            securitySettings = (SecuritySettings)source.GetSection(SecuritySettings.SectionName);
        }
开发者ID:jmeckley,项目名称:Enterprise-Library-5.0,代码行数:18,代码来源:given_security_configuration.cs

示例12: Arrange

        protected override void Arrange()
        {
            base.Arrange();

            DictionaryConfigurationSource source = new DictionaryConfigurationSource();
            ConfigurationSourceBuilder sourceBuilder = new ConfigurationSourceBuilder();

            sourceBuilder.ConfigureCaching()
                .ForCacheManagerNamed("Cache Manager 1")
                .StoreInMemory()
                .ForCacheManagerNamed("Cache Manager 2")
                .StoreInSharedBackingStore("database store")
                .ForCacheManagerNamed("Cache Manager 3")
                .StoreCacheMangerItemsInDatabase("database store")
                .EncryptUsing.SymmetricEncryptionProviderNamed("crypto thingy")
                .UsingSharedSymmetricEncryptionInstanceNamed("symm instance");

            sourceBuilder.UpdateConfigurationWithReplace(source);
            CachingConfiguration = (CacheManagerSettings)source.GetSection(CacheManagerSettings.SectionName);
            
            var sourceModel = Container.Resolve<ConfigurationSourceModel>();
            CachingViewModel = sourceModel.AddSection(CacheManagerSettings.SectionName, CachingConfiguration);
        }
开发者ID:jmeckley,项目名称:Enterprise-Library-5.0,代码行数:23,代码来源:CachingConfigurationContext.cs

示例13: GetTypeRegistrationSection

        protected TypeRegistrationProvidersConfigurationSection GetTypeRegistrationSection()
        {
            IConfigurationSource source = new DictionaryConfigurationSource();
            base.ConfigurationSourceBuilder.UpdateConfigurationWithReplace(source);

            TypeRegistrationProvidersConfigurationSection section = (TypeRegistrationProvidersConfigurationSection)source.GetSection(TypeRegistrationProvidersConfigurationSection.SectionName);

            return section;
        }
开发者ID:jmeckley,项目名称:Enterprise-Library-5.0,代码行数:9,代码来源:TypeRegistrationProviderConfigurationSourceBuilderExtensionFixture.cs


注:本文中的Microsoft.Practices.EnterpriseLibrary.Common.Configuration.DictionaryConfigurationSource.GetSection方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。