Пример #1
0
        public void SeedEverything(QAEngineDbContext context)
        {
            context.Database.EnsureCreated();

            if (context.Customers.Any())
            {
                return; // DB has been seeded
            }

            SeedCustomers(context);
        }
Пример #2
0
        private void SeedCustomers(QAEngineDbContext context)
        {
            var customer = new[]
            {
                new Customer {
                    CustomerId = "993HAGH", Title = "Mr", FirstName = "Bilaal", LastName = "Nadeem", Address = "88 Meir Road", City = "Stoke-On-Trent", Region = "Staffordshire", PostalCode = "ST3 7JB", Country = "United Kingdom", Phone = "07702 575 157", AccountCreated = DateTime.Parse("October 10 2018"), DateOfBirth = DateTime.Parse("September 18 1995")
                }
            };

            context.Customers.AddRange(customer);
            context.SaveChanges();
        }
Пример #3
0
        public static void Initialize(QAEngineDbContext context)
        {
            var initializer = new QAEngineInitializer();

            initializer.SeedEverything(context);
        }