public static void Load(IServiceCollection services, IConfiguration configuration) { var connectionString = ConfigurationUtility.GetConfiguration(configuration, "SqlConnectionString"); services.AddDbContext <JobDbContext>(options => options.UseSqlServer(connectionString)); services.AddScoped <IJobsRepository, JobsRepository>(); }
public static IWebHostBuilder CreateWebHostBuilder(string[] args) => WebHost.CreateDefaultBuilder(args) .ConfigureAppConfiguration((context, config) => { var keyVaultName = ConfigurationUtility.GetConfiguration(config.Build(), "KeyVault:Name"); config.AddAzureKeyVault($"https://{keyVaultName}.vault.azure.net/", CreateKeyVaultClient(), new DefaultKeyVaultSecretManager()); }) .UseStartup <Startup>();
public static void Load(IServiceCollection services, IConfiguration configuration) { var appInsightKey = ConfigurationUtility.GetConfiguration(configuration, "AppInsightsInstrumentationKey"); services.AddApplicationInsightsTelemetry(appInsightKey); // For using temp folder in Linux // more info: https://docs.microsoft.com/en-us/azure/azure-monitor/app/asp-net-core-no-visualstudio#frequently-asked-questions var storageFolder = ConfigurationUtility.GetConfiguration(configuration, "ApplicationInsights:TempFolder"); services.AddSingleton <ITelemetryChannel>(new ServerTelemetryChannel { StorageFolder = storageFolder }); }
private string GetConfiguration(string configurationKey) { return(ConfigurationUtility.GetConfiguration(_configuration, configurationKey)); }