Created
April 12, 2019 21:54
-
-
Save Rudyzio/5aabb8a6f95e6114e7dbacc80714fa71 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Program | |
{ | |
public static void Main(string[] args) | |
{ | |
var host = CreateWebHostBuilder(args).Build(); | |
using (var scope = host.Services.CreateScope()) | |
{ | |
var services = scope.ServiceProvider; | |
try | |
{ | |
var context = services.GetRequiredService<ApplicationDbContext>(); | |
DataSeeder.Initialize(context); | |
} catch (Exception) | |
{ | |
Console.WriteLine("An error occurred while seeding the database."); | |
} | |
} | |
host.Run(); | |
} | |
public static IWebHostBuilder CreateWebHostBuilder(string[] args) => WebHost.CreateDefaultBuilder(args).UseStartup<Startup>(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment