示例#1
0
 public BlogController(IBlogFactory factory, IHttpContextAccessor accessor, BlogSeed seed, IOptionsFactory <PostRelated> related)
 {
     _factory       = factory;
     this._accessor = accessor;
     this._seed     = seed;
     this._related  = related;
 }
示例#2
0
文件: Program.cs 项目: JThurling/Blog
        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();
        }