RESTサーバーに使用されるインターフェイスを含む同じDLLを参照するサーバー/クライアントアプリケーションがあり、WebChannelFactory
がWebサーバーを参照する場合、サーバーインターフェイスが取得し、更新しますか?たとえば、アプリケーションのバージョン1は、次のインターフェイスで押し出されます言う:WebChannelFactoryに使用されるインターフェイスの変更
[ServiceContract]
public interface ISampleInterface
{
[OperationContract]
[WebInvoke(UriTemplate = "/PutDevice", ResponseFormat = WebMessageFormat.Xml, RequestFormat = WebMessageFormat.Xml)]
void PutDevice(Device device);
}
[DataContract(Namespace = "")]
public class Device
{
[DataMember]
public Guid id { get; set; }
[DataMember]
public string Name { get; set; }
[DataMember]
public string Description { get; set; }
} // End of Device
これは、RESTサービスは、契約として使用し、エージェントは次のようなコードを持っているだろうかです:
WebChannelFactory<ISampleInterface> client = new WebChannelFactory<IGridVisionService>(new Uri(targetHost));
ISampleInterface sampleInterface = client.CreateChannel();
sampleInterface.PutDevice(new Device() { id = Guid.Empty(), Name = "Test Device", Description = "Test Device Description" });
クライアントアプリケーションはすでに何百台ものコンピュータに導入されていますが、クライアントがドメインに送信するバージョンについても認識しています。
[DataContract(Namespace = "")]
public class Device
{
[DataMember]
public Guid id { get; set; }
[DataMember]
public string Name { get; set; }
[DataMember]
public string Domain { get; set; }
[DataMember]
public string Description { get; set; }
} // End of Device
サーバーを簡単に更新できますが、ドメインについて知らないエージェントがたくさんいます。この状況に対処する適切な方法は何ですか?私の唯一の考えは、DataContractを使わず、手動で解析できるXElement
を使用することでした。次に、不足しているドメインのケースを扱うために、サーバーにログインを追加します。私が見落としているよりよい解決策がありますか?