| | | 1 | | using System; |
| | | 2 | | using System.Collections.Generic; |
| | | 3 | | using System.Linq; |
| | | 4 | | using System.Threading; |
| | | 5 | | using System.Threading.Tasks; |
| | | 6 | | using Microsoft.AspNetCore.Hosting; |
| | | 7 | | using Microsoft.AspNetCore.Http; |
| | | 8 | | using Microsoft.EntityFrameworkCore; |
| | | 9 | | using Microsoft.Extensions.Configuration; |
| | | 10 | | using Microsoft.Extensions.DependencyInjection; |
| | | 11 | | using Microsoft.Extensions.Hosting; |
| | | 12 | | using Microsoft.Extensions.Logging; |
| | | 13 | | using Serilog; |
| | | 14 | | using SVETA.Api.Helpers; |
| | | 15 | | using WinSolutions.Sveta.Server.Data.DataModel.Contexts; |
| | | 16 | | |
| | | 17 | | namespace SVETA.Api |
| | | 18 | | { |
| | | 19 | | public class Program |
| | | 20 | | { |
| | | 21 | | public static void Main(string[] args) |
| | 0 | 22 | | { |
| | 0 | 23 | | var host = CreateHostBuilder(args) |
| | 0 | 24 | | .Build() |
| | 0 | 25 | | .MigrationDatabase(); |
| | | 26 | | |
| | 0 | 27 | | using (var scope = host.Services.CreateScope()) |
| | 0 | 28 | | { |
| | 0 | 29 | | var context = scope.ServiceProvider.GetService<SvetaDbContext>(); |
| | 0 | 30 | | DataSeeder.Seed(context); |
| | 0 | 31 | | } |
| | 0 | 32 | | host.Run(); |
| | 0 | 33 | | } |
| | | 34 | | |
| | | 35 | | public static IHostBuilder CreateHostBuilder(string[] args) => |
| | 0 | 36 | | Host.CreateDefaultBuilder(args) |
| | 0 | 37 | | .ConfigureWebHostDefaults(webBuilder => |
| | 0 | 38 | | { |
| | 0 | 39 | | webBuilder.UseStartup<Startup>(); |
| | 0 | 40 | | }) |
| | 0 | 41 | | .ConfigureLogging(config => |
| | 0 | 42 | | { |
| | 0 | 43 | | config.ClearProviders(); |
| | 0 | 44 | | }) |
| | 0 | 45 | | .UseSerilog(); |
| | | 46 | | } |
| | | 47 | | } |