How to deserialize object from OData Atom feed?

前端 未结 1 1549
鱼传尺愫
鱼传尺愫 2021-01-27 04:16

I am trying to parse response from an OData REST service. When response is in JSON format, it is easy to use ReadAsJsonDataContract method from WCF REST starter kit

相关标签:
1条回答
  • 2021-01-27 05:18

    WCF Data Services has a client which can be used to consume the responses and materialize CLR object from those. Take a look at the System.Data.Services.Client.DataServiceContext class and all related classes. In fact, in VS you can "Add Service Reference" to your OData services and it will generate client-side classes for the services as well as a derived class from the DataServiceContext for you to use. If you already have the client side classes you can use the DataServiceContext.Execute<T> method to issue any query and materialize its results into the client side types.

    0 讨论(0)
提交回复
热议问题