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


C# IConfigurationProvider.GetConfigurationSettingValue方法代码示例

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


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

示例1: ConfigureAuth

        public void ConfigureAuth(IAppBuilder app, IConfigurationProvider configProvider)
        {
            string aadClientId = configProvider.GetConfigurationSettingValue("ida.AADClientId");
            string aadInstance = configProvider.GetConfigurationSettingValue("ida.AADInstance");
            string aadTenant = configProvider.GetConfigurationSettingValue("ida.AADTenant");
            string authority = string.Format(CultureInfo.InvariantCulture, aadInstance, aadTenant);

            app.SetDefaultSignInAsAuthenticationType(CookieAuthenticationDefaults.AuthenticationType);

            app.UseCookieAuthentication(new CookieAuthenticationOptions());

            app.UseOpenIdConnectAuthentication(
                new OpenIdConnectAuthenticationOptions
                {
                    ClientId = aadClientId,
                    Authority = authority,
                    Notifications = new OpenIdConnectAuthenticationNotifications
                    {
                        AuthenticationFailed = context =>
                        {
                            string appBaseUrl = context.Request.Scheme + "://" + context.Request.Host + context.Request.PathBase;

                            context.ProtocolMessage.RedirectUri = appBaseUrl + "/";
                            context.HandleResponse();
                            context.Response.Redirect(context.ProtocolMessage.RedirectUri);

                            return Task.FromResult(0);
                        }
                    }
                });
        }
开发者ID:Azure,项目名称:azure-iot-remote-monitoring,代码行数:31,代码来源:Startup.Auth.cs

示例2: DocDbRestHelper

 public DocDbRestHelper(IConfigurationProvider configProvider)
 {
     this._docDbEndpoint = configProvider.GetConfigurationSettingValue("docdb.EndpointUrl");
     this._docDbKey = configProvider.GetConfigurationSettingValue("docdb.PrimaryAuthorizationKey");
     this._dbName = configProvider.GetConfigurationSettingValue("docdb.DatabaseId");
     this._collectionName = configProvider.GetConfigurationSettingValue("docdb.DocumentCollectionId");
 }
开发者ID:smartpcr,项目名称:azure-iot-remote-monitoring,代码行数:7,代码来源:DocDbRestHelper.cs

示例3: ActionMappingRepository

 public ActionMappingRepository(IConfigurationProvider configurationProvider, IBlobStorageClientFactory blobStorageClientFactory)
 {
     string blobName = configurationProvider.GetConfigurationSettingValue("ActionMappingStoreBlobName");
     string connectionString = configurationProvider.GetConfigurationSettingValue("device.StorageConnectionString");
     string containerName = configurationProvider.GetConfigurationSettingValue("ActionMappingStoreContainerName");
     _blobName = blobName;
     _blobStorageManager = blobStorageClientFactory.CreateClient(connectionString, containerName);
 }
开发者ID:Azure,项目名称:azure-iot-remote-monitoring,代码行数:8,代码来源:ActionMappingRepository.cs

示例4: SimulationController

 public SimulationController(IIotHubRepository iotHubRepository, IConfigurationProvider configProvider)
 {
     this.iotHubRepository = iotHubRepository;
     this.configurationProvider = configProvider;
     this.storageConnectionString = configProvider.GetConfigurationSettingValue("device.StorageConnectionString");
     this.telemetryTableName = configProvider.GetConfigurationSettingValue("TelemetryStoreContainerName");
     this.mlResultTableName = configProvider.GetConfigurationSettingValue("MLResultTableName");
     this.simulatorStateTableName = configProvider.GetConfigurationSettingValue("SimulatorStateTableName");
 }
开发者ID:b3540,项目名称:azure-iot-predictive-maintenance,代码行数:9,代码来源:SimulationController.cs

示例5: ConfigureAuth

        public void ConfigureAuth(IAppBuilder app, IConfigurationProvider configProvider)
        {
            app.SetDefaultSignInAsAuthenticationType(CookieAuthenticationDefaults.AuthenticationType);

            // Primary authentication method for web site to Azure AD via the WsFederation below
            app.UseCookieAuthentication(new CookieAuthenticationOptions());

            string federationMetadataAddress = configProvider.GetConfigurationSettingValue("ida.FederationMetadataAddress");
            string federationRealm = configProvider.GetConfigurationSettingValue("ida.FederationRealm");

            if (string.IsNullOrEmpty(federationMetadataAddress) || string.IsNullOrEmpty(federationRealm))
            {
                throw new ApplicationException("Config issue: Unable to load required federation values from web.config or other configuration source.");
            }

            // check for default values that will cause app to fail to startup with an unhelpful 404 exception
            if (federationMetadataAddress.StartsWith("-- ", StringComparison.Ordinal) ||
                federationRealm.StartsWith("-- ", StringComparison.Ordinal))
            {
                throw new ApplicationException("Config issue: Default federation values from web.config need to be overridden or replaced.");
            }

            app.UseWsFederationAuthentication(
                new WsFederationAuthenticationOptions
                {
                    MetadataAddress = federationMetadataAddress,
                    Wtrealm = federationRealm
                });

            string aadTenant = configProvider.GetConfigurationSettingValue("ida.AADTenant");
            string aadAudience = configProvider.GetConfigurationSettingValue("ida.AADAudience");

            if (string.IsNullOrEmpty(aadTenant) || string.IsNullOrEmpty(aadAudience))
            {
                throw new ApplicationException("Config issue: Unable to load required AAD values from web.config or other configuration source.");
            }

            // check for default values that will cause failure
            if (aadTenant.StartsWith("-- ", StringComparison.Ordinal) ||
                aadAudience.StartsWith("-- ", StringComparison.Ordinal))
            {
                throw new ApplicationException("Config issue: Default AAD values from web.config need to be overridden or replaced.");
            }

            // Fallback authentication method to allow "Authorization: Bearer <token>" in the header for WebAPI calls
            app.UseWindowsAzureActiveDirectoryBearerAuthentication(
                new WindowsAzureActiveDirectoryBearerAuthenticationOptions
                {
                    Tenant = aadTenant,
                    TokenValidationParameters = new TokenValidationParameters
                    {
                        ValidAudience = aadAudience,
                        RoleClaimType = "http://schemas.microsoft.com/identity/claims/scope" // Used to unwrap token roles and provide them to [Authorize(Roles="")] attributes
                    }
                });
        }
开发者ID:magoroku15,项目名称:azure-iot-predictive-maintenance,代码行数:56,代码来源:Startup.Auth.cs

示例6: AlertsRepository

        /// <summary>
        /// Initializes a new instance of the AlertsRepository class.
        /// </summary>
        /// <param name="configProvider">
        /// The IConfigurationProvider implementation with which the new 
        /// instance will be initialized.
        /// </param>
        public AlertsRepository(IConfigurationProvider configProvider)
        {
            if (configProvider == null)
            {
                throw new ArgumentNullException("configProvider");
            }

            this.alertsContainerConnectionString = configProvider.GetConfigurationSettingValue("device.StorageConnectionString");
            this.alertsStoreContainerName = configProvider.GetConfigurationSettingValue("AlertsStoreContainerName");
            this.deviceAlertsDataPrefix =configProvider.GetConfigurationSettingValue("DeviceAlertsDataPrefix");
        }
开发者ID:selam99,项目名称:azure-iot-remote-monitoring,代码行数:18,代码来源:AlertsRepository.cs

示例7: DocDbRestUtility

        public DocDbRestUtility(IConfigurationProvider configProvider)
        {
            if (configProvider == null)
            {
                throw new ArgumentNullException("configProvider");
            }

            _docDbEndpoint = configProvider.GetConfigurationSettingValue("docdb.EndpointUrl");
            _docDbKey = configProvider.GetConfigurationSettingValue("docdb.PrimaryAuthorizationKey");
            _dbName = configProvider.GetConfigurationSettingValue("docdb.DatabaseId");
            _collectionName = configProvider.GetConfigurationSettingValue("docdb.DocumentCollectionId");
        }
开发者ID:selam99,项目名称:azure-iot-remote-monitoring,代码行数:12,代码来源:DocDbRestUtility.cs

示例8: DeviceTelemetryRepository

        /// <summary>
        /// Initializes a new instance of the DeviceTelemetryRepository class.
        /// </summary>
        /// <param name="configProvider">
        /// The IConfigurationProvider implementation with which to initialize 
        /// the new instance.
        /// </param>
        public DeviceTelemetryRepository(IConfigurationProvider configProvider)
        {
            if (configProvider == null)
            {
                throw new ArgumentNullException("configProvider");
            }

            _telemetryContainerName = configProvider.GetConfigurationSettingValue("TelemetryStoreContainerName");
            _telemetryDataPrefix = configProvider.GetConfigurationSettingValue("TelemetryDataPrefix");
            _telemetryStoreConnectionString = configProvider.GetConfigurationSettingValue("device.StorageConnectionString");
            _telemetrySummaryPrefix = configProvider.GetConfigurationSettingValue("TelemetrySummaryPrefix");
        }
开发者ID:selam99,项目名称:azure-iot-remote-monitoring,代码行数:19,代码来源:DeviceTelemetryRepository.cs

示例9: AlertsRepository

        /// <summary>
        /// Initializes a new instance of the AlertsRepository class.
        /// </summary>
        /// <param name="configProvider">
        /// The IConfigurationProvider implementation with which the new 
        /// instance will be initialized.
        /// </param>
        public AlertsRepository(IConfigurationProvider configProvider, IBlobStorageClientFactory blobStorageClientFactory)
        {
            if (configProvider == null)
            {
                throw new ArgumentNullException("configProvider");
            }

            string alertsContainerConnectionString = configProvider.GetConfigurationSettingValue("device.StorageConnectionString");
            string alertsStoreContainerName = configProvider.GetConfigurationSettingValue("AlertsStoreContainerName");
            this._blobStorageManager = blobStorageClientFactory.CreateClient(alertsContainerConnectionString, alertsStoreContainerName);
            this.deviceAlertsDataPrefix = configProvider.GetConfigurationSettingValue("DeviceAlertsDataPrefix");
        }
开发者ID:Azure,项目名称:azure-iot-remote-monitoring,代码行数:19,代码来源:AlertsRepository.cs

示例10: DeviceTelemetryRepository

        /// <summary>
        /// Initializes a new instance of the DeviceTelemetryRepository class.
        /// </summary>
        /// <param name="configProvider">
        /// The IConfigurationProvider implementation with which to initialize 
        /// the new instance.
        /// </param>
        public DeviceTelemetryRepository(IConfigurationProvider configProvider, IBlobStorageClientFactory blobStorageClientFactory)
        {
            if (configProvider == null)
            {
                throw new ArgumentNullException("configProvider");
            }

            string telemetryContainerName = configProvider.GetConfigurationSettingValue("TelemetryStoreContainerName");
            _telemetryDataPrefix = configProvider.GetConfigurationSettingValue("TelemetryDataPrefix");
            string telemetryStoreConnectionString = configProvider.GetConfigurationSettingValue("device.StorageConnectionString");
            _telemetrySummaryPrefix = configProvider.GetConfigurationSettingValue("TelemetrySummaryPrefix");
            _blobStorageManager = blobStorageClientFactory.CreateClient(telemetryStoreConnectionString,telemetryContainerName);
        }
开发者ID:Azure,项目名称:azure-iot-remote-monitoring,代码行数:20,代码来源:DeviceTelemetryRepository.cs

示例11: DeviceRulesRepository

        public DeviceRulesRepository(IConfigurationProvider configurationProvider)
        {
            this._configurationProvider = configurationProvider;

            _storageAccountConnectionString = configurationProvider.GetConfigurationSettingValue("device.StorageConnectionString");
            _deviceRulesBlobStoreContainerName = configurationProvider.GetConfigurationSettingValue("DeviceRulesStoreContainerName");
            _deviceRulesNormalizedTableName = configurationProvider.GetConfigurationSettingValue("DeviceRulesTableName");
            _blobName = configurationProvider.GetConfigurationSettingValue("AsaRefDataRulesBlobName");

            // note: InvariantCulture is read-only, so use en-US and hardcode all relevant aspects
            CultureInfo culture = CultureInfo.CreateSpecificCulture("en-US");
            _formatInfo = culture.DateTimeFormat;
            _formatInfo.ShortDatePattern = @"yyyy-MM-dd";
            _formatInfo.ShortTimePattern = @"HH-mm";
        }
开发者ID:smartpcr,项目名称:azure-iot-remote-monitoring,代码行数:15,代码来源:DeviceRulesRepository.cs

示例12: EngineTelemetryFactory

        public EngineTelemetryFactory(ILogger logger, IConfigurationProvider config)
        {
            _logger = logger;
            _config = config;

            // This will load the CSV data from the specified file in blob storage;
            // any failure in accessing or reading the data will be handled as an exception
            Stream dataStream = CloudStorageAccount
                .Parse(config.GetConfigurationSettingValue("device.StorageConnectionString"))
                .CreateCloudBlobClient()
                .GetContainerReference(config.GetConfigurationSettingValue("SimulatorDataContainer"))
                .GetBlockBlobReference(config.GetConfigurationSettingValue("SimulatorDataFileName"))
                .OpenRead();

            _dataset = ParsingHelper.ParseCsv(new StreamReader(dataStream)).ToExpandoObjects().ToList();
        }
开发者ID:magoroku15,项目名称:azure-iot-predictive-maintenance,代码行数:16,代码来源:EngineTelemetryFactory.cs

示例13: IotHubRepository

        public IotHubRepository(IConfigurationProvider configProvider)
        {
            // Temporary code to bypass https cert validation till DNS on IotHub is configured
            ServicePointManager.ServerCertificateValidationCallback = (sender, certificate, chain, errors) => true;

            _iotHubConnectionString = configProvider.GetConfigurationSettingValue("iotHub.ConnectionString");
            _deviceManager = RegistryManager.CreateFromConnectionString(_iotHubConnectionString);
        }
开发者ID:magoroku15,项目名称:azure-iot-predictive-maintenance,代码行数:8,代码来源:IotHubRepository.cs

示例14: DeviceRegistryRepository

        public DeviceRegistryRepository(IConfigurationProvider configProvider, IDocDbRestUtility docDbRestUtil)
        {
            if (configProvider == null)
            {
                throw new ArgumentNullException("configProvider");
            }

            _endpointUri = configProvider.GetConfigurationSettingValue("docdb.EndpointUrl");
            _authorizationKey = configProvider.GetConfigurationSettingValue("docdb.PrimaryAuthorizationKey");
            _databaseId = configProvider.GetConfigurationSettingValue("docdb.DatabaseId");
            _documentCollectionName = configProvider.GetConfigurationSettingValue("docdb.DocumentCollectionId");


            _docDbRestUtil = docDbRestUtil;
            Task.Run(() => _docDbRestUtil.InitializeDatabase()).Wait();
            Task.Run(() => _docDbRestUtil.InitializeCollection()).Wait();
        }
开发者ID:rudibelt,项目名称:azure-iot-remote-monitoring,代码行数:17,代码来源:DeviceRegistryRepository.cs

示例15: DeviceController

        public DeviceController(IDeviceLogic deviceLogic, IDeviceTypeLogic deviceTypeLogic,
            IConfigurationProvider configProvider,
            IApiRegistrationRepository apiRegistrationRepository,
            ICellularExtensions cellularExtensions)
        {
            _deviceLogic = deviceLogic;
            _deviceTypeLogic = deviceTypeLogic;
            _apiRegistrationRepository = apiRegistrationRepository;
            _cellularExtensions = cellularExtensions;

            _iotHubName = configProvider.GetConfigurationSettingValue("iotHub.HostName");
        }
开发者ID:Azure,项目名称:azure-iot-remote-monitoring,代码行数:12,代码来源:DeviceController.cs


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