public static void Initialize(AssecorTaskDbContext context) { if (context.Colors.Any()) { return; } context.Colors.AddRange(new ColorEntity { Color = "blau", }, new ColorEntity { Color = "rot", }); context.SaveChanges(); }
public static void Initialize(AssecorTaskDbContext context) { if (context.Colors.Any()) { return; } for (int i = 0; i < Colors.Length; i++) { var color = new ColorEntity { Color = Colors[i] }; context.Colors.Add(color); } context.SaveChanges(); }