Пример #1
0
        private void SetupTelemetryDataSinkMetadataRegistry(ISettingOperations settingOperations)
        {
            var telemetryDataSinkSetupServiceClient = _serviceProvider.GetService <ITelemetryDataSinkSetupServiceClient>();

            telemetryDataSinkSetupServiceClient.Setup(settingOperations.Get(Setting.TelemetrySetupServiceEndpoint).Value,
                                                      settingOperations.Get(Setting.TelemetrySetupServiceApiKey).Value);

            var telemetryDataSinkMetadataRegistry = (TelemetryDataSinkMetadataRegistry)_serviceProvider.GetService <ITelemetryDataSinkMetadataRegistry>();
            var telemetryDataSinksMetadata        = telemetryDataSinkSetupServiceClient.GetTelemetryDataSinksMetadata();

            var telemeryDataSection = new TelemetryDataSection
            {
                Incoming = telemetryDataSinksMetadata.Incoming.Select(inc =>
                                                                      new TelemetryDataSinkElement
                {
                    Name             = inc.Name,
                    Type             = inc.TypeName,
                    Description      = inc.Description,
                    ParameterPresets = inc.ParametersPresets?.Select(pp =>
                                                                     new TelemetrySinkParameter
                    {
                        Key   = pp.Key,
                        Value = pp.Value
                    }).ToArray()
                }).ToArray()
            };

            telemetryDataSinkMetadataRegistry.Build(telemeryDataSection);
        }
Пример #2
0
 private static void SafeEnsureSetting(ISettingOperations settingOperations, SettingId name, string value)
 {
     try
     {
         settingOperations.Get(name);
     }
     catch
     {
         settingOperations.Create(new Setting(name, value));
     }
 }
Пример #3
0
 private string ReadThrough(SettingId key)
 {
     return(_settings.GetOrAdd(key.ToString(), (k) => _settingOperations.Get(key).Value));
 }
Пример #4
0
        public ConnectionStringSettings Resolve(string connectionName)
        {
            var setting = _connectionStringSettingsList.GetOrAdd(connectionName, connName => _settingOperations.Get(SettingId.GetConnection(connName)));

            return(new ConnectionStringSettings(connectionName, setting.Value));
        }