예제 #1
0
        public IDbConnection GetConnection(DbProtocol databaseProtocol)
        {
            var connectionString = databaseProtocol.GetConnectionString();

            Log.Debug(new string('+', 40));
            Log.Debug(connectionString);
            Log.Debug(new string('+', 40));

            if (databaseProtocol.DatabaseType == DatabaseType.Sqlite)
            {
                return(new SqliteConnection(connectionString));
            }

            if (databaseProtocol.DatabaseType == DatabaseType.MicrosoftSQL)
            {
                return(new System.Data.SqlClient.SqlConnection(connectionString));
            }

            if (databaseProtocol.DatabaseType == DatabaseType.MySQL)
            {
                return(new MySqlConnection(connectionString));
            }

            return(null);
        }
예제 #2
0
 public void should_GetConnectionString()
 {
     Assert.False(string.IsNullOrWhiteSpace(_iqcaredbProtocol.GetConnectionString()));
     Console.WriteLine(_iqcaredbProtocol);
 }