public override SqliteTestStore CreateTestStore(Action <ModelBuilder> onModelCreating)
        => SqliteTestStore.GetOrCreateShared(DatabaseName, false, true, () =>
        {
            var optionsBuilder = new DbContextOptionsBuilder()
                                 .UseSqlite(SqliteTestStore.CreateConnectionString(DatabaseName))
                                 .EnableSensitiveDataLogging()
                                 .UseInternalServiceProvider(BuildServiceProvider(onModelCreating));

            using (var context = new TransportationContext(optionsBuilder.Options))
            {
                context.Database.EnsureClean();
                context.Seed();
            }
        });
Exemple #2
0
        public override SqlCeTestStore CreateTestStore(Action <ModelBuilder> onModelCreating)
        => SqlCeTestStore.GetOrCreateShared(DatabaseName, () =>
        {
            var optionsBuilder = new DbContextOptionsBuilder()
                                 .UseSqlCe(_connectionString, b => b.ApplyConfiguration().CommandTimeout(300))
                                 .EnableSensitiveDataLogging()
                                 .UseInternalServiceProvider(BuildServiceProvider(onModelCreating));

            using (var context = new TransportationContext(optionsBuilder.Options))
            {
                context.Database.EnsureCreated();
                context.Seed();
            }
        });