示例#1
0
 private void SeedDatabase(IApplicationBuilder app)
 {
     using (var scope = app.ApplicationServices.GetService <IServiceScopeFactory>().CreateScope())
     {
         var context = scope.ServiceProvider.GetRequiredService <AdsContext>();
         Seed.Ads(context);
         Seed.Channels(context);
         Seed.AdChannels(context);
         context.Database.EnsureCreated();
     }
 }