15 February 2007
LINQ versus DataSet ?
Today, someone asked on an internal mailing list, what does LINQ offer, than I cannot do with DataSet.Select()?
Luca Bolognese, my compadre from the old country, provided a clear and insightful response. Just for some background - LINQ is a codename for a set of extensions to the .NET Framework that encompass language-integrated query, set, and transform operations. Language-integrated query means, the query "verb" is built-in to the language itself. It is not a query library; it is integrated into the language. So you can do queries across in-memory graph of objects, as easily as you might send a query to a database to retrieve results. Here is Luca's response:
[DataSet.Select() and LINQ] are very different.
- The dataset is an in-memory relational representation of data, Select works against this in-memory representation.
- An object model is, well, an in-memory graph of objects. LINQ query works over this object view.
- Select takes a string as input, so it is not strongly typed; LINQ queries are strongly typed.
- LINQ queries work seamlessly across domains, you can submit the same query against in-memory objects, databases or, also, a dataset.
If you know at compile time the structure of your query and you are working with datasets, I suggest you investigate “LINQ to DataSet”.
By the way, here's the blog post he mentioned, LINQ-to-DataSet.
Comment Notification
If you would like to receive an email when updates are made to this post, please register here
Subscribe to this post's comments using
Comment Policy: No HTML allowed. URIs and line breaks are converted automatically. Your e–mail address will not show up on any public page.