Running an existing LINQ query against a dynamic object (DataTable like)

Posted by TomTom on Stack Overflow See other posts from Stack Overflow or by TomTom
Published on 2010-03-22T08:59:01Z Indexed on 2010/03/22 9:01 UTC
Read the original article Hit count: 293

Filed under:
|
|
|

Hello,

I am working on a generic OData provider to go against a custom data provider that we have here. Thsi is fully dynamic in that I query the data provider for the table it knows. I have a basic storage structure in place so far based on the OData sample code.

My problem is: OData supports queries and expects me to hand in an IQueryable implementation. On the lowe rside, I dont have any query support. Not a joke - the provider returns tables and the WHERE clause is not supported. Performance is not an issue here - the tables are small. It is ok to sort them in the OData provider.

My main problem is this.

  • I submit a SQL statement to get out the data of a table. The result is some sort of ADO.NET data reader here.
  • I need to expose an IQueryable implementation for this data to potentially allow later filtering.

Any ide ahow to best touch that? .NET 3.5 only (no 4.0 planned for some time). I was seriously thinking of creating dynamic DTO classes for every table (emitting bytecode) so I can use standard LINQ. Right now I am using a dictionary per entry (not too efficient) but I see no real way to filter / sort based on them.

© Stack Overflow or respective owner

Related posts about LINQ

Related posts about OData