private static IInstanceEngine GetInstanceEngine(DeputyBase databaseEngineVersion, string edition = "ex") { var databaseType = databaseEngineVersion.GetType(); if (databaseType == typeof(MysqlEngineVersion)) { return(DatabaseInstanceEngine.Mysql(new MySqlInstanceEngineProps { Version = databaseEngineVersion as MysqlEngineVersion })); } if (databaseType == typeof(PostgresEngineVersion)) { return(DatabaseInstanceEngine.Postgres(new PostgresInstanceEngineProps() { Version = databaseEngineVersion as PostgresEngineVersion })); } if (databaseType == typeof(MariaDbEngineVersion)) { return(DatabaseInstanceEngine.MariaDb(new MariaDbInstanceEngineProps() { Version = databaseEngineVersion as MariaDbEngineVersion })); } if (databaseType == typeof(SqlServerEngineVersion)) { return(edition switch { "ee" => DatabaseInstanceEngine.SqlServerEe(new SqlServerEeInstanceEngineProps() { Version = databaseEngineVersion as SqlServerEngineVersion }), "se" => DatabaseInstanceEngine.SqlServerSe(new SqlServerSeInstanceEngineProps() { Version = databaseEngineVersion as SqlServerEngineVersion }), "ex" => DatabaseInstanceEngine.SqlServerEx(new SqlServerExInstanceEngineProps() { Version = databaseEngineVersion as SqlServerEngineVersion }), "web" => DatabaseInstanceEngine.SqlServerWeb(new SqlServerWebInstanceEngineProps() { Version = databaseEngineVersion as SqlServerEngineVersion }), _ => throw new ArgumentException("The edition of the SQL Server is not recognized."), });
private IInstanceEngine GetInstanceEngine(DeputyBase databaseEngineVersion) { var databaseType = databaseEngineVersion.GetType(); if (databaseType == typeof(MysqlEngineVersion)) { return(DatabaseInstanceEngine.Mysql(new MySqlInstanceEngineProps { Version = databaseEngineVersion as MysqlEngineVersion })); } if (databaseType == typeof(PostgresEngineVersion)) { return(DatabaseInstanceEngine.Postgres(new PostgresInstanceEngineProps() { Version = databaseEngineVersion as PostgresEngineVersion })); } if (databaseType == typeof(MariaDbEngineVersion)) { return(DatabaseInstanceEngine.MariaDb(new MariaDbInstanceEngineProps() { Version = databaseEngineVersion as MariaDbEngineVersion })); } if (databaseType == typeof(SqlServerEngineVersion)) { return(DatabaseInstanceEngine.SqlServerEe(new SqlServerEeInstanceEngineProps() { Version = databaseEngineVersion as SqlServerEngineVersion })); } if (databaseType == typeof(OracleEngineVersion)) { return(DatabaseInstanceEngine.OracleEe(new OracleEeInstanceEngineProps() { Version = databaseEngineVersion as OracleEngineVersion })); } throw new ArgumentException("Not supported database option. Try: MysqlEngineVersion, PostgresEngineVersion, MariaDbEngineVersion, SqlServerEngineVersion and OracleEngineVersion"); }