示例#1
0
        public static void Initialize(A2spaContext context)
        {
            // performs any outstanding migrations.
            if (context.Database.GetPendingMigrations().Any())
            {
                context.Database.Migrate();
            }

            // Look for any test data.
            if (context.TestData.Any())
            {
                return;   // DB has been seeded
            }

            var testData = new TestData
            {
                Username = "******",
                EmailAddress = "*****@*****.**",
                Password = "******",
                Currency = 321.45M
            };

            context.TestData.Add(testData);
            context.SaveChanges();
        }
示例#2
0
        public static void Initialize(A2spaContext context)
        {
            context.Database.EnsureCreated();

            // Look for any test data.
            if (context.TestData.Any())
            {
                return;   // DB has been seeded
            }

            var testData = new TestData
            {
                Username     = "******",
                EmailAddress = "*****@*****.**",
                Password     = "******",
                Currency     = 321.45M
            };

            context.TestData.Add(testData);
            context.SaveChanges();
        }