public BlogController(IBlogFactory factory, IHttpContextAccessor accessor, BlogSeed seed, IOptionsFactory <PostRelated> related) { _factory = factory; this._accessor = accessor; this._seed = seed; this._related = related; }
public static async Task Main(string[] args) { var host = CreateHostBuilder(args).Build(); using (var scope = host.Services.CreateScope()) { var services = scope.ServiceProvider; try { var context = services.GetRequiredService <BlogContext>(); context.Database.Migrate(); await BlogSeed.SeedAsync(context); } catch (Exception exception) { Console.WriteLine(exception); } } host.Run(); }