Exemplo n.º 1
0
 public void EnsureDatabaseCreation()
 {
     using (var context = new ContactManagerDbContext(_contextOptions))
     {
         if (context.Database.EnsureCreated())
         {
             var randomContactGenerator = new RandomContactGenerator();
             var contacts = randomContactGenerator.GenerateContacts(5000);
             context.Contacts.AddRange(contacts);
             context.SaveChanges();
         }
     }
 }
Exemplo n.º 2
0
 public ContactsService(ContactManagerDbContext context)
 {
     _context = context;
 }
Exemplo n.º 3
0
 public GenericRepository(ContactManagerDbContext dbContext)
 {
     _dbContext = dbContext;
 }