public override JetTestStore CreateTestStore()
 {
     return(JetTestStore.GetOrCreateShared(DatabaseName, () =>
     {
         using (var context = new NullSemanticsContext(new DbContextOptionsBuilder(_options)
                                                       .UseJet(_connectionString, b => b.ApplyConfiguration()).Options))
         {
             context.Database.EnsureClean();
             NullSemanticsModelInitializer.Seed(context);
         }
     }));
 }
        public override SqlServerTestStore CreateTestStore()
        {
            return(SqlServerTestStore.GetOrCreateShared(DatabaseName, () =>
            {
                using (var context = new NullSemanticsContext(new DbContextOptionsBuilder()
                                                              .UseSqlServer(_connectionString, b => b.ApplyConfiguration())
                                                              .UseInternalServiceProvider(_serviceProvider).Options))
                {
                    context.Database.EnsureCreated();
                    NullSemanticsModelInitializer.Seed(context);

                    TestSqlLoggerFactory.Reset();
                }
            }));
        }
        public override SqliteTestStore CreateTestStore()
        {
            return(SqliteTestStore.GetOrCreateShared(DatabaseName, () =>
            {
                var optionsBuilder = new DbContextOptionsBuilder()
                                     .UseSqlite(_connectionString)
                                     .UseInternalServiceProvider(_serviceProvider);

                using (var context = new NullSemanticsContext(optionsBuilder.Options))
                {
                    // TODO: Delete DB if model changed
                    context.Database.EnsureClean();
                    NullSemanticsModelInitializer.Seed(context);
                }
            }));
        }
예제 #4
0
        public override NpgsqlTestStore CreateTestStore()
        {
            return(NpgsqlTestStore.GetOrCreateShared(DatabaseName, () =>
            {
                using (var context = new NullSemanticsContext(new DbContextOptionsBuilder()
                                                              .UseNpgsql(_connectionString)
                                                              .UseInternalServiceProvider(_serviceProvider).Options))
                {
                    // TODO: Delete DB if model changed

                    if (context.Database.EnsureCreated())
                    {
                        NullSemanticsModelInitializer.Seed(context);
                    }

                    TestSqlLoggerFactory.SqlStatements.Clear();
                }
            }));
        }
        public override SqliteTestStore CreateTestStore()
        {
            return(SqliteTestStore.GetOrCreateShared(DatabaseName, () =>
            {
                var optionsBuilder = new DbContextOptionsBuilder();
                optionsBuilder.UseSqlite(_connectionString);

                using (var context = new NullSemanticsContext(_serviceProvider, optionsBuilder.Options))
                {
                    // TODO: Delete DB if model changed
                    context.Database.EnsureDeleted();
                    if (context.Database.EnsureCreated())
                    {
                        NullSemanticsModelInitializer.Seed(context);
                    }

                    TestSqlLoggerFactory.SqlStatements.Clear();
                }
            }));
        }