示例#1
0
        private IApplicationConfiguration GetConfiguration()
        {
            var configuration = new ApplicationConfiguration
            {
                DatabaseConnectionString = ConfigurationHelper.GetConnectionString("DatabaseConnectionString"),
                EmployerConnectionString = ConfigurationHelper.GetConnectionString("EmployerConnectionString"),
                StorageConnectionString  = ConfigurationHelper.GetConnectionString("StorageConnectionString"),

                HashString = ConfigurationHelper.GetAppSetting("HashString", true),
                AllowedHashStringCharacters     = ConfigurationHelper.GetAppSetting("AllowedHashStringCharacters", true),
                NumberOfMonthsToProject         = int.Parse(ConfigurationHelper.GetAppSetting("NumberOfMonthsToProject", false) ?? "0"),
                SecondsToWaitToAllowProjections = int.Parse(ConfigurationHelper.GetAppSetting("SecondsToWaitToAllowProjections", false) ?? "0"),
                BackLink                          = ConfigurationHelper.GetAppSetting("BackLink", false),
                LimitForecast                     = Boolean.Parse(ConfigurationHelper.GetAppSetting("LimitForecast", false) ?? "false"),
                StubEmployerPaymentTable          = ConfigurationHelper.GetAppSetting("Stub-EmployerPaymentTable", false),
                AllowTriggerProjections           = bool.Parse(ConfigurationHelper.GetAppSetting("AllowTriggerProjections", false) ?? "true"),
                ApprenticeshipsApiBaseUri         = ConfigurationHelper.GetAppSetting("ApprenticeshipsApiBaseUri", false),
                AppInsightsInstrumentationKey     = ConfigurationHelper.GetAppSetting("APPINSIGHTS_INSTRUMENTATIONKEY", false),
                FeatureExpiredFunds               = Boolean.Parse(ConfigurationHelper.GetAppSetting("FeatureExpiredFunds", false) ?? "true"),
                ApprenticeshipsApiSubscriptionKey = ConfigurationHelper.GetAppSetting("ApprenticeshipsApiSubscriptionKey", false)
            };

            SetApiConfiguration(configuration);
            return(configuration);
        }
示例#2
0
        public TelemetryRegistry()
        {
            var config =
                new TelemetryConfiguration(ConfigurationHelper.GetAppSetting("APPINSIGHTS_INSTRUMENTATIONKEY", false));
            var client = new TelemetryClient(config);

            client.InstrumentationKey = config.InstrumentationKey;

            //ForSingletonOf<TelemetryConfiguration>().Use<TelemetryConfiguration>()
            //    .Ctor<string>(ConfigurationHelper.GetAppSetting("APPINSIGHTS_INSTRUMENTATIONKEY", false));
            //ForSingletonOf<TelemetryClient>().Use<TelemetryClient>().Ctor<TelemetryConfiguration>().Is(ctx => ctx.GetInstance<TelemetryConfiguration>());
            ForSingletonOf <TelemetryConfiguration>().Use(config);
            ForSingletonOf <TelemetryClient>().Use(client);
        }