public override NorthwindContext CreateContext() { var context = new SqliteNorthwindContext(_serviceProvider, _options); context.ChangeTracker.AutoDetectChangesEnabled = false; return(context); }
public MappingQuerySqliteFixture() { _serviceProvider = new ServiceCollection() .AddEntityFramework() .AddSqlite() .ServiceCollection() .AddInstance <ILoggerFactory>(new TestSqlLoggerFactory()) .BuildServiceProvider(); _testDatabase = SqliteNorthwindContext.GetSharedStore(); var optionsBuilder = new EntityOptionsBuilder().UseModel(CreateModel()); optionsBuilder.UseSqlite(_testDatabase.Connection.ConnectionString); _options = optionsBuilder.Options; }
public MappingQuerySqliteFixture() { var serviceProvider = new ServiceCollection() .AddEntityFrameworkSqlite() .AddSingleton <ILoggerFactory>(new TestSqlLoggerFactory()) .BuildServiceProvider(); _testDatabase = SqliteNorthwindContext.GetSharedStore(); _options = new DbContextOptionsBuilder() .UseModel(CreateModel()) .UseSqlite( _testDatabase.ConnectionString, b => b.SuppressForeignKeyEnforcement()) .UseInternalServiceProvider(serviceProvider) .Options; }
public NorthwindQuerySqliteFixture() { _testStore = SqliteNorthwindContext.GetSharedStore(); _serviceProvider = new ServiceCollection() .AddEntityFramework() .AddSqlite() .ServiceCollection() .AddSingleton(TestSqliteModelSource.GetFactory(OnModelCreating)) .AddInstance <ILoggerFactory>(new TestSqlLoggerFactory()) .BuildServiceProvider(); var optionsBuilder = new DbContextOptionsBuilder(); optionsBuilder.UseSqlite(_testStore.Connection.ConnectionString); _options = optionsBuilder.Options; _serviceProvider.GetRequiredService <ILoggerFactory>() .MinimumLevel = LogLevel.Debug; }