0
私は複数のwcfClient(Web参照から設計されています)を持ち、それらはすべて独自のインターフェイスを実装しており、すべてが別のインターフェイスを継承します。WCFClientのキャスト(またはジェネリックコレクションを使用しますか?)
私は代わりに、これを行うための、すべてのWebサービスを継承していているインターフェイスからメソッドを呼び出したい...私は
switch (service)
{
case "DVSSync":
DVSSync.WcfDVSSyncClient dvsSyncClient = new DVSSync.WcfDVSSyncClient("BasicHttpBinding_IWcfDVSSync1");
GenericClient wcfClient = (GenericClient)dvsSyncClient;
break;
case "DataInserter":
DataInserter.WcfDataInserterClient dataInserterClient = new DataInserter.WcfDataInserterClient("BasicHttpBinding_IWcfDataInserter1");
GenericClient wcfClient = (GenericClient)dataInserterClient ;
break;
}
dataRow["URI"] = wcfClient.Endpoint.Address.ToString();
dataRow["ServiceUptime"] = wcfClient.ServiceUptime();
dataRow["Version"] = wcfClient.Version();
wcfClient.Close();
に似た何かをしたい
case "DVSSync":
DVSSync.WcfDVSSyncClient dvsSyncClient = new DVSSync.WcfDVSSyncClient("BasicHttpBinding_IWcfDVSSync1");
dataRow["URI"] = dvsSyncClient.Endpoint.Address.ToString();
dataRow["ServiceUptime"] = dvsSyncClient.ServiceUptime();
dataRow["Version"] = dvsSyncClient.Version();
dvsSyncClient.Close();
break;
case "DataInserter":
DataInserter.WcfDataInserterClient dataInserterClient = new DataInserter.WcfDataInserterClient("BasicHttpBinding_IWcfDataInserter1");
dataRow["URI"] = dataInserterClient.Endpoint.Address.ToString();
dataRow["ServiceUptime"] = dataInserterClient.ServiceUptime();
dataRow["Version"] = dataInserterClient.Version();
dataInserterClient.Close();
break;
ありがとう!