views:

429

answers:

3

Like SQL, Linq is a great way to retrieve data from various sources, but to date I haven't heard anyone talking about the other elements that SQL provides, specifically update/insert/delete. The various DLinq providers all offer their own mechanisms, but it seems like at some point modification of a data source would become part of the language extension that LINQ represents. Has anyone seen any articles or discussions about this step in LINQ's evolution?

Much appreciated!

James

+1  A: 

I'm not sure what you're getting at, this is supported in LINQ to SQL.

Cade Roux
Yup, each specific LINQ provider offers its own version of how to update, insert, and delete. My question is why develop a "universal language" for reading and ten independent methods for writing. If SQL was "read only" and you had to go to a different lanuage/framwork to write, it probably wouldn't have survived this long.
A: 

Updates, insertions and deletions are generally a much easier problem than doing queries (essentially a find operation).

If you are referring to generic collections rather than databases, you make a method call like Insert or Add to add an item, and Delete or Remove to remove an item. To change an item, generally you just manipulate the item directly.

Robert Harvey
I agree that they are different problems to solve, but generally you use them together (find this object, change it's color to "red"). And since you can query data from various sources (databases, lists) in one common way, why not updating them also? Like, wouldn't this be nice:update myListOrXmlOrDataBaseset color = "red"where name = "tomato";
+2  A: 

Linq targets two interfaces, IEnumerable<T> and IQueryable<T>.

Think about how a delete operation would be performed against an IEnumerable<T>.

How do you delete things from Enumerable.Range(0, 5) ?

David B
You took the words out of my mouth. LinqToObjects cannot support mutable operations "by design".
Euro Micelli