Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Minor improvements.
  • Loading branch information
fiseni committed Aug 6, 2023
commit cdac95b99dde2745b443c7127ee8d307319de1c8
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public DatabaseFixture()
using (var localDB = new SqlLocalDbApi())
{
ConnectionString = localDB.IsLocalDBInstalled()
? $"Data Source=(localdb)\\MSSQLLocalDB;Initial Catalog={databaseName};Integrated Security=SSPI;"
? $"Data Source=(localdb)\\MSSQLLocalDB;Initial Catalog={databaseName};Integrated Security=SSPI;MultipleActiveResultSets=True;Connection Timeout=300"
: $"Data Source=databaseEF;Initial Catalog={databaseName};PersistSecurityInfo=True;User ID=sa;Password=P@ssW0rd!;";
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ public EFRepositoryFactoryTests(DatabaseFixture fixture)
_dbContextOptions = fixture.DbContextOptions;

_serviceProvider = new ServiceCollection()
.AddDbContextFactory<TestDbContext>((builder => builder.UseSqlServer(fixture.ConnectionString)),
ServiceLifetime.Transient).BuildServiceProvider();
.AddDbContextFactory<TestDbContext>((builder => builder.UseSqlServer(fixture.ConnectionString)), ServiceLifetime.Transient)
.BuildServiceProvider();

_contextFactory = _serviceProvider.GetService<IDbContextFactory<TestDbContext>>();
_repositoryFactory = new EFRepositoryFactory<IRepositoryBase<Company>, Repository<Company>, TestDbContext>(_contextFactory);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ public DatabaseFixture()
using (var localDB = new SqlLocalDbApi())
{
ConnectionString = localDB.IsLocalDBInstalled()
? $"Data Source=(localdb)\\MSSQLLocalDB;Initial Catalog={databaseName};Integrated Security=SSPI;Encrypt=False;TrustServerCertificate=True;"
? $"Data Source=(localdb)\\MSSQLLocalDB;Initial Catalog={databaseName};Integrated Security=SSPI;MultipleActiveResultSets=True;Connection Timeout=300;Encrypt=False;TrustServerCertificate=True;"
: $"Data Source=databaseEF;Initial Catalog={databaseName};PersistSecurityInfo=True;User ID=sa;Password=P@ssW0rd!;Encrypt=False;TrustServerCertificate=True;";
}

Console.WriteLine($"Connection string: {ConnectionString}");

DbContextOptions = new DbContextOptionsBuilder<TestDbContext>()
.UseSqlServer(ConnectionString)
.UseSqlServer(ConnectionString, x => x.EnableRetryOnFailure())
.EnableSensitiveDataLogging()
.Options;

Expand Down