public override void Seed() { System.Diagnostics.Debug.Print("Seeding db"); var names = new string[] { "John", "Joe", "Bob", "Barney", "Fred" }; for (int i = 0; i < 5; i++) { EntityASet.Add(new EntityA { ID = i + 1, Name = names[i] }); EntityBSet.Add(new EntityB { ID = i + 1, Name = names[i] }); EntityCSet.Add(new EntityC { ID = i + 1, Name = names[i] }); EntityDSet.Add(new EntityD { ID = i + 1, Name = names[i] }); EntityESet.Add(new EntityE { ID = i + 1, Name = names[i] }); EntityFSet.Add(new EntityF { ID = i + 1, Name = names[i] }); EntityGSet.Add(new EntityG { ID = i + 1, Name = names[i] }); EntityHSet.Add(new EntityH { ID = i + 1, Name = names[i] }); EntityISet.Add(new EntityI { ID = i + 1, Name = names[i] }); EntityJSet.Add(new EntityJ { ID = i + 1, Name = names[i] }); EntityKSet.Add(new EntityK { ID = i + 1, Name = names[i] }); EntityLSet.Add(new EntityL { ID = i + 1, Name = names[i] }); } SaveChanges(); }
public override void Seed() { System.Diagnostics.Debug.Print("Seeding db"); for (int i = 1; i <= 10; i++) { EntityASet.Add(new EntityA { ID = i }); EntityBSet.Add(new EntityB { ID = i }); EntityCSet.Add(new EntityC { ID = i }); EntityDSet.Add(new EntityD { ID = i }); EntityESet.Add(new EntityE { ID = i }); EntityFSet.Add(new EntityF { ID = i }); EntityGSet.Add(new EntityG { ID = i }); EntityHSet.Add(new EntityH { ID = i }); EntityISet.Add(new EntityI { ID = i }); EntityJSet.Add(new EntityJ { ID = i, OwnerID = i }); } SaveChanges(); }
public override void Seed() { System.Diagnostics.Debug.Print("Seeding db"); for (int i = 1; i <= 10; i++) { EntityASet.Add(new EntityA { ID = i }); EntityBSet.Add(new EntityB { ID = i }); EntityCSet.Add(new EntityC { ID = i }); EntityLSet.Add(new EntityL { ID = i }); EntityDSet.Add(new EntityD { IntValue = i }); EntityESet.Add(new EntityE { IntValue = i }); EntityFSet.Add(new EntityF { IntValue = i }); EntityGSet.Add(new EntityG { StrValue = i.ToString() }); } // Note: SQL Server does not return records using "in (null)" syntax... EntityESet.Add(new EntityE()); // For a null IntValue record EntityHSet.Add(new EntityH { BoolValue = true }); EntityHSet.Add(new EntityH { BoolValue = false }); EntityISet.Add(new EntityI { GuidValue = Guid.Parse("3A298D91-3857-E411-829F-001C428D83FF") }); EntityISet.Add(new EntityI { GuidValue = Guid.Parse("3B298D91-3857-E411-829F-001C428D83FF") }); EntityISet.Add(new EntityI { GuidValue = Guid.NewGuid() }); EntityISet.Add(new EntityI { GuidValue = Guid.NewGuid() }); EntityJSet.Add(new EntityJ { DateValue = new DateTime(2015, 1, 1) }); EntityJSet.Add(new EntityJ { DateValue = new DateTime(2015, 1, 2, 12, 34, 56, 190) }); EntityJSet.Add(new EntityJ { DateValue = new DateTime(2015, 1, 3) }); EntityJSet.Add(new EntityJ { DateValue = DateTime.Now }); EntityJSet.Add(new EntityJ { DateValue = DateTime.Now.AddDays(7) }); #if (!SKIP_DATETIMEOFFSET_TEST) EntityKSet.Add(new EntityK { DateValue = new DateTime(2015, 1, 1) }); EntityKSet.Add(new EntityK { DateValue = new DateTime(2015, 1, 2, 12, 34, 56, 190) }); EntityKSet.Add(new EntityK { DateValue = new DateTime(2015, 1, 3) }); EntityKSet.Add(new EntityK { DateValue = DateTime.Now }); EntityKSet.Add(new EntityK { DateValue = DateTime.Now.AddDays(7) }); #endif EntityMSet.Add(new EntityM { ID = 1, EnumValue = TestEnum.Value1 }); EntityMSet.Add(new EntityM { ID = 2, EnumValue = TestEnum.Value2 }); EntityMSet.Add(new EntityM { ID = 3, EnumValue = TestEnum.Value3 }); EntityMSet.Add(new EntityM { ID = 4, EnumValue = TestEnum.Value4 }); EntityMSet.Add(new EntityM { ID = 5, EnumValue = TestEnum.Value5 }); var tenantID2 = Guid.NewGuid(); TenantEntityASet.Add(new TenantEntityA { ID = 1, TenantID = TestContext.TenantID1, EntityBList = new List <TenantEntityB>() { new TenantEntityB { ID = 1, TenantID = TestContext.TenantID1 }, new TenantEntityB { ID = 2, TenantID = TestContext.TenantID1 }, new TenantEntityB { ID = 3, TenantID = TestContext.TenantID2 }, new TenantEntityB { ID = 4, TenantID = tenantID2 }, new TenantEntityB { ID = 5, TenantID = tenantID2 }, new TenantEntityB { ID = 6, TenantID = tenantID2 } } }); TenantEntityASet.Add(new TenantEntityA { ID = 2, TenantID = tenantID2, EntityBList = new List <TenantEntityB>() { new TenantEntityB { ID = 10, TenantID = TestContext.TenantID1 }, new TenantEntityB { ID = 11, TenantID = TestContext.TenantID2 }, new TenantEntityB { ID = 12, TenantID = TestContext.TenantID2 }, new TenantEntityB { ID = 13, TenantID = tenantID2 }, new TenantEntityB { ID = 14, TenantID = tenantID2 }, new TenantEntityB { ID = 15, TenantID = tenantID2 } } }); SaveChanges(); }
public override void Seed() { EntityASet.Add(new EntityA { ID = 1 }); EntityASet.Add(new EntityA { ID = 2, DeleteTimestamp = DateTime.Now.AddMinutes(-1) }); EntityBSet.Add(new EntityB { ID = 1 }); EntityBSet.Add(new EntityB { ID = 2, DeleteTimestamp = DateTime.Now.AddMinutes(-1) }); EntityCSet.Add(new EntityC { ID = 1 }); EntityCSet.Add(new EntityC { ID = 2, DeleteTimestamp = DateTime.Now.AddMinutes(-1) }); EntityDSet.Add(new EntityD { ID = 1 }); EntityDSet.Add(new EntityD { ID = 2, DeleteTimestamp = DateTime.Now.AddMinutes(-1) }); EntityESet.Add(new EntityE { ID = 1, TenantID = 1 }); EntityESet.Add(new EntityE { ID = 2, TenantID = 2 }); EntityESet.Add(new EntityE { ID = 3, TenantID = null }); EntityFSet.Add(new EntityF { ID = 1, TenantID = 1 }); EntityFSet.Add(new EntityF { ID = 2, TenantID = 2 }); EntityFSet.Add(new EntityF { ID = 3, TenantID = null }); EntityGSet.Add(new EntityG { ID = 1, TenantID = 1 }); EntityGSet.Add(new EntityG { ID = 2, TenantID = 2 }); EntityGSet.Add(new EntityG { ID = 3, TenantID = null }); EntityHSet.Add(new EntityH { ID = 1, TenantID = 1 }); EntityHSet.Add(new EntityH { ID = 2, TenantID = 2 }); EntityHSet.Add(new EntityH { ID = 3, TenantID = null }); EntityISet.Add(new EntityI { ID = 1, TenantID = 1 }); EntityISet.Add(new EntityI { ID = 2, TenantID = 2 }); EntityISet.Add(new EntityI { ID = 3, TenantID = null }); EntityJSet.Add(new EntityJ { ID = 1, Value = 1 }); EntityJSet.Add(new EntityJ { ID = 2, Value = 2 }); EntityJSet.Add(new EntityJ { ID = 3, Value = 3 }); EntityJSet.Add(new EntityJ { ID = 4, Value = 4 }); EntityKSet.Add(new EntityK { ID = 1, TenantID = 1, Name = "A" }); EntityKSet.Add(new EntityK { ID = 2, TenantID = 2, Name = "B" }); EntityKSet.Add(new EntityK { ID = 3, TenantID = null, Name = "C" }); EntityLSet.Add(new EntityL { ID = 1, TenantID = 1 }); EntityLSet.Add(new EntityL { ID = 2, TenantID = 2 }); EntityLSet.Add(new EntityL { ID = 3, TenantID = null }); EntityMSet.Add(new EntityM { ID = 1 }); EntityMSet.Add(new EntityM { ID = 2, DeleteTimestamp = DateTime.Now.AddMinutes(-1) }); SaveChanges(); }
public override void Seed() { for (int i = 1; i <= 5; i++) { EntityASet.Add(new EntityA { ID = i, Children = new List <EntityAChild> { new EntityAChild { ID = i } } }); var entityB = new EntityB { ID = i }; if (i <= 2) { entityB.Children = new List <EntityBChild>() { new EntityBChild { ID = i * 10 + 1 } } } ; EntityBSet.Add(entityB); EntityCSet.Add(new EntityC { ID = i, Children = new List <EntityCChild>() { new EntityCChild { ID = i } } }); EntityESet.Add(new EntityE { ID = i, Children = new List <EntityEChild>() { new EntityEChild { ID = i } } }); } EntityDSet.Add(new EntityD { ID = 1, Children = new List <EntityDChild> { new EntityDChild { ID = 1, ChildValue = 1 }, new EntityDChild { ID = 2, ChildValue = 2 }, new EntityDChild { ID = 3, ChildValue = 1 }, new EntityDChild { ID = 4, ChildValue = 3 }, new EntityDChild { ID = 5, ChildValue = 4 }, } }); EntityDSet.Add(new EntityD { ID = 2, Children = new List <EntityDChild> { new EntityDChild { ID = 6, ChildValue = 1 }, new EntityDChild { ID = 7, ChildValue = 3 }, new EntityDChild { ID = 8, ChildValue = 1 }, } }); EntityFSet.Add(new EntityF { ID = 1, Children = new List <EntityFChild> { new EntityFChild { ID = 1, ChildValue = 1 }, new EntityFChild { ID = 2, ChildValue = 1 }, new EntityFChild { ID = 3, ChildValue = 3 }, new EntityFChild { ID = 4, ChildValue = 4 }, } }); EntityFSet.Add(new EntityF { ID = 2, Children = new List <EntityFChild> { new EntityFChild { ID = 5, ChildValue = 1 }, new EntityFChild { ID = 6, ChildValue = 2 }, new EntityFChild { ID = 7, ChildValue = 3 }, } }); EntityGSet.Add(new EntityG { ID = 1, IsDeleted = false, HEntities = new HashSet <EntityH> { new EntityH { ID = 1, IsDeleted = false }, new EntityH { ID = 2, IsDeleted = true }, } }); EntityGSet.Add(new EntityG { ID = 2, IsDeleted = true, HEntities = new HashSet <EntityH> { new EntityH { ID = 3, IsDeleted = false }, new EntityH { ID = 4, IsDeleted = true }, } }); EntityISet.Add(new EntityI { ID = 1, Children = new List <EntityIChild> { new EntityIChild { ID = 1, ChildValue = "1234" }, new EntityIChild { ID = 2, ChildValue = "5678" }, } }); EntityISet.Add(new EntityI { ID = 2, Children = new List <EntityIChild> { new EntityIChild { ID = 3, ChildValue = "abcd" }, new EntityIChild { ID = 4, ChildValue = "edfg" }, } }); SaveChanges(); } }