public NotificationEntitiesSqlCeFixture() { _options = new DbContextOptionsBuilder() .UseSqlCe(SqlCeTestStore.CreateConnectionString(DatabaseName), b => b.ApplyConfiguration()) .UseInternalServiceProvider(new ServiceCollection() .AddEntityFrameworkSqlCe() .AddSingleton(TestModelSource.GetFactory(OnModelCreating)) .BuildServiceProvider()) .Options; }
public FindSqlCeFixture() { var serviceProvider = new ServiceCollection() .AddEntityFrameworkSqlCe() .AddSingleton(TestModelSource.GetFactory(OnModelCreating)) .AddSingleton <ILoggerFactory>(TestSqlLoggerFactory) .BuildServiceProvider(); _options = new DbContextOptionsBuilder() .UseSqlCe(SqlCeTestStore.CreateConnectionString(DatabaseName), b => b.ApplyConfiguration()) .UseInternalServiceProvider(serviceProvider) .EnableSensitiveDataLogging() .Options; }
public NullKeysSqlCeFixture() { var name = "StringsContext"; var connectionString = SqlCeTestStore.CreateConnectionString(name); _options = new DbContextOptionsBuilder() .UseSqlCe(connectionString, b => b.ApplyConfiguration()) .UseInternalServiceProvider(new ServiceCollection() .AddEntityFrameworkSqlCe() .AddSingleton(TestModelSource.GetFactory(OnModelCreating)) .BuildServiceProvider()) .Options; _testStore = SqlCeTestStore.GetOrCreateShared(name, EnsureCreated); }
public override SqlCeTestStore CreateTestStore() { return(SqlCeTestStore.GetOrCreateShared(DatabaseName, () => { var optionsBuilder = new DbContextOptionsBuilder() .UseSqlCe(SqlCeTestStore.CreateConnectionString(DatabaseName)) .UseInternalServiceProvider(_serviceProvider); using (var context = new AdvancedPatternsMasterContext(optionsBuilder.Options)) { context.Database.EnsureClean(); Seed(context); } })); }
public override SqlCeTestStore CreateTestStore() { return(SqlCeTestStore.GetOrCreateShared(DatabaseName, () => { var optionsBuilder = new DbContextOptionsBuilder() .UseSqlCe(SqlCeTestStore.CreateConnectionString(DatabaseName), b => b.ApplyConfiguration()) .UseInternalServiceProvider(_serviceProvider); using (var context = new FieldMappingContext(optionsBuilder.Options)) { context.Database.EnsureClean(); Seed(context); } })); }
public override DbContextOptions BuildOptions() { return (new DbContextOptionsBuilder() .EnableSensitiveDataLogging() .UseSqlCe( SqlCeTestStore.CreateConnectionString("InheritanceSqlCeTest"), b => b.ApplyConfiguration()) .UseInternalServiceProvider( new ServiceCollection() .AddEntityFrameworkSqlCe() .AddSingleton(TestModelSource.GetFactory(OnModelCreating)) .AddSingleton <ILoggerFactory>(TestSqlLoggerFactory) .BuildServiceProvider()) .Options); }
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) { optionsBuilder .UseSqlCe(SqlCeTestStore.CreateConnectionString(_databaseName)) .UseInternalServiceProvider(_serviceProvider); }