예제 #1
0
        private void SeedEverything(MemberManagementDbContext context)
        {
            context.Database.EnsureCreated();

            if (context.Members.Any())
            {
                return; // we are seeded
            }

            SeedMembers(context);
        }
예제 #2
0
        private void SeedMembers(MemberManagementDbContext context)
        {
            var customers = new[]
            {
                new Member
                {
                    FirstName  = "Hafiz",
                    LastName   = "Abass",
                    MiddleName = "Gbulo",
                    DoB        = new DateTime(1974, 02, 01),
                    Email      = GenerateRandomEmail() + "@gmail.com",
                    Phone      = "024443323121",
                }, new Member
                {
                    FirstName  = "Joris",
                    LastName   = "Hein",
                    MiddleName = "Van",
                    DoB        = new DateTime(1974, 02, 01),
                    Email      = GenerateRandomEmail() + "@gmail.com",
                    Phone      = "024443323121",
                }, new Member
                {
                    FirstName = "Raimund",
                    LastName  = "Drucker",
                    DoB       = new DateTime(1974, 02, 01),
                    Email     = GenerateRandomEmail() + "@gmail.com",
                    Phone     = "024443323121",
                }, new Member
                {
                    FirstName  = "Hafiz",
                    LastName   = "Abass",
                    MiddleName = "Gbulo",
                    DoB        = new DateTime(1974, 02, 01),
                    Email      = GenerateRandomEmail() + "@gmail.com",
                    Phone      = "024443323121",
                },
            };

            context.Members.AddRange(customers);
            context.SaveChanges();
        }
예제 #3
0
        public static void Initialize(MemberManagementDbContext context)
        {
            var initializer = new MemberManagementApiInitializer();

            initializer.SeedEverything(context);
        }