いくつかの作業を行うために呼び出す必要がある 3 つの Web サービスがあります。それらはすべて、オブジェクト (異なるオブジェクト) を入力パラメーターとして受け入れ、オブジェクト (異なるオブジェクト) を出力パラメーターとして受け入れます。以下のデータベース表を参照してください。
CREATE TABLE WebServices (id int identity not null, webaddress varchar(50), classname varchar(30), inputParameter varchar(30), outputparameter varchar(30), function varchar(30))
INSERT INTO WebServices (classname, webaddress, inputparameter, outputparameter,function) values ('WebService1', 'http://localhost/webservice1.asmx', "object1", "object2", "function1")
INSERT INTO WebServices (classname, webaddress, inputparameter, outputparameter,function) values ('WebService2', 'http://localhost/webservice2.asmx', "object3", "object4", "function2")
INSERT INTO WebServices (classname, webaddress, inputparameter, outputparameter,function) values ('WebService3', 'http://localhost/webservice3.asmx', "object4", "object5", "function3")
コードでは、データベースの値からクラスを構築します。これは望ましい/可能ですか?反省すればできると思います。
または、通常の方法で 3 つの新しいクラスを作成し、次のようにファクトリを使用して適切なクラスを返します。
If id=1 then
return new WebService1
ElseIf id=2 then
return new webservice2
ElseIf id=3 then
return new webservice3
End If
私はさまよっていますが、どちらのオプションが優れていますか。