Exemple #1
0
        private static SqliteConnection CreateDatabaseAndGetConnection()
        {
            var connection = new SqliteConnection("Data Source=:memory:");

            connection.Open();

            var options = new DbContextOptionsBuilder <BookStoreDbContext>()
                          .UseSqlite(connection)
                          .Options;

            using (var context = new BookStoreDbContext(options))
            {
                context.GetService <IRelationalDatabaseCreator>().CreateTables();
            }

            return(connection);
        }
Exemple #2
0
 public Test2Model(Acme.BookStore.EntityFrameworkCore.BookStoreDbContext context)
 {
     _context = context;
 }