public void Should_be_able_to_get_cfg()
        {
            var result = cfg.GetConnectionConfig("db1");

            Assert.That(result, Is.Not.Null);

            Assert.That(result.Name, Is.EqualTo("db1"));

            Assert.That(result.Provider, Is.Not.Null.Or.Empty);

            Assert.That(result.ConnectionString, Is.Not.Null.Or.Empty);
        }
Ejemplo n.º 2
0
        public DbConnection GetConnection(string name)
        {
            var dbConnectionConfig = _configurationService.GetConnectionConfig(name);

            var sqlConnection = new SqlConnection(dbConnectionConfig.ConnectionString);

            var dbConnection = new DbConnection(sqlConnection, dbConnectionConfig);

            sqlConnection.Open();

            return(dbConnection);
        }