예제 #1
0
        public static async Task InitializeAsync(IWebHost host)
        {
            using (var scope = host.Services.CreateScope())
                using (var context = scope.ServiceProvider.GetService <CelebrityDataContext>())
                {
                    if (context.HasMigrations())
                    {
                        await context.Database.MigrateAsync().ConfigureAwait(true);

                        await CelebrityDataContext.CreateSeedDataAsync(context).ConfigureAwait(true);
                    }
                }
        }
예제 #2
0
 public static void Initialize(IWebHost host)
 {
     CelebrityDataContext.InitializeAsync(host).GetAwaiter().GetResult();
 }