Exemple #1
0
        public void SqlClientDriver_works()
        {
            var driver = new SqlClientDriver();
            var cnn    = driver.CreateConnection($"Server=127.0.0.1;Database=master;User Id={_fixture.MsSql.DbUser};Password={_fixture.MsSql.DbPwd};");

            cnn.Open();

            Assert.True(cnn.State == ConnectionState.Open);
        }
Exemple #2
0
        public void SqlClientDriver_works()
        {
            var driver = new SqlClientDriver();
            var cnn    = driver.CreateConnection($"Server=127.0.0.1;Database=master;User Id=sa;Password={TestContext.DbPassword};");

            cnn.Open();

            Assert.True(cnn.State == ConnectionState.Open);
        }
Exemple #3
0
        public DbSessionFactory CreateSessionFactory(string connectionString)
        {
            string dbType = ConfigurationManager.AppSettings["dbtype"];

            IDriver driver = null;

            switch (dbType.ToLower())
            {
            case "oledb":
                driver = new OleDbDriver();
                break;

            case "sqlclient":
                driver = new SqlClientDriver();
                break;
            }

            if (driver == null)
            {
                throw new ConfigurationErrorsException("No valid driver found for dbtype = " + dbType);
            }

            return(new DbSessionFactory(driver, connectionString));
        }