Posted By: scobleizer | Sep 13th, 2005 @ 11:27 AM | 339,930 Views | 89 Comments
LINQ stands for Language INtegrated Query and in a nutshell, it makes query and set operations, like SQL statements first class citizens in .NET languages like C# and VB.

Here we visit Anders Hejlsberg in his office to get more on LINQ. Dan Fernandez, also seen in this video, just put up a blog post about LINQ.
Media Downloads:
Rating:
2
0
qrt
qrt
I like the way LINQ is implemented. But I find myself searching for some rather common data related funtionality though.

LINQ obviously abstracts the act of retrieving data away and allows for a declarativ programming style.

But almost any application also needs to update existing and insert new persisted data in databases.

I guess that developers for now still need to interact directly with ADO.NET? Are there any researches going on in the field of declarativly adding/updating data, for example as extension methods on Collection<T> and Table<T>?
(side note)
>>    sqlStmt += " CITY = '" + txtCity.Text + "' "; // London ; )

I really hope you are protecting your database more than this in reality and this was just for the simplicity of the example. A user could do SQL injection if they wanted very easily. While it's more popular to do SQL injection in web apps, it can happen in Win apps as well.

--

The LINQ stuff is really great, the comments about performing joins across multiple sources is intriguing. I could select email from outlook, have it join where the from address matches values in ActiveDirectory for a specific group... so you could pull out all emails from administrators, for a simple example.

The danger I see, however, is that it could be very easily abused and not completely understood so that some very slow queries would be written.

In the above example, I'd imagine that since the two pieces of results are coming from different sources (one from AD and one from your email source) that each would be returned and joined in memory. That means that I may have 1000 emails and only one of them is from an admin but all 1000 emails are returned before the joining can occur. The compiler wouldn't know that the list of admins is small enough to execute it first and pass it in as a param to the email engine so that it would only return that one email.

When first watching, I had the thought "ok, now so many things are so much simpler that it allows amateurs to do what normally required a professional" maybe now the differentiator will be that I will understand enough of how it is all working that my code will designed to run significantly faster. Smiley

It's all great stuff. I love that through the type inferencing and dynamically generated classes, it has the ease of non-typed languages (Ruby) without losing the performance and benefits of strong typing.
qrt wrote:
LINQ obviously abstracts the act of retrieving data away and allows for a declarativ programming style.

But almost any application also needs to update existing and insert new persisted data in databases.


LINQ for SQL (previously called DLINQ) will hook up to property changed events of the objects that are retrieved using LINQ for SQL.

They will then track any changes you do to the objects, and when you instruct the DataContext to submit the changes back it will do so intelligently, i.e. topological sort so that deletes, inserts and updates are performed in valid sequence.
This is Awesome , this is small part of my dream i always have, it nice to see my dream slowly started coming in reality and hope other parts of my dream comes true eventually.

I remeber six months back i was talking to friend on the objects and implementation and i mentioned that it will be awesome to have SQL like queries for various operations inside managed code... and now i am glad to hear that i can see that kind of implementation in .NET soon.

Its really a great future to have. 
Linq is great ....

I heard that this feature is not available in Java....True?


It would be nice to see more demonstrations of Table join examples.

I've written several opject dumping utils over the years, is there anyway we could get a copy of yours it looks like a keeper Cool

fackpersone
fackpersone
usman

It's interesting that you should have brought it up. I've been doing some research and what you have mention does work, to a certain extend.

 

 

classified ads | job search | article directory

fackpersone
fackpersone
usman

It's an interesting insight to a very complicated topic. I am glad that you brought it up. Thanks for the great article.

 

 

classified ads | job search | article directory

Microsoft Communities