Exemple #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);
                    }
                }
        }
Exemple #2
0
 public static void Initialize(IWebHost host)
 {
     CelebrityDataContext.InitializeAsync(host).GetAwaiter().GetResult();
 }