fix build break due to aspnet/configuration #246
This commit is contained in:
parent
f2a0ea6a21
commit
b271887d9f
|
|
@ -27,8 +27,8 @@ namespace MusicStore.Spa
|
|||
{
|
||||
services.Configure<SiteSettings>(settings =>
|
||||
{
|
||||
settings.DefaultAdminUsername = Configuration.Get("DefaultAdminUsername");
|
||||
settings.DefaultAdminPassword = Configuration.Get("DefaultAdminPassword");
|
||||
settings.DefaultAdminUsername = Configuration["DefaultAdminUsername"];
|
||||
settings.DefaultAdminPassword = Configuration["DefaultAdminPassword"];
|
||||
});
|
||||
|
||||
// Add MVC services to the service container
|
||||
|
|
@ -39,7 +39,7 @@ namespace MusicStore.Spa
|
|||
.AddSqlServer()
|
||||
.AddDbContext<MusicStoreContext>(options =>
|
||||
{
|
||||
options.UseSqlServer(Configuration.Get("Data:DefaultConnection:ConnectionString"));
|
||||
options.UseSqlServer(Configuration["Data:DefaultConnection:ConnectionString"]);
|
||||
});
|
||||
|
||||
// Add Identity services to the services container
|
||||
|
|
|
|||
|
|
@ -92,17 +92,17 @@ namespace MusicStore.Models
|
|||
// await roleManager.CreateAsync(new IdentityRole(adminRole));
|
||||
//}
|
||||
|
||||
var user = await userManager.FindByNameAsync(configuration.Get(defaultAdminUserName));
|
||||
var user = await userManager.FindByNameAsync(configuration[defaultAdminUserName]);
|
||||
if (user == null)
|
||||
{
|
||||
user = new ApplicationUser { UserName = configuration.Get(defaultAdminUserName) };
|
||||
await userManager.CreateAsync(user, configuration.Get(defaultAdminPassword));
|
||||
user = new ApplicationUser { UserName = configuration[defaultAdminUserName] };
|
||||
await userManager.CreateAsync(user, configuration[defaultAdminPassword]);
|
||||
//await userManager.AddToRoleAsync(user, adminRole);
|
||||
await userManager.AddClaimAsync(user, new Claim("ManageStore", "Allowed"));
|
||||
}
|
||||
|
||||
#if TESTING
|
||||
var envPerfLab = configuration.Get("PERF_LAB");
|
||||
var envPerfLab = configuration["PERF_LAB"];
|
||||
if (envPerfLab == "true")
|
||||
{
|
||||
for (int i = 0; i < 100; ++i)
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ namespace MusicStore
|
|||
|
||||
public void ConfigureServices(IServiceCollection services)
|
||||
{
|
||||
services.Configure<AppSettings>(Configuration.GetConfigurationSection("AppSettings"));
|
||||
services.Configure<AppSettings>(Configuration.GetSection("AppSettings"));
|
||||
|
||||
var useInMemoryStore = _platform.IsRunningOnMono || _platform.IsRunningOnNanoServer;
|
||||
|
||||
|
|
@ -53,7 +53,7 @@ namespace MusicStore
|
|||
services.AddEntityFramework()
|
||||
.AddSqlServer()
|
||||
.AddDbContext<MusicStoreContext>(options =>
|
||||
options.UseSqlServer(Configuration.Get("Data:DefaultConnection:ConnectionString")));
|
||||
options.UseSqlServer(Configuration["Data:DefaultConnection:ConnectionString"]));
|
||||
}
|
||||
|
||||
// Add Identity services to the services container
|
||||
|
|
|
|||
|
|
@ -46,13 +46,13 @@ namespace MusicStore
|
|||
|
||||
public void ConfigureServices(IServiceCollection services)
|
||||
{
|
||||
services.Configure<AppSettings>(Configuration.GetConfigurationSection("AppSettings"));
|
||||
services.Configure<AppSettings>(Configuration.GetSection("AppSettings"));
|
||||
|
||||
// Add EF services to the services container
|
||||
services.AddEntityFramework()
|
||||
.AddSqlServer()
|
||||
.AddDbContext<MusicStoreContext>(options =>
|
||||
options.UseSqlServer(Configuration.Get("Data:DefaultConnection:ConnectionString")));
|
||||
options.UseSqlServer(Configuration["Data:DefaultConnection:ConnectionString"]));
|
||||
|
||||
services.ConfigureCors(options =>
|
||||
{
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ namespace MusicStore
|
|||
|
||||
public void ConfigureServices(IServiceCollection services)
|
||||
{
|
||||
services.Configure<AppSettings>(Configuration.GetConfigurationSection("AppSettings"));
|
||||
services.Configure<AppSettings>(Configuration.GetSection("AppSettings"));
|
||||
|
||||
var useInMemoryStore = _platform.IsRunningOnMono || _platform.IsRunningOnNanoServer;
|
||||
|
||||
|
|
@ -65,7 +65,7 @@ namespace MusicStore
|
|||
services.AddEntityFramework()
|
||||
.AddSqlServer()
|
||||
.AddDbContext<MusicStoreContext>(options =>
|
||||
options.UseSqlServer(Configuration.Get("Data:DefaultConnection:ConnectionString")));
|
||||
options.UseSqlServer(Configuration["Data:DefaultConnection:ConnectionString"]));
|
||||
}
|
||||
|
||||
// Add Identity services to the services container
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ namespace MusicStore
|
|||
|
||||
public void ConfigureServices(IServiceCollection services)
|
||||
{
|
||||
services.Configure<AppSettings>(Configuration.GetConfigurationSection("AppSettings"));
|
||||
services.Configure<AppSettings>(Configuration.GetSection("AppSettings"));
|
||||
|
||||
//Sql client not available on mono
|
||||
var useInMemoryStore = _runtimeEnvironment.RuntimeType.Equals("Mono", StringComparison.OrdinalIgnoreCase);
|
||||
|
|
@ -57,7 +57,7 @@ namespace MusicStore
|
|||
services.AddEntityFramework()
|
||||
.AddSqlServer()
|
||||
.AddDbContext<MusicStoreContext>(options =>
|
||||
options.UseSqlServer(Configuration.Get("Data:DefaultConnection:ConnectionString")));
|
||||
options.UseSqlServer(Configuration["Data:DefaultConnection:ConnectionString"]));
|
||||
}
|
||||
|
||||
// Add Identity services to the services container
|
||||
|
|
|
|||
|
|
@ -44,11 +44,10 @@ namespace MusicStore
|
|||
|
||||
public void ConfigureServices(IServiceCollection services)
|
||||
{
|
||||
services.Configure<AppSettings>(Configuration.GetConfigurationSection("AppSettings"));
|
||||
services.Configure<AppSettings>(Configuration.GetSection("AppSettings"));
|
||||
|
||||
//Sql client not available on mono
|
||||
string value;
|
||||
var useInMemoryStore = Configuration.TryGet("UseInMemoryStore", out value) && value == "true" ?
|
||||
var useInMemoryStore = Configuration["UseInMemoryStore"] == "true" ?
|
||||
true :
|
||||
_runtimeEnvironment.RuntimeType.Equals("Mono", StringComparison.OrdinalIgnoreCase);
|
||||
|
||||
|
|
@ -65,7 +64,7 @@ namespace MusicStore
|
|||
services.AddEntityFramework()
|
||||
.AddSqlServer()
|
||||
.AddDbContext<MusicStoreContext>(options =>
|
||||
options.UseSqlServer(Configuration.Get("Data:DefaultConnection:ConnectionString")));
|
||||
options.UseSqlServer(Configuration["Data:DefaultConnection:ConnectionString"]));
|
||||
}
|
||||
|
||||
// Add Identity services to the services container
|
||||
|
|
|
|||
Loading…
Reference in New Issue