UI の JavaScript で作成した抽象クラス「サーバー」があり、Web サービスに次のことを行うメソッドが必要です。
public List<Database> GetDatabases(Server server)
{
Type type = server.GetType();
Server x = null;
if (typeof (SqlServer2005Server).Equals(type))
{
x = new SqlServer2005Server();
}
// Return the Databases from the server
return x.GetDatabases();
}
私が抱えている問題は、サーバーが抽象的であるため、逆シリアル化できないことです。具象型から継承するサーバーごとにメソッドが必要ですか?
public List<Database> GetDatabases(SqlServer2005Server server)
{
// Return the Databases from the server
return SqlServer2005Serverx.GetDatabases();
}
public List<Database> GetDatabases(OracleServer server)
{
// Return the Databases from the server
return SqlServer2005Serverx.GetDatabases();
}
何が最善の解決策なのかわからないので、助けていただければ幸いです
私が受け取る正確なエラーは次のとおりです。
抽象クラスのインスタンスは作成できません。