Esempio n. 1
0
 public BlogController(IBlogFactory factory, IHttpContextAccessor accessor, BlogSeed seed, IOptionsFactory <PostRelated> related)
 {
     _factory       = factory;
     this._accessor = accessor;
     this._seed     = seed;
     this._related  = related;
 }
Esempio n. 2
0
        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();
        }