public static void Seed(NullSemanticsContext context) { // TODO: only delete if model has changed context.Database.EnsureDeleted(); if (context.Database.EnsureCreated()) { var nullableBoolValues = new bool?[] { false, true, null }; var nullableStringValues = new string[] { "Foo", "Bar", null }; var nullableIntValues = new int?[] { 0, 1, null }; var boolValues = new bool[] { false, true, true }; var stringValues = new string[] { "Foo", "Bar", "Bar" }; var intValues = new int[] { 0, 1, 2 }; var entities1 = new List<NullSemanticsEntity1>(); var entities2 = new List<NullSemanticsEntity2>(); int id = 0; for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { for (int k = 0; k < 3; k++) { id++; var entity1 = new NullSemanticsEntity1 { Id = id, BoolA = boolValues[i], BoolB = boolValues[j], BoolC = boolValues[k], NullableBoolA = nullableBoolValues[i], NullableBoolB = nullableBoolValues[j], NullableBoolC = nullableBoolValues[k], StringA = stringValues[i], StringB = stringValues[j], StringC = stringValues[k], NullableStringA = nullableStringValues[i], NullableStringB = nullableStringValues[j], NullableStringC = nullableStringValues[k], IntA = intValues[i], IntB = intValues[j], IntC = intValues[k], NullableIntA = nullableIntValues[i], NullableIntB = nullableIntValues[j], NullableIntC = nullableIntValues[k], }; var entity2 = new NullSemanticsEntity2 { Id = id, BoolA = boolValues[i], BoolB = boolValues[j], BoolC = boolValues[k], NullableBoolA = nullableBoolValues[i], NullableBoolB = nullableBoolValues[j], NullableBoolC = nullableBoolValues[k], StringA = stringValues[i], StringB = stringValues[j], StringC = stringValues[k], NullableStringA = nullableStringValues[i], NullableStringB = nullableStringValues[j], NullableStringC = nullableStringValues[k], IntA = intValues[i], IntB = intValues[j], IntC = intValues[k], NullableIntA = nullableIntValues[i], NullableIntB = nullableIntValues[j], NullableIntC = nullableIntValues[k], }; entities1.Add(entity1); entities2.Add(entity2); } } } context.Entities1.AddRange(entities1); context.Entities2.AddRange(entities2); context.SaveChanges(); } }
public void Initialize() { var nullableBoolValues = new bool?[] { false, true, null }; var nullableStringValues = new string[] { "Foo", "Bar", null }; var nullableIntValues = new int?[] { 0, 1, null }; var boolValues = new bool[] { false, true, true }; var stringValues = new string[] { "Foo", "Bar", "Bar" }; var intValues = new int[] { 0, 1, 2 }; var entities1 = new List <NullSemanticsEntity1>(); var entities2 = new List <NullSemanticsEntity2>(); int id = 0; for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { for (int k = 0; k < 3; k++) { id++; var entity1 = new NullSemanticsEntity1 { Id = id, BoolA = boolValues[i], BoolB = boolValues[j], BoolC = boolValues[k], NullableBoolA = nullableBoolValues[i], NullableBoolB = nullableBoolValues[j], NullableBoolC = nullableBoolValues[k], StringA = stringValues[i], StringB = stringValues[j], StringC = stringValues[k], NullableStringA = nullableStringValues[i], NullableStringB = nullableStringValues[j], NullableStringC = nullableStringValues[k], IntA = intValues[i], IntB = intValues[j], IntC = intValues[k], NullableIntA = nullableIntValues[i], NullableIntB = nullableIntValues[j], NullableIntC = nullableIntValues[k], }; var entity2 = new NullSemanticsEntity2 { Id = id, BoolA = boolValues[i], BoolB = boolValues[j], BoolC = boolValues[k], NullableBoolA = nullableBoolValues[i], NullableBoolB = nullableBoolValues[j], NullableBoolC = nullableBoolValues[k], StringA = stringValues[i], StringB = stringValues[j], StringC = stringValues[k], NullableStringA = nullableStringValues[i], NullableStringB = nullableStringValues[j], NullableStringC = nullableStringValues[k], IntA = intValues[i], IntB = intValues[j], IntC = intValues[k], NullableIntA = nullableIntValues[i], NullableIntB = nullableIntValues[j], NullableIntC = nullableIntValues[k], }; entities1.Add(entity1); entities2.Add(entity2); } } } _entities1 = entities1.ToArray(); _entities2 = entities2.ToArray(); }
public static void Seed(NullSemanticsContext context) { var nullableBoolValues = new bool?[] { false, true, null }; var nullableStringValues = new[] { "Foo", "Bar", null }; var nullableIntValues = new int?[] { 0, 1, null }; var boolValues = new[] { false, true, true }; var stringValues = new[] { "Foo", "Bar", "Bar" }; var intValues = new[] { 0, 1, 2 }; var entities1 = new List<NullSemanticsEntity1>(); var entities2 = new List<NullSemanticsEntity2>(); var id = 0; for (var i = 0; i < 3; i++) { for (var j = 0; j < 3; j++) { for (var k = 0; k < 3; k++) { id++; var entity1 = new NullSemanticsEntity1 { Id = id, BoolA = boolValues[i], BoolB = boolValues[j], BoolC = boolValues[k], NullableBoolA = nullableBoolValues[i], NullableBoolB = nullableBoolValues[j], NullableBoolC = nullableBoolValues[k], StringA = stringValues[i], StringB = stringValues[j], StringC = stringValues[k], NullableStringA = nullableStringValues[i], NullableStringB = nullableStringValues[j], NullableStringC = nullableStringValues[k], IntA = intValues[i], IntB = intValues[j], IntC = intValues[k], NullableIntA = nullableIntValues[i], NullableIntB = nullableIntValues[j], NullableIntC = nullableIntValues[k] }; var entity2 = new NullSemanticsEntity2 { Id = id, BoolA = boolValues[i], BoolB = boolValues[j], BoolC = boolValues[k], NullableBoolA = nullableBoolValues[i], NullableBoolB = nullableBoolValues[j], NullableBoolC = nullableBoolValues[k], StringA = stringValues[i], StringB = stringValues[j], StringC = stringValues[k], NullableStringA = nullableStringValues[i], NullableStringB = nullableStringValues[j], NullableStringC = nullableStringValues[k], IntA = intValues[i], IntB = intValues[j], IntC = intValues[k], NullableIntA = nullableIntValues[i], NullableIntB = nullableIntValues[j], NullableIntC = nullableIntValues[k] }; entities1.Add(entity1); entities2.Add(entity2); } } } context.Entities1.AddRange(entities1); context.Entities2.AddRange(entities2); context.SaveChanges(); }
public static void Seed(NullSemanticsContext context) { var nullableBoolValues = new bool?[] { false, true, null }; var nullableStringValues = new[] { "Foo", "Bar", null }; var nullableIntValues = new int?[] { 0, 1, null }; var boolValues = new[] { false, true, true }; var stringValues = new[] { "Foo", "Bar", "Bar" }; var intValues = new[] { 0, 1, 2 }; var entities1 = new List <NullSemanticsEntity1>(); var entities2 = new List <NullSemanticsEntity2>(); var id = 0; for (var i = 0; i < 3; i++) { for (var j = 0; j < 3; j++) { for (var k = 0; k < 3; k++) { id++; var entity1 = new NullSemanticsEntity1 { Id = id, BoolA = boolValues[i], BoolB = boolValues[j], BoolC = boolValues[k], NullableBoolA = nullableBoolValues[i], NullableBoolB = nullableBoolValues[j], NullableBoolC = nullableBoolValues[k], StringA = stringValues[i], StringB = stringValues[j], StringC = stringValues[k], NullableStringA = nullableStringValues[i], NullableStringB = nullableStringValues[j], NullableStringC = nullableStringValues[k], IntA = intValues[i], IntB = intValues[j], IntC = intValues[k], NullableIntA = nullableIntValues[i], NullableIntB = nullableIntValues[j], NullableIntC = nullableIntValues[k] }; var entity2 = new NullSemanticsEntity2 { Id = id, BoolA = boolValues[i], BoolB = boolValues[j], BoolC = boolValues[k], NullableBoolA = nullableBoolValues[i], NullableBoolB = nullableBoolValues[j], NullableBoolC = nullableBoolValues[k], StringA = stringValues[i], StringB = stringValues[j], StringC = stringValues[k], NullableStringA = nullableStringValues[i], NullableStringB = nullableStringValues[j], NullableStringC = nullableStringValues[k], IntA = intValues[i], IntB = intValues[j], IntC = intValues[k], NullableIntA = nullableIntValues[i], NullableIntB = nullableIntValues[j], NullableIntC = nullableIntValues[k] }; entities1.Add(entity1); entities2.Add(entity2); } } } context.Entities1.AddRange(entities1); context.Entities2.AddRange(entities2); context.SaveChanges(); }
public static void Seed(NullSemanticsContext context) { // TODO: only delete if model has changed context.Database.EnsureDeleted(); if (context.Database.EnsureCreated()) { var nullableBoolValues = new bool?[] { false, true, null }; var nullableStringValues = new string[] { "Foo", "Bar", null }; var nullableIntValues = new int?[] { 0, 1, null }; var boolValues = new bool[] { false, true, true }; var stringValues = new string[] { "Foo", "Bar", "Bar" }; var intValues = new int[] { 0, 1, 2 }; var entities1 = new List <NullSemanticsEntity1>(); var entities2 = new List <NullSemanticsEntity2>(); int id = 0; for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { for (int k = 0; k < 3; k++) { id++; var entity1 = new NullSemanticsEntity1 { Id = id, BoolA = boolValues[i], BoolB = boolValues[j], BoolC = boolValues[k], NullableBoolA = nullableBoolValues[i], NullableBoolB = nullableBoolValues[j], NullableBoolC = nullableBoolValues[k], StringA = stringValues[i], StringB = stringValues[j], StringC = stringValues[k], NullableStringA = nullableStringValues[i], NullableStringB = nullableStringValues[j], NullableStringC = nullableStringValues[k], IntA = intValues[i], IntB = intValues[j], IntC = intValues[k], NullableIntA = nullableIntValues[i], NullableIntB = nullableIntValues[j], NullableIntC = nullableIntValues[k], }; var entity2 = new NullSemanticsEntity2 { Id = id, BoolA = boolValues[i], BoolB = boolValues[j], BoolC = boolValues[k], NullableBoolA = nullableBoolValues[i], NullableBoolB = nullableBoolValues[j], NullableBoolC = nullableBoolValues[k], StringA = stringValues[i], StringB = stringValues[j], StringC = stringValues[k], NullableStringA = nullableStringValues[i], NullableStringB = nullableStringValues[j], NullableStringC = nullableStringValues[k], IntA = intValues[i], IntB = intValues[j], IntC = intValues[k], NullableIntA = nullableIntValues[i], NullableIntB = nullableIntValues[j], NullableIntC = nullableIntValues[k], }; entities1.Add(entity1); entities2.Add(entity2); } } } context.Entities1.AddRange(entities1); context.Entities2.AddRange(entities2); context.SaveChanges(); } }