public static void SeedText(OrionInnovationSqlDbContext context) { if (context.Set <Text>().Any()) { return; // Db has been seeded; } var textList = new Text[] { Text.Create("Sample text from DB by Nikola Bojkovic!", new DateTime(2020, 10, 1)), Text.Create("More text from db for testing", new DateTime(2020, 10, 5)), }; context.Set <Text>().AddRange(textList); context.SaveChanges(); }
public UnitOfWork(OrionInnovationSqlDbContext context) { _context = context; }
public static void Initialize(OrionInnovationSqlDbContext context) { context.Database.Migrate(); context.Database.EnsureCreated(); }