开发者

is it possible to do dynamic queries with system.data.services.client

开发者 https://www.devze.com 2023-01-23 00:08 出处:网络
The normal way to setup a client is 开发者_如何学Pythonto generate a model by reading the odata metadata using VS UI or datasvcutil. Is there a way to do it without that step.

The normal way to setup a client is 开发者_如何学Pythonto generate a model by reading the odata metadata using VS UI or datasvcutil. Is there a way to do it without that step.

Why? Imagine trying to make a general purpose odata UI (thats not what I am doing but the same need would exist). I know that I can do raw HTTP/XML etc but that seems like a lot of heavy lifting; looking for a halfway house.


The client relies on CLR types to describe the shape of entities to consume. So if you need a general purpose client (which knows nothing about the shape of entities it's going to consume), then you would need to dynamically generate these types for each query (before you execute the query, which might be tricky). In short, the client is not built to support such scenario. You can take a look at OData Explorer, which is a Silverlight application and implements the general purpose client. (it does not use the WCF Data Services client due to the above restrictions). It's one of the samples on this page: http://www.odata.org/developers/odata-sdk. You can try it ou here: http://www.silverlight.net/content/samples/odataexplorer/

0

精彩评论

暂无评论...
验证码 换一张
取 消