public CurrencyService(IConnectionStringFactory connectionStringFactory) { this.connectionString = connectionStringFactory.Create(); }
public RemindRequestService(IConnectionStringFactory connectionStringFactory) { this.connectionString = connectionStringFactory.Create(); }
public void Configure(DbContextOptionsBuilder dbContextOptionsBuilder, DatabaseConnectionConfiguration configuration) { var connectionString = _connectionStringFactory.Create(configuration); dbContextOptionsBuilder.UseSqlite(connectionString); }
private IDbConnection CreateDbConnection(DatabaseConnectionParameters connectionParameters) { string connectionString = _connectionStringFactory.Create(connectionParameters); return(_databaseConnectionFactory.CreateDatabaseConnection(connectionString, connectionParameters.DatabaseType)); }
/// <summary> /// Creates a database connection object /// </summary> /// <returns>Sql Database Connection</returns> public DbConnection Create() { var connectionString = connectionStringFactory.Create(); return(new SqlConnection(connectionString)); }
public void ShouldCreateConnectionStringFromConfigurationFile() { // Arrange DatabaseConnectionParameters fromFileParameters = new DatabaseConnectionParameters { ConfigurationFileName = "TestConfig.config", CreationType = ConnectionStringCreationType .FromConfigurationFile }; // Act string connectionString = _connectionStringFactory.Create(fromFileParameters); // Assert Assert.That(connectionString, Is.EqualTo("Data Source=.;Initial Catalog=testdb;User ID=xx;Password=xxxx")); }
public void Configure(DbContextOptionsBuilder dbContextOptionsBuilder, DatabaseConnectionConfiguration configuration) { var connectionString = _connectionStringFactory.Create(configuration); dbContextOptionsBuilder.UseMySql(connectionString, ServerVersion.AutoDetect(connectionString)); }