Beispiel #1
0
        public static EfCfDbConfiguration GetDbConfigurationByDatabaseTypeEnum(ConfigurationUtility.DbConfigurationDatabaseType dbConfigurationDatabaseTypeValue)
        {
            EfCfDbConfiguration dbConfiguration = null;

            switch (dbConfigurationDatabaseTypeValue)
            {
            case ConfigurationUtility.DbConfigurationDatabaseType.MsSqlServer:
                dbConfiguration = new MsSqlServerEfCfDbConfiguration();
                break;

            case ConfigurationUtility.DbConfigurationDatabaseType.MySql:
                dbConfiguration = new MySqlEfCfDbConfiguration();
                break;

            case ConfigurationUtility.DbConfigurationDatabaseType.MariaDb:
                dbConfiguration = new MySqlEfCfDbConfiguration();
                break;

            case ConfigurationUtility.DbConfigurationDatabaseType.Sqlite:
                dbConfiguration = new SqliteEfCfDbConfiguration();
                break;

            default:
                dbConfiguration = new MsSqlServerEfCfDbConfiguration();
                break;
            }

            return(dbConfiguration);
        }
Beispiel #2
0
        public static string GetConfigFileNameByDbConfigurationDatabaseType(ConfigurationUtility.DbConfigurationDatabaseType dbConfigurationDatabaseTypeValue)
        {
            var configFileName = string.Empty;

            switch (dbConfigurationDatabaseTypeValue)
            {
            case ConfigurationUtility.DbConfigurationDatabaseType.MsSqlServer:
                configFileName = Constants.DB_CONFIGURATION_DATABASE_TYPE_MSSQLSERVER_FILE_NAME;
                break;

            case ConfigurationUtility.DbConfigurationDatabaseType.MariaDb:
                configFileName = Constants.DB_CONFIGURATION_DATABASE_TYPE_MARIADB_FILE_NAME;
                break;

            case ConfigurationUtility.DbConfigurationDatabaseType.MySql:
                configFileName = Constants.DB_CONFIGURATION_DATABASE_TYPE_MYSQL_FILE_NAME;
                break;

            case ConfigurationUtility.DbConfigurationDatabaseType.Sqlite:
                configFileName = Constants.DB_CONFIGURATION_DATABASE_TYPE_SQLITE_FILE_NAME;
                break;
            }

            return(configFileName);
        }
        public static void ClassInit(TestContext testContext)
        {
            // Get and set config file here specific to the database type/provider (e.g. 'MS Sql Server', 'MySql', 'MariaDb', 'SQLite', etc.).

            try
            {
                const ConfigurationUtility.DbConfigurationDatabaseType dbConfigurationDatabaseTypeValue = ConfigurationUtility.DbConfigurationDatabaseType.Sqlite;

                var fullyQualifiedConfigFileName = UtilGeneral.GetFullyQualifiedConfigFileNameByDbConfigurationDatabaseType(dbConfigurationDatabaseTypeValue);

                AppConfig.Change(fullyQualifiedConfigFileName);
            }
            catch (Exception exception)
            {
                System.Diagnostics.Debug.WriteLine(exception.ToString());
            }
        }
Beispiel #4
0
        public static string GetFullyQualifiedConfigFileNameByDbConfigurationDatabaseType(ConfigurationUtility.DbConfigurationDatabaseType dbConfigurationDatabaseTypeValue)
        {
            var configBaseDirectory = AssemblyDirectory();

            var configFileName = GetConfigFileNameByDbConfigurationDatabaseType(dbConfigurationDatabaseTypeValue);

            var fullyQualifiedConfigFileName = Path.Combine(configBaseDirectory, configFileName);

            return(fullyQualifiedConfigFileName);
        }