public IEnumerable <DAL.Person> Initialize()
        {
            // Look for data
            if (context.Persons.Any())
            {
                return(new List <DAL.Person>()); // Db has been initialized
            }

            var persons = new DAL.Person[]
            {
                Mapper.Map <DAL.Person>(new Bogus.Person()),
                Mapper.Map <DAL.Person>(new Bogus.Person()),
                Mapper.Map <DAL.Person>(new Bogus.Person()),
                Mapper.Map <DAL.Person>(new Bogus.Person()),
                Mapper.Map <DAL.Person>(new Bogus.Person()),
                Mapper.Map <DAL.Person>(new Bogus.Person()),
                Mapper.Map <DAL.Person>(new Bogus.Person()),
                Mapper.Map <DAL.Person>(new Bogus.Person()),
                Mapper.Map <DAL.Person>(new Bogus.Person()),
                Mapper.Map <DAL.Person>(new Bogus.Person()),
                Mapper.Map <DAL.Person>(new Bogus.Person()),
                Mapper.Map <DAL.Person>(new Bogus.Person()),
                Mapper.Map <DAL.Person>(new Bogus.Person()),
                Mapper.Map <DAL.Person>(new Bogus.Person()),
                Mapper.Map <DAL.Person>(new Bogus.Person()),
                Mapper.Map <DAL.Person>(new Bogus.Person()),
                Mapper.Map <DAL.Person>(new Bogus.Person()),
                Mapper.Map <DAL.Person>(new Bogus.Person()),
                Mapper.Map <DAL.Person>(new Bogus.Person()),
                Mapper.Map <DAL.Person>(new Bogus.Person()),
                Mapper.Map <DAL.Person>(new Bogus.Person()),
                Mapper.Map <DAL.Person>(new Bogus.Person()),
                Mapper.Map <DAL.Person>(new Bogus.Person("fr_CA")),
                Mapper.Map <DAL.Person>(new Bogus.Person("fr_CA")),
                Mapper.Map <DAL.Person>(new Bogus.Person("fr_CA")),
                Mapper.Map <DAL.Person>(new Bogus.Person("fr_CA")),
                Mapper.Map <DAL.Person>(new Bogus.Person("fr_CA")),
                Mapper.Map <DAL.Person>(new Bogus.Person("fr_CA")),
                Mapper.Map <DAL.Person>(new Bogus.Person("fr_CA")),
                Mapper.Map <DAL.Person>(new Bogus.Person("fr_CA")),
                Mapper.Map <DAL.Person>(new Bogus.Person("fr_CA")),
                Mapper.Map <DAL.Person>(new Bogus.Person("fr_CA")),
                Mapper.Map <DAL.Person>(new Bogus.Person("fr_CA")),
                Mapper.Map <DAL.Person>(new Bogus.Person("fr_CA")),
                Mapper.Map <DAL.Person>(new Bogus.Person("fr_CA")),
                Mapper.Map <DAL.Person>(new Bogus.Person("fr_CA")),
            };

            context.Persons.AddRange(persons);
            context.SaveChanges();


            loadedPeople = persons;
            return(persons);
        }
Пример #2
0
        public static void Initialize(TestingContext context)
        {
            // Look for data
            if (context.Persons.Any())
            {
                return; // Db has been initialized
            }

            var persons = new DataModels.Person[]
            {
                Mapper.Map <DataModels.Person>(new Bogus.Person()),
                Mapper.Map <DataModels.Person>(new Bogus.Person()),
                Mapper.Map <DataModels.Person>(new Bogus.Person()),
                Mapper.Map <DataModels.Person>(new Bogus.Person()),
                Mapper.Map <DataModels.Person>(new Bogus.Person()),
                Mapper.Map <DataModels.Person>(new Bogus.Person()),
                Mapper.Map <DataModels.Person>(new Bogus.Person()),
                Mapper.Map <DataModels.Person>(new Bogus.Person()),
                Mapper.Map <DataModels.Person>(new Bogus.Person()),
                Mapper.Map <DataModels.Person>(new Bogus.Person()),
                Mapper.Map <DataModels.Person>(new Bogus.Person()),
                Mapper.Map <DataModels.Person>(new Bogus.Person()),
                Mapper.Map <DataModels.Person>(new Bogus.Person()),
                Mapper.Map <DataModels.Person>(new Bogus.Person()),
                Mapper.Map <DataModels.Person>(new Bogus.Person()),
                Mapper.Map <DataModels.Person>(new Bogus.Person()),
                Mapper.Map <DataModels.Person>(new Bogus.Person()),
                Mapper.Map <DataModels.Person>(new Bogus.Person()),
                Mapper.Map <DataModels.Person>(new Bogus.Person()),
                Mapper.Map <DataModels.Person>(new Bogus.Person()),
                Mapper.Map <DataModels.Person>(new Bogus.Person()),
                Mapper.Map <DataModels.Person>(new Bogus.Person()),
                Mapper.Map <DataModels.Person>(new Bogus.Person("fr_CA")),
                Mapper.Map <DataModels.Person>(new Bogus.Person("fr_CA")),
                Mapper.Map <DataModels.Person>(new Bogus.Person("fr_CA")),
                Mapper.Map <DataModels.Person>(new Bogus.Person("fr_CA")),
                Mapper.Map <DataModels.Person>(new Bogus.Person("fr_CA")),
                Mapper.Map <DataModels.Person>(new Bogus.Person("fr_CA")),
                Mapper.Map <DataModels.Person>(new Bogus.Person("fr_CA")),
                Mapper.Map <DataModels.Person>(new Bogus.Person("fr_CA")),
                Mapper.Map <DataModels.Person>(new Bogus.Person("fr_CA")),
                Mapper.Map <DataModels.Person>(new Bogus.Person("fr_CA")),
                Mapper.Map <DataModels.Person>(new Bogus.Person("fr_CA")),
                Mapper.Map <DataModels.Person>(new Bogus.Person("fr_CA")),
                Mapper.Map <DataModels.Person>(new Bogus.Person("fr_CA")),
                Mapper.Map <DataModels.Person>(new Bogus.Person("fr_CA")),
            };

            context.Persons.AddRange(persons);
            context.SaveChanges();
        }