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