public static void Initialize(csci6600Context dbContext) { var generator = new GeneratorService(dbContext); var currentOwnerCount = dbContext.DogOwners.Count(); var batchSize = 1000; var numberNeeded = ownerCount - currentOwnerCount; while (currentOwnerCount < ownerCount) { generator.GenerateOwners(numberNeeded < batchSize ? numberNeeded : batchSize, true); currentOwnerCount += (numberNeeded < batchSize ? numberNeeded : batchSize); numberNeeded = ownerCount - currentOwnerCount; } var currentDogCount = dbContext.Dogs.Count(); batchSize = 1000; numberNeeded = dogCount - currentDogCount; while (currentDogCount < dogCount) { generator.GenerateDogs(numberNeeded < batchSize ? numberNeeded : batchSize, true); currentDogCount += (numberNeeded < batchSize ? numberNeeded : batchSize); numberNeeded = dogCount - currentDogCount; } }
public DataService(IConfiguration config, ICacheManager cache, csci6600Context dbContext, csci6600_indexedContext dbContextIndexed) { _nonIndexedDbContext = dbContext; _indexedContext = dbContextIndexed; _configuration = config; _cache = cache; }
public GeneratorService(csci6600Context dbContext) { _dbContext = dbContext; // Fill in the lists InitializeData(); }