public CurrencyService(IConnectionStringFactory connectionStringFactory)
 {
     this.connectionString = connectionStringFactory.Create();
 }
 public RemindRequestService(IConnectionStringFactory connectionStringFactory)
 {
     this.connectionString = connectionStringFactory.Create();
 }
Exemple #3
0
        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));
        }
Exemple #5
0
        /// <summary>
        /// Creates a database connection object
        /// </summary>
        /// <returns>Sql Database Connection</returns>
        public DbConnection Create()
        {
            var connectionString = connectionStringFactory.Create();

            return(new SqlConnection(connectionString));
        }
Exemple #6
0
        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));
        }