Removing blocking calls in main

This commit is contained in:
Bohdan Stupak
2019-06-13 22:04:29 +03:00
parent a805c6136d
commit 772a65b3b3
2 changed files with 5 additions and 4 deletions

View File

@@ -6,12 +6,13 @@ using Microsoft.eShopWeb.Infrastructure.Identity;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using System;
using System.Threading.Tasks;
namespace Microsoft.eShopWeb.Web
{
public class Program
{
public static void Main(string[] args)
public async static Task Main(string[] args)
{
var host = CreateWebHostBuilder(args)
.Build();
@@ -23,11 +24,10 @@ namespace Microsoft.eShopWeb.Web
try
{
var catalogContext = services.GetRequiredService<CatalogContext>();
CatalogContextSeed.SeedAsync(catalogContext, loggerFactory)
.Wait();
await CatalogContextSeed.SeedAsync(catalogContext, loggerFactory);
var userManager = services.GetRequiredService<UserManager<ApplicationUser>>();
AppIdentityDbContextSeed.SeedAsync(userManager).Wait();
await AppIdentityDbContextSeed.SeedAsync(userManager);
}
catch (Exception ex)
{

View File

@@ -5,6 +5,7 @@
<RootNamespace>Microsoft.eShopWeb.Web</RootNamespace>
<UserSecretsId>aspnet-Web2-1FA3F72E-E7E3-4360-9E49-1CCCD7FE85F7</UserSecretsId>
<AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
<LangVersion>latest</LangVersion>
</PropertyGroup>
<ItemGroup>