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;
        }
Beispiel #2
0
        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)
 {
 }
Beispiel #4
0
 public DepartmentDataGenerator(IRandomGenerator randomGenerator, TheCompanyEntities theCompanyEntities, int countOfGeneratedObjects)
     : base(randomGenerator, theCompanyEntities, countOfGeneratedObjects)
 {
 }
Beispiel #5
0
 public DataGenerator(IRandomGenerator randomGenerator, TheCompanyEntities theCompanyEntities, int countOfGeneratedObjects)
 {
     this.randomGenerator = randomGenerator;
     this.db = theCompanyEntities;
     this.countOfGeneratedObjects = countOfGeneratedObjects;
 }
 public EmployeeDataGenerator(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;
 }
 public DepartmentDataGenerator(IRandomGenerator randomGenerator, TheCompanyEntities theCompanyEntities, int countOfGeneratedObjects)
     : base(randomGenerator, theCompanyEntities, countOfGeneratedObjects)
 {
 }