• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# ConfigurationManager类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中ConfigurationManager的典型用法代码示例。如果您正苦于以下问题:C# ConfigurationManager类的具体用法?C# ConfigurationManager怎么用?C# ConfigurationManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ConfigurationManager类属于命名空间,在下文中一共展示了ConfigurationManager类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Manager

 private Manager()
 {
     ConfigurationManager = new ConfigurationManager();
     InstanceManager = new InstanceManager();
     VersionManager = new VersionManager();
     DownloadManager = new DownloadManager();
 }
开发者ID:Ghosttje,项目名称:GhostLauncher,代码行数:7,代码来源:Manager.cs


示例2: OpenIdConnectCachingSecurityTokenProvider

        public OpenIdConnectCachingSecurityTokenProvider(string metadataEndpoint)
        {
            _metadataEndpoint = metadataEndpoint;
            _configManager = new ConfigurationManager<OpenIdConnectConfiguration>(metadataEndpoint);

            RetrieveMetadata();
        }
开发者ID:dstrockis,项目名称:aad-msa-channel9-demo,代码行数:7,代码来源:OpenIdConnectCachingSecurityTokenProvider.cs


示例3: btnCreate_Click

        private void btnCreate_Click(object sender, RoutedEventArgs e)
        {
            if (txtAppId.Text.IsNullOrEmpty())
            {
                MessageBox.Show("Application Id не может быть пустым");
                return;
            }

            using (ConfigurationManager man = new ConfigurationManager())
            {
                UserData data = new UserData();
                data.UserName = txtUserName.Text;
                data.Password = txtUserPassword.Text;
                data.Email = txtEmail.Text;

                data.AppId = long.Parse(txtAppId.Text);
                data.AccessKey = txtAccessKey.Text;
                if (man.CreateUser(data))
                    MessageBox.Show("Пользователь успешено создан", "Информация", MessageBoxButton.OK,
                         MessageBoxImage.Information);

                else
                    MessageBox.Show("Ошибка создания пользователя", "Информация", MessageBoxButton.OK,
                         MessageBoxImage.Error);
            }
            Refresh();
        }
开发者ID:OleksandrKulchytskyi,项目名称:VkManager,代码行数:27,代码来源:SelectUserWindow.xaml.cs


示例4: XrmUriEditor

        internal XrmUriEditor(ConfigurationManager configManager)
        {
            InitializeComponent();

            this.configManager = configManager;
            XrmUri = new XrmUri();
        }
开发者ID:bzamecnik,项目名称:XRouter,代码行数:7,代码来源:XrmUriEditor.xaml.cs


示例5: OnStart

        protected override void OnStart(string[] args)
        {
            logger.Info("Starting service...");

            try
            {
                container = new UnityContainer();
                container.RegisterInstance(container);
                ServiceLocator.SetLocatorProvider(() => new UnityServiceLocator(container));

                configuration = new ConfigurationManager(HostMetadata.PortalApp, SpecialFolder.CommonApplicationData);
                container.RegisterInstance(configuration);

                settings = configuration.GetSection<PortalSettings>(PortalSettings.SectionKey);
                container.RegisterInstance(settings);

                loginSettings = configuration.GetSection<LoginSettings>(LoginSettings.SectionKey);
                container.RegisterInstance(loginSettings);

                portalServiceSettings = configuration.GetSection<PortalServiceSettings>(PortalServiceSettings.SectionKey);
                container.RegisterInstance(portalServiceSettings);

                portal = new PortalInstance(settings, loginSettings);
                portal.Start();

                logger.Info("Service started");
            }
            catch (Exception e)
            {
                logger.Error(e);
                throw;
            }
        }
开发者ID:breslavsky,项目名称:queue,代码行数:33,代码来源:PortalService.cs


示例6: LoadOpenIdConnectConfigurationAsync

        private async Task LoadOpenIdConnectConfigurationAsync()
        {
            var discoAddress = _settings.Authority + "/.well-known/openid-configuration";

            var manager = new ConfigurationManager<OpenIdConnectConfiguration>(discoAddress);
            _config = await manager.GetConfigurationAsync();
        }
开发者ID:RobGibbens,项目名称:IdentityServer3.Samples,代码行数:7,代码来源:LoginWebView.xaml.cs


示例7: Main

        public static int Main(string [] args)
        {
            var configurationManager = new ConfigurationManager ();
            if (!configurationManager.LoadCommandLineArgs (args))
                return 1;

            // Show the help and exit.
            if (configurationManager.Help) {
                configurationManager.PrintHelp ();
            #if DEBUG
                Console.WriteLine ("Press any key...");
                Console.ReadKey ();
            #endif
                return 0;
            }

            // Show the version and exit.
            if (configurationManager.Version) {
                Version.Show ();
                return 0;
            }

            if (!configurationManager.LoadConfigFile ())
                return 1;

            configurationManager.SetupLogger ();

            #if DEBUG
            // Log everything while debugging
            Logger.Level = LogLevel.All;
            #endif

            Logger.Write (LogLevel.Debug, Assembly.GetExecutingAssembly ().GetName ().Name);

            string configDir = configurationManager.ConfigDir;
            if (String.IsNullOrEmpty (configDir)) {
                Logger.Write (LogLevel.Error, "You MUST provide a configuration directory with the --config-dir parameter");
                return 1;
            }

            var configDirInfo = new DirectoryInfo (configDir);
            if (!configDirInfo.Exists) {
                Logger.Write (LogLevel.Error, "The configuration directory \"{0}\" does not exist!", configDir);
                return 1;
            }

            Logger.Write (LogLevel.Debug, "Configuration directory exists, loading configuration files");

            ChildrenManager.StartChildren (configDirInfo.GetFiles("*.xml"), configurationManager);

            if (!configurationManager.Stoppable)
                return 0;

            Console.WriteLine ("Hit Return to stop the server.");
            Console.ReadLine ();

            ChildrenManager.TermChildren();
            ChildrenManager.KillChildren();
            return 0;
        }
开发者ID:ryepup,项目名称:xsp,代码行数:60,代码来源:main.cs


示例8: MainForm

        public MainForm()
        {
            InitializeComponent();

            var container = new UnityContainer();
            container.RegisterInstance(container);
            ServiceLocator.SetLocatorProvider(() => new UnityServiceLocator(container));

            string exePath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), HostMetadata.PortalServiceExe);
            serviceManager = new ServiceManager(HostMetadata.PortalServiceName, exePath);

            configuration = new ConfigurationManager(HostMetadata.PortalApp, Environment.SpecialFolder.CommonApplicationData);
            container.RegisterInstance(configuration);

            settings = configuration.GetSection<PortalSettings>(PortalSettings.SectionKey);
            container.RegisterInstance(settings);

            portalSettingsBindingSource.DataSource = settings;

            loginSettings = configuration.GetSection<LoginSettings>(LoginSettings.SectionKey);
            container.RegisterInstance(loginSettings);

            loginSettingsControl.Settings = loginSettings;

            portalServiceSettings = configuration.GetSection<PortalServiceSettings>(PortalServiceSettings.SectionKey);
            container.RegisterInstance(portalServiceSettings);

            portalServiceSettingsBindingSource.DataSource = portalServiceSettings;

            loginSettingsControl.UserRole = UserRole.Administrator;
        }
开发者ID:breslavsky,项目名称:queue,代码行数:31,代码来源:MainForm.cs


示例9: AlwaysSerialize_WithUnchangedProperty_SerializesPropertyAnyway

        public void AlwaysSerialize_WithUnchangedProperty_SerializesPropertyAnyway()
        {
            // Arrange
            var secondary = new Config
                {
                    Age = 12,
                    Name = "Timothy"
                };

            var primary = new Config();

            var expected = new Config
                {
                    Name = "Timothy"
                };

            var configManager = new ConfigurationManager<Config>(
                new DummyConfigurationSource<Config>(secondary),
                new DummyConfigurationSource<Config>(primary));

            configManager.AlwaysSerialize(t => t.Name);

            var actualManager = new DummyConfigurationSource<Config>(new Config());
            configManager.SaveChanges(actualManager);

            Assert.IsTrue(new ConfigComparer().Equals(
                expected, actualManager.SavedObject));
        }
开发者ID:ZhangYueqiu,项目名称:smartconf,代码行数:28,代码来源:SmartConfUnitTest.cs


示例10: OnStart

        protected override void OnStart(string[] args)
        {
            logger.Info("Starting service...");

            try
            {
                container = new UnityContainer();
                container.RegisterInstance(container);
                ServiceLocator.SetLocatorProvider(() => new UnityServiceLocator(container));

                configuration = new ConfigurationManager(HostMetadata.ServerApp, SpecialFolder.CommonApplicationData);
                container.RegisterInstance(configuration);

                settings = configuration.GetSection<ServerSettings>(ServerSettings.SectionKey);
                container.RegisterInstance(settings);

                templateServiceSettings = configuration.GetSection<TemplateServiceSettings>(TemplateServiceSettings.SectionKey);
                container.RegisterInstance(templateServiceSettings);

                var culture = settings.Language.GetCulture();
                Thread.CurrentThread.CurrentCulture = culture;
                CultureInfo.DefaultThreadCurrentCulture = culture;

                server = new ServerInstance(settings);
                server.Start();

                logger.Info("Service started");
            }
            catch (Exception e)
            {
                logger.Error(e);
                throw;
            }
        }
开发者ID:breslavsky,项目名称:queue,代码行数:34,代码来源:ServerService.cs


示例11: Analyze_EmptyFile_ThrowsException

        public void Analyze_EmptyFile_ThrowsException()
        {
            LoggingFacility.Logger = Substitute.For<ILogger>();

            ConfigurationManager cm = new ConfigurationManager();
            bool configured = cm.IsConfigured("something");
            //rest of test
        }
开发者ID:ndphuong,项目名称:aout2,代码行数:8,代码来源:Listing7.1.cs


示例12: Init

        public void Init()
        {
            InitCache();

            _confMan = ConfigurationManager.Instance;
            Isolate.WhenCalled(() => _confMan.AddInMemorySqLiteEnvironment<TestMapping>("Test")).CallOriginal();
            RepositoryFixture.CreateInMemorySqLiteRepository<TestMapping>("Test");
        }
开发者ID:rdvanbuuren,项目名称:NhRepository,代码行数:8,代码来源:TheFactoryMethodCreateInMemoryEntityRepositoryShould.cs


示例13: ClearTheFakeObject

 public void ClearTheFakeObject()
 {
     _fackProjObj = null;
     _fakeActiveConfiguration = null;
     _fakeConfigurationManager = null;
     _fakeCollection = null;
     _fakeVcConfiguration = null;
 }
开发者ID:God-Staff,项目名称:vs-boost-unit-test-adapter,代码行数:8,代码来源:ProjectOutPutCheckerVs12Nunit.cs


示例14: Analyze_EmptyFile_ThrowsException

 public void Analyze_EmptyFile_ThrowsException()
 {
    FakeTheLogger();
    
    ConfigurationManager cm = new ConfigurationManager();
    bool configured = cm.IsConfigured("something");
     //rest of test
 }
开发者ID:ndphuong,项目名称:aout2,代码行数:8,代码来源:Listing7.2.cs


示例15: DoProjectConfigurations

 private static void DoProjectConfigurations(
     ConfigurationManager configurationManager
     )
 {
     foreach (Configuration configuration in configurationManager)
     {
         DoProjectConfiguration(configuration);
     }
 }
开发者ID:dpvreony,项目名称:nucleotide,代码行数:9,代码来源:Build.cs


示例16: Test1_Test2Result_Null

        public void Test1_Test2Result_Null()
        {
            IResultConnectionString expected = new Test1_ResultConnectionString();

            var conf = new ConfigurationManager(ConfigurationManager.GetAssemblyPath(typeof(TestConfigurationManager)));
            var result = conf.ConnectionStrings.ConnectionStrings[expected.ConnectionStringName];

            Assert.IsNull(result);
        }
开发者ID:BLun78,项目名称:Blun.ConfigurationManager,代码行数:9,代码来源:TestConfigurationManager.cs


示例17: Test1_Test2Result_Ok

        public void Test1_Test2Result_Ok()
        {
            IResultConnectionString expected = new Test1_ResultConnectionString();

            var conf = new ConfigurationManager(ConfigurationManager.GetAssemblyPath(typeof(Test1_ResultAppKey)));
            var result = conf.ConnectionStrings.ConnectionStrings[expected.ConnectionStringName];

            Assert.AreEqual(expected.Result, result.ConnectionString);
        }
开发者ID:BLun78,项目名称:Blun.ConfigurationManager,代码行数:9,代码来源:TestConfigurationManager.cs


示例18: Test1_Test1Result_Null

        public void Test1_Test1Result_Null()
        {
            IResultAppKey expected = new Test1_ResultAppKey();

            var conf = new ConfigurationManager(ConfigurationManager.GetAssemblyPath(typeof(TestConfigurationManager)));
            var result = conf.AppSettings.Settings[expected.AppSettingsKey];

            Assert.IsNull(result);
        }
开发者ID:BLun78,项目名称:Blun.ConfigurationManager,代码行数:9,代码来源:TestConfigurationManager.cs


示例19: Test1_Test1Result_Ok

        public void Test1_Test1Result_Ok()
        {
            IResultAppKey expected = new Test1_ResultAppKey();

            var conf = new ConfigurationManager(ConfigurationManager.GetAssemblyPath(typeof(Test1_ResultAppKey)));
            var result = conf.AppSettings.Settings[expected.AppSettingsKey];

            Assert.AreEqual(expected.Result, result.Value);
        }
开发者ID:BLun78,项目名称:Blun.ConfigurationManager,代码行数:9,代码来源:TestConfigurationManager.cs


示例20: TestConfigurationDeserialization

        public void TestConfigurationDeserialization()
        {
            var config = new ConfigurationManager().LoadFile<HomeAutomationConfiguration>("HomeAutomation.Applications.Tests/Config/HomeAutomationConfiguration.json");

            Assert.IsNotNull(config);

            Assert.AreEqual(1, config.DeviceNetworks.Count);
            Assert.AreEqual(4, config.DeviceTypes.Count);
        }
开发者ID:moszinet,项目名称:HomeAutomation,代码行数:9,代码来源:ConfigurationDeserializationTests.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ConfigurationPropertyHolder类代码示例发布时间:2022-05-24
下一篇:
C# ConfigurationExpression类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap