private static SqliteConnection CreateDatabaseAndGetConnection() { var connection = new SqliteConnection("Data Source=:memory:"); connection.Open(); using (var context = new TestMigrationsDbContext(new DbContextOptionsBuilder <TestMigrationsDbContext>().UseSqlite(connection).Options)) { context.GetService <IRelationalDatabaseCreator>().CreateTables(); } return(connection); }
private static SqliteConnection CreateDatabaseAndGetConnection() { var connection = new SqliteConnection("Data Source=:memory:"); connection.Open(); using (var context = new TestMigrationsDbContext(new DbContextOptionsBuilder <TestMigrationsDbContext>().UseSqlite(connection).Options)) { context.GetService <IRelationalDatabaseCreator>().CreateTables(); context.Database.ExecuteSqlRaw( @"CREATE VIEW View_PersonView AS SELECT Name, CreationTime, Birthday, LastActive FROM People"); } return(connection); }