Is linq capable of using same querry on different type of data?
-
Hi guys, first I want to say that it's an excelent idea to have a different forum for linq and .NET 3.5 , good job codeproject :) Now to my question: First let me discribe the application I'm working on. Its purpose is to convert data from one format into another. Looks very simply, doesn't it ;) . However if we realize that it could be technicly anything to anything using different kind of source and destination (file, stream, database) and that the source and destination are specified via a single configuration file, then it becomes quite complex. The application design consists (very simplified) of 3 parts - reader, middle stage and a writer. The reader is capable of reading items from source, the writer writes items to the output and the middle stage is responsible of doing whatever processing is required. When I say processing, I mean selection and projection - agregating, sorting and ordering data. So there are few questions that need to be answered regarding the middle stage. 1) how is all the data (that is read by the reader) stored in the middle part, what will be the structure. 2) based on it's structure, how will be the data processed. Note that the User needs to be able to define the processing via another configuration file, that means using some kind language that needs to be parsed from the configuration file text. I have the answer to question 1: The data will be stored in 3 different ways - in memory, in a file or in a database. That also kind of determines the structure: 2D arrays (in other words tables for the databse, arrays for the memory and lines of data separated with some kind of sepator in file - or xml). I don't know yet whether there will be more tables in normalized form 3 or if we will use only one table that holds all the data, that's yet to decide, however it should not matter now. And what needs to be answered is question 2:
How do we do processing on this 3 different kinds of data types, so it is unified. Ideally, it would be SQL queries. And I was hoping that with help of Linq, I could run some king of SQL queries on any kind of data. And accoring to my investigation, that is not entirely true. I'm able to use the Select, Where, Order etc... extensions on IEnumerable but, for that, the configuration text would need to be parsed to call those methods explicitly. I would like to avoid defining and parsing a language simillar (if not same) to SQL.
Let me put a very very simplified example of how it works together: Input:<Pa