study-lib-backend/Program.cs

31 lines
939 B
C#
Raw Normal View History

2020-12-12 14:47:20 +01:00
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Hosting;
using StudyLib.API.Data;
using Microsoft.Extensions.DependencyInjection;
namespace StudyLib
{
public class Program
{
public static void Main(string[] args)
{
var host = CreateHostBuilder(args).Build();
using (var scope = host.Services.CreateScope())
{
var services = scope.ServiceProvider;
var context = services.GetService<StudyLibContext>();
StudyLibDataSeeder.Initialize(context);
}
host.Run();
// CreateHostBuilder(args).Build().Run();
}
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup<Startup>();
});
}
}