Esempio n. 1
0
        public void InitLocalMySQL()
        {
            if (this.Database.CreateIfNotExists())
            {
                EntityGenerator <Address> generatorAddress = new EntityGenerator <Address>();
                for (int i = 0; i < 10; i++)
                {
                    AddressTable.Add(generatorAddress.GenerateItem());
                }

                EntityGenerator <StreetNumber> generatorStreetNumber = new EntityGenerator <StreetNumber>();
                for (int i = 0; i < 20; i++)
                {
                    StreetNumberTable.Add(generatorStreetNumber.GenerateItem());
                }

                EntityGenerator <Employee> generatorEmployee = new EntityGenerator <Employee>();
                for (int i = 0; i < 10; i++)
                {
                    EmployeeTable.Add(generatorEmployee.GenerateItem());
                }

                EntityGenerator <Animal> generatorAnimal = new EntityGenerator <Animal>();
                for (int i = 0; i < 10; i++)
                {
                    AnimalTable.Add(generatorAnimal.GenerateItem());
                }

                EntityGenerator <Job> generatorJob = new EntityGenerator <Job>();
                for (int i = 0; i < 10; i++)
                {
                    JobTable.Add(generatorJob.GenerateItem());
                }

                EntityGenerator <Schedule> generatorSchedule = new EntityGenerator <Schedule>();
                for (int i = 0; i < 10; i++)
                {
                    ScheduleTable.Add(generatorSchedule.GenerateItem());
                }


                EntityGenerator <Structure> generatorStructure = new EntityGenerator <Structure>();
                for (int i = 0; i < 10; i++)
                {
                    StructureTable.Add(generatorStructure.GenerateItem());
                }

                EntityGenerator <Zoo> generatorZoo = new EntityGenerator <Zoo>();
                for (int i = 0; i < 10; i++)

                {
                    ZooTable.Add(generatorZoo.GenerateItem());
                }

                this.SaveChangesAsync();


                AddressTable.Find(1).StreetNumber = StreetNumberTable.Find(1);
                this.SaveChangesAsync();
            }
        }