static void Main(string[] args) { var randomGenerator = RandomGenerator.Instance; var db = new TheCompanyEntities(); db.Configuration.AutoDetectChangesEnabled = false; var listOfGenerators = new List<IDataGenerator> { new DepartmentDataGenerator(randomGenerator, db, DepartmentsGeneratorCount), new ProjectDataGenerator(randomGenerator, db, ProjectsGeneratorCount), new EmployeeDataGenerator(randomGenerator, db, EmployeesGeneratorCount), new ReportDataGenerator(randomGenerator, db, ReportsGeneratorCount), new EmployeeProjectDataGenerator(randomGenerator, db, EmployeesProjectsGeneratorCount) }; foreach (var generator in listOfGenerators) { generator.Generate(); db.SaveChanges(); } db.Configuration.AutoDetectChangesEnabled = true; }
static void Main(string[] args) { var randomGenerator = RandomGenerator.Instance; var db = new TheCompanyEntities(); db.Configuration.AutoDetectChangesEnabled = false; var listOfGenerators = new List <IDataGenerator> { new DepartmentDataGenerator(randomGenerator, db, DepartmentsGeneratorCount), new ProjectDataGenerator(randomGenerator, db, ProjectsGeneratorCount), new EmployeeDataGenerator(randomGenerator, db, EmployeesGeneratorCount), new ReportDataGenerator(randomGenerator, db, ReportsGeneratorCount), new EmployeeProjectDataGenerator(randomGenerator, db, EmployeesProjectsGeneratorCount) }; foreach (var generator in listOfGenerators) { generator.Generate(); db.SaveChanges(); } db.Configuration.AutoDetectChangesEnabled = true; }
public EmployeeDataGenerator(IRandomGenerator randomGenerator, TheCompanyEntities theCompanyEntities, int countOfGeneratedObjects) : base(randomGenerator, theCompanyEntities, countOfGeneratedObjects) { }
public DepartmentDataGenerator(IRandomGenerator randomGenerator, TheCompanyEntities theCompanyEntities, int countOfGeneratedObjects) : base(randomGenerator, theCompanyEntities, countOfGeneratedObjects) { }
public DataGenerator(IRandomGenerator randomGenerator, TheCompanyEntities theCompanyEntities, int countOfGeneratedObjects) { this.randomGenerator = randomGenerator; this.db = theCompanyEntities; this.countOfGeneratedObjects = countOfGeneratedObjects; }