Is there a convinient way of fetching a OData source into a System.Data.DataTable?
The most common use case of OData seems to be to let System.Data.Services.Client map OData entities to .NET objects, but this requires one to know the structures before run time, which I do not. My current workaround is to go low level and fetch the XML myself, loop over items in the DOM and put them into a new DataTable. I am looking for a higher level approach, if it exists.
Currently I don’t know of any such solution, the XML based reading is probably the best possible. We’re working on a library (ODataLib) which will allow you to read and write OData without strongly typed .NET objects.
A first CTP is part of this release: http://blogs.msdn.com/b/astoriateam/archive/2011/06/30/announcing-wcf-data-services-june-2011-ctp-for-net4-amp-sl4.aspx
It should be able to read JSON payloads (and write both JSON and ATOM).
Somewhat older source code drop is here: http://odata.codeplex.com/releases/view/60787 but it doesn’t have the readers implemented yet.