public DataGenerator(IRandomDataGenerator randomDataGenerator, ToysStoreEntities toysStoreEntities, int countOfGeneratedObjects, IConsoleLogger consoleLogger) { this.random = randomDataGenerator; this.db = toysStoreEntities; this.count = countOfGeneratedObjects; this.logger = consoleLogger; }
static void Main() { var random = RandomDataGenerator.Instance; var db = new ToysStoreEntities(); db.Configuration.AutoDetectChangesEnabled = false; var listOfGenerators = new List<IDataGenerator> { new CategoryDataGenerator(random, db, 100), new ManufacturerDataGenerator(random, db, 50), new AgeRangeDataGenerator(random, db, 50), new ToyDataGenerator(random, db, 20000) }; foreach (var generator in listOfGenerators) { generator.Generate(); db.SaveChanges(); } db.Configuration.AutoDetectChangesEnabled = true; }
private static void Main() { var random = RandomDataGenerator.Instance; var db = new ToysStoreEntities(); var logger = new ConsoleLogger(); db.Configuration.AutoDetectChangesEnabled = false; // To speed-up the application var listOfGenerators = new List<IDataGenerator>() { new CategoryDataGenerator(random, db, 100, logger), // Creates 100 categories new ManufacturerDataGenerator(random, db, 50, logger), // Creates 50 manufacturers new AgeRangeDataGenerator(random, db, 100, logger), // Creates 100 age ranges new ToyDataGenerator(random, db, 20000, logger) // Creates 20 000 age ranges }; foreach (var generator in listOfGenerators) { generator.Generate(); db.SaveChanges(); } db.Configuration.AutoDetectChangesEnabled = true; }
public DataGenerator(IRandomDataGenerator randomDataGenerator, ToysStoreEntities toyStoreEntities, int countOfGeneratedObjects) { this.random = randomDataGenerator; this.db = toyStoreEntities; this.count = countOfGeneratedObjects; }
public CategoryDataGenerator(IRandomDataGenerator randomDataGenerator, ToysStoreEntities toysStoreEntities, int countOfGeneratedObjects, IConsoleLogger consoleLogger) : base(randomDataGenerator, toysStoreEntities, countOfGeneratedObjects, consoleLogger) { }
public CategoryDataGenerator(IRandomDataGenerator randomDataGenerator, ToysStoreEntities toyStoreEntities, int countOfGeneratedObjects) :base(randomDataGenerator, toyStoreEntities, countOfGeneratedObjects) { }
public ManufacturerDataGenerator(IRandomDataGenerator randomDataGenerator, ToysStoreEntities toyStoreEntities, int countOfGeneratedObjects) :base(randomDataGenerator, toyStoreEntities, countOfGeneratedObjects) { }