* Updates based on documentation * Getting the build passing * Getting app functioning * A few cleanups to confirm it's working as expected * Fixing functional tests * Updating dockerfile for 3.0 * Functional Tests now run sequentially * Updating to latest version of moq * Adding migration for post 3.0 upgrades * Removing commented out lines * Moving address and catalogitemordered configuration in to classes that own them * Adding admin user * Adding admin catalog screen - will also only display menu option if user is logged in as an admin * WIP - squash this * Allow user to edit a catalog item * Adding entry for new service * Invalidating cache after catalog item update - also a little bit of cleanup * Fixing bad merge * Removing Picture Uri and making Id readonly * Adjusting style in menu dropdown so all options are shown * Creating Cache helpers with unit tests
51 lines
1.8 KiB
C#
51 lines
1.8 KiB
C#
using Microsoft.AspNetCore.Hosting;
|
|
using Microsoft.AspNetCore.Identity;
|
|
using Microsoft.eShopWeb.Infrastructure.Data;
|
|
using Microsoft.eShopWeb.Infrastructure.Identity;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
using Microsoft.Extensions.Hosting;
|
|
using Microsoft.Extensions.Logging;
|
|
using System;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Microsoft.eShopWeb.Web
|
|
{
|
|
public class Program
|
|
{
|
|
public async static Task Main(string[] args)
|
|
{
|
|
var host = CreateHostBuilder(args)
|
|
.Build();
|
|
|
|
using (var scope = host.Services.CreateScope())
|
|
{
|
|
var services = scope.ServiceProvider;
|
|
var loggerFactory = services.GetRequiredService<ILoggerFactory>();
|
|
try
|
|
{
|
|
var catalogContext = services.GetRequiredService<CatalogContext>();
|
|
await CatalogContextSeed.SeedAsync(catalogContext, loggerFactory);
|
|
|
|
var userManager = services.GetRequiredService<UserManager<ApplicationUser>>();
|
|
var roleManager = services.GetRequiredService<RoleManager<IdentityRole>>();
|
|
await AppIdentityDbContextSeed.SeedAsync(userManager, roleManager);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
var logger = loggerFactory.CreateLogger<Program>();
|
|
logger.LogError(ex, "An error occurred seeding the DB.");
|
|
}
|
|
}
|
|
|
|
host.Run();
|
|
}
|
|
|
|
public static IHostBuilder CreateHostBuilder(string[] args) =>
|
|
Host.CreateDefaultBuilder(args)
|
|
.ConfigureWebHostDefaults(webBuilder =>
|
|
{
|
|
webBuilder.UseStartup<Startup>();
|
|
});
|
|
}
|
|
}
|