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(); } } }
public ContactsService(ContactManagerDbContext context) { _context = context; }
public GenericRepository(ContactManagerDbContext dbContext) { _dbContext = dbContext; }