Beispiel #1
0
        public void DbInitialize(IServiceProvider serviceProvider)
        {
            using (var context = new SimDbContext(serviceProvider.GetRequiredService <DbContextOptions <SimDbContext> >()))
            {
                if (context.SimEvents.Any())
                {
                    return;   // DB has been seeded
                }

                // Otherwise initialize!
            }
        }
Beispiel #2
0
 public SimEventRepository(SimDbContext db)
 {
     DB = db ?? new SimDbContext();
 }
Beispiel #3
0
        public void EnsureCreated(IServiceProvider serviceProvider)
        {
            var context = new SimDbContext(serviceProvider.GetRequiredService <DbContextOptions <SimDbContext> >());

            context.Database.EnsureCreated();
        }
Beispiel #4
0
 public SimInfoRepository(SimDbContext db)
 {
     DB = db ?? new SimDbContext();
 }