Great video! Amazing being able to run these queries on generics, databases, or even XML! This will be so useful. Its such a more natural way of thinking about selecting and sorting your data. Seems so much powerful as well. I must admit that the inverted
SQL style language is somewhat odd at first, but by the end of the video it just seems so natural.

OMG. That hits the mark in sooo many ways. The power of this is mind blowing. Anders (et al) rocks. Hats off to C9 also. You promised this last time and you did it! It amazing to think of the work that went on between then and now to get those bits
ready. Anders must have been further along then he let on last time.

BTW, what was the "var" class (i.e. "var q = new...")? I expect the Monad folks wish they had this a year ago. I suppose they must shred this into their code now for all the object query stuff they do.

Now all anyone has to do is implement an LINQ Object Provider (LOP) around their data and Bingo, instant user query access.

In the video, at about 7 mins 50 seconds into it, Anders was talking about Language INtegrated Query, and he was explaining to the audience where “Where” and “Select” came from, “because an array doesn't have a select or a where guy” and that C# 3.0 implements
a new thingy known as extension methods, which is the “ability to extend an existing type with new methods”.

Sounds like he's talking about Delphi's class helpers concept. You can take the man out of Borland, but you can't take Borland out of him... ;o)

Class helpers or extension methods have been available in the Delphi language since Delphi 8 came onto the scene nearly 2 years ago.

And the "var" thingy? Is he sneaking parts of the Delphi language into C# 3.0? ;o)

I was sitting through the video thinking to myself that "this is cool", "that is cool", "Wonder where this will fit in my n-tier apps".. My mind was in a box and did not realize the full power until the "String Method" example, then it was like "Duh,
this is for all data not just typical database data, but about any data you have to work with in a program!". That was the absolute knock out punch!

Very cool! Even those words simple rather wimpy, this has solved one of the major shortcomings in the langugage as to dealing with data regardless of type. Big, huge, gigantic leap for .NET!

By itself, this is impressive, but combine this with WinFS and Web service classes... yeeow, the possibilities are staggering! No wonder they're so excited about this.

One quibble - when Anders was talking about the reason why the "from" clause had to be first, it made a lot of sense, but then I went to the VB 9.0 whitepaper and saw this:

Dim SmallCountries = Select Country _ From Country In Countries _ Where Country.Population < 1000000For Each Country As Country In SmallCountries Console.WriteLine(Country.Name)Next

The VB.NET syntax for LINQ looks more like SQL than the C# syntax. However, Anders' point about the C# syntax being better for XML querying still holds and is demonstrated by this VB.NET 9 snippet later in the whitepaper:

There's a lot of XML cruft before you get to the "from" and "where" of your LINQ code. It's easy to imagine how nasty it could get with a more complicated XML document. The C# syntax clumps all the LINQ syntax at the beginning and leaves the XML cruft for
the end.

Also, in the NorthWind example is LINQ doing a full table scan every time? Or does it take advantage of existing indexes? But you're not duplicating the SQL Server engine inside the CLR ... are you?

That was, having calmed down a bit, pretty much exactly what I was going to ask.

SQL Server has been developed over a long time and is very very good at doing things like getting the two records out of 100 million that you want very quickly. I hope DLinq takes advantage of this - I mean, does it as Minh asks do a full scan of the table
or does it parse your DLinq query in to T-SQL?

Could someone say ORM at least once. These ideas weren't generated out of the blue. Yes there are some neat things here but a lot of it resembles very closely what I use Ruby for everyday + some type checking.I find it slightly disturbing how this is presented and everyones comments here. There are interesting comparaisons to be made. There is a technological context.

This is VERY different than ORM. Typically with ORM you define a class and then map that to the database. And then you have some routines that can pull the data ouf of the DB into instances of that class. This here is completely different. Yes, it doesn use
classes to define the mapping between the DB and the CLR type system, but you will hardly ever use instances of those classes. What you rather do is use the rich projection system to e.g. construct anonymous types on which you will then run your business logic.
VERY, VERY different from any ORM approach I know about.

daniel wrote:

Yes there are some neat things here but a lot of it resembles very closely what I use Ruby for everyday + some type checking.I find it slightly disturbing how this is presented and everyones comments here. There are interesting comparaisons to be made. There is a technological context.

Yes, everything feels very familiar, BUT have a closer look. This is NOT just introducing some of the ruby etc stuff into C#. That too, but look at the database integration for example, that is just completely new ground. They use a lot of the constructs that
are around in languages like ruby, but they use them for completely new things.

Also, in the NorthWind example is LINQ doing a full table scan every time? Or does it take advantage of existing indexes? But you're not duplicating the SQL Server engine inside the CLR ... are you?

Don't worry. When you query a database via LINQ, the query expression that you construct in C# is translated into the corresponding SQL query and executed against the database. The whole thing does NOT first pull all rows from the DB into memory to do the filtering
on that! Download the preview and read the overview document. It is absolutely amazing how they did that from a technical point of view!

I think, the answer is how do they implement the IEnumerable<T> interface. It's possible to open the SQL query within the GetEnumerator() implementation, then it can build the correct and exact sql query which returns the requested result only from the server.
So, if you don't enumerate on a LINQ construct whatever is that, you don't contact with the sql server. A rude sample:

This is not quite 'VERY VERY VERY' different. It's using lambda functions like Anders does in the same context for the same purpose. No need to define classes. Don't get me wrong what Anders is doing is great. It has graceful syntax too. It's just a great evolution
not an earth shattering revolution.

This is not quite 'VERY VERY VERY' different. It's using lambda functions like Anders does in the same context for the same purpose. No need to define classes. Don't get me wrong what Anders is doing is great. It has graceful syntax too. It's just a great
evolution not an earth shattering revolution.

You are right and I was wrong. I didn't know that things like that existed, I was only thinking about the typical ORM available for .Net.

Is at least the fact that all of this is done with strong typing something new?

Will LINQ support querying something besides IEnumerable in the future? How would I tell LINQ to query a Binary Space Partition? (requiring LINQ to know about the data container)

You can implement the LINQ pattern (your custom implementation of the LINQ standard query operators like from, where, select, etc) for your own data domain.

Also, in the NorthWind example is LINQ doing a full table scan every time? Or does it take advantage of existing indexes? But you're not duplicating the SQL Server engine inside the CLR ... are you?

When querying against Northwind, you are using DLinq, which is an implementation of the LINQ pattern for databases. What DLinq does is translate a LINQ query into a SQL statement, send it to the database and convert the results back into strongly typed
objects for you. It uses deferred execution which basically means you don't have to pay a price until the last possible time form an execution standpointl. We'll be posting more information on how execution works soon.

This is not quite 'VERY VERY VERY' different. It's using lambda functions like Anders does in the same context for the same purpose. No need to define classes. Don't get me wrong what Anders is doing is great. It has graceful syntax too. It's just a great
evolution not an earth shattering revolution.

In my opinion, the biggest change is that we're abstracting out the data store, meaning you can program against objects, relational data, and XML using a
single, unified programming model. For example, you could use the VSTO (Visual Studio Tools for Office) API's and write a LINQ sample to query your email, like find all emails where:1) the subject contains "LINQ" 2) sent in the last month 3) that were marked "urgent".

The Ruby libraries on the other hand are specifically for relational data. As an
astute C9'er pointed out earlier, you can even imagine implementations of the LINQ pattern for Active Directory or WinFS where you can reuse the same syntax (from, where, select) without having to understand each domain. With the LINQ Project, you have
one programming model across all domains. IMO, that's huge

very cool - I love seeing how everything, both technology (.NET framwork, generics, SQL Server, WPF, etc) and ideas (power of a virtual machine + garbage collection; having a DML as a 1st class citizen in your language like xBase; having a standard way
of querying across different data sources like odbc was designed to do; "ORMesque-ness", vector graphics, ...) is just coming together/evolving/building on top of each other to build something out of this world - way to go guys!

In any one particular space, Microsoft has some really good competitors (eg. Flash is great for vector graphics today, PDF is the ubiquitious standard for transferring documents, java is a productive language for writing server side code), but its the sum of
your parts (especially when you bring them together) that puts the MS platform well out in front (in my mind at least).

I should probably just read the documentation, but will LINQ be able to join data from 2 seperate data sources - eg. SELECT a.customer, b.product_photo FROM <sql data source> a JOIN <xml data source> b? ON (a.productid = b.productid)?

Thanks for the video...it was very interesting and I wish you guys would put up more videos from Anders. I am somewhere in the middle on the LINQ phenomenon, however, and again I keep going back to my old comment:

Why now? Why not a few years ago? Were there performance issues? The underlying technology has certainly been there for a while. Or was it an internal structuring/organizational issue? I can see reasons for both. Conceptually, however, only some of
this is "radical".

Dan wrote:

In my opinion, the biggest change is that we're abstracting out the data store, meaning you can program against objects, relational data, and XML using a single, unified programming model. For example, you could use the VSTO (Visual Studio Tools for Office)
API's and write a LINQ sample to query your email, like find all emails where:1) the subject contains "LINQ" 2) sent in the last month 3) that were marked "urgent".

Yes, this is big leap forward, and I'm all for it. I started using a bit of C# last month, and I am toying with the idea of building a language parser with it. However, relational databases have their limits, too, although the model has generally carried
the industry a long, long ways.

This is great, I can't wait to use it. I noticed that the VB.NET syntax is more similar to a standard SQL SELECT statement. I understand the reason why in C# is arranged differently, but I really wish they would go the extra mile and tweak the C# compiler.

Cool! So what I'm seeing is, C# finally has a Variant data type? Nice to see they're catching up to VB 6.0. LOL

Just kidding. I did hear the words "strongly typed" used repeatedly.

But it's interesting to see the productivity people had with the older VB (where you did not have to worry about data types) combined with the
robustness of C# (where you do have to worry about data types) -- but now it's the compiler that does the worrying for you.

That in itself is going to be a huge win. All those null vs. dbnull vs. empty string bugs... GONE.

The fact that it's universal... wow. Now maybe when I code against Outlook I can stop messing with collections and enumerators and retrieve the items I want in 5 lines of code instead of 50... using the same syntax I use to query databases...

How does one construct a dynamic where clause in LINQ?... Select clause?

I'd like to know that as well!

Very exciting stuff, although I can't help thinking about LISP a little...

Aside, is there any way that we can get a clearer video of what's on the demonstrator's monitor? Half the time I can't make out what's being typed. (Sorry if this has already been covered a thousand times over; I have been gone from #9 for a while...)

What does this development mean for existing ADO.NET classes like Adapters and DataReaders?Are they becomming absolete or is there still a specific use for them?In other words, will LINQ give you as much control as those classes do?

The DataSet always seemed to me like te ideal place to put relational data, because of it flexibility and genericity, but in my mind was troubled by large memory use and inability to extend it.Will LINQ bring the same flexibility to ordinary objects and will there still be a use for the DataSet (in this or in a changed form)?

"Is at least the fact that all of this is done with strong typing something new?"

This depends. XQuery and SQL both provide for both static and strong typing on declarative expressions. However, the integration into the programming language type system is well-done (and thus could be considered "novel").

I consider this an historic moment. The only negative bit is waiting for broad acceptance. When it goes pop, let's hope it won't suffer the fate of being called "AJAX" and credited to non-Microsoft entities. Let's not have LINQ become the DHTML of the
OOP world.

You can construct the queries dynamically, though its not as simple yet as I'd like it. You would typically do this if your app offers some constrained way for the user to select different search options. Imagine a realestate website that lets you pick
different search criteria. That app would need to formulate the query dynamically. You can do this either by repeatedly & conditionally applying different 'where' conditions to the query or by constructing a predicate expression tree by hand. You can also
construct a projection expression, however you are currently limited to constructing only actual CLR types known at runtime, so in order to create a true dynamic projection you will need a dynamically generated type. The Espresso sample has such a type. Something
like this will likely be folded into the actual LINQ library. (no pun intended.)

He is the best.. Awesome video, I can't wait to throw out my O/R mapper of choice.. I would be curious how the developers of NHibernate feel now.. NH 1.0 has just been released but has no support of C# 2.0, such as generics and man, I've grown grey hair
using NH.. LINQ is the way to go.

Could someone say ORM at least once. These ideas weren't generated out of the blue. Yes there are some neat things here but a lot of it resembles very closely what I use Ruby for everyday + some type checking.I find it slightly disturbing how this is presented and everyones comments here. There are interesting comparaisons to be made. There is a technological context.

He did say in the video that there was a technological context and that this was not unprecedented stuff. Did you watch/listen to the whole vid?

what is this guy saying? I am new here, and begginner in C#,To me its like chinese,

WHat the heck is IEnumerable of T for some T mean?

Can you put it in simple english for me?

Its just a generics thing. Look up "generics" and ".Net 2.0" and you should find some stuff. Just basically saying that it implements the IEnumerable interface for type "<Any Type>", or type "<T>" as it is commonly referred to. Generics is some pretty neat
stuff.

This looks like the wheel being reinvented, and badly at that. This has all been done nearly 20 years ago with Clipper and since with Foxpro, Visual Objects, Flagship, Recital, xBase++ and others and being resurected with xHarbour and Clip. Navigating
Data of any type with Replaceable Data Drivers, BLOB Stroage and indexers that can query any type of data stored in ISAM, CSV, SQL, XML and even binary data, arrays and objects.

In the overview document I could not find any references to how to define a primary key for a given relation when querying over a list of objects stored in, say, ArrayList? Or does the query perform a linear search?

Are there plans to support implicit parallelism for executing queries?

With strongly typed databases there has always been a challenge responding to the changes to the data schema. How do the new language extensions address changes to existing object schema? For example, if the layout of a class that is being queried has been
changed, what is going to happen? Am I going to get a compile exception or a runtime exception when attempting to execute a query?

Typically, when quering over millions of records it would not be desirable to load the entire contents into memory. The question is if it is a requirement for the entire searchable contents to be loaded into memory before querying the data?

Could someone say ORM at least once. These ideas weren't generated out of the blue.

I agree, I watched the video too. We offer an architecture for .NET 2.0 called
EntitySpaces that is strongly typed, spoon feeds you via intellisense, has nullable types, and so on, it also offers natural language queries that run without recompilation on many DBMS systems with more on the way, for example, here's a dynamic query:

Our NUnit tests run against Microsoft SQL, Access, Oracle, and MySQL, same exact code, same exact binaries, only a different connection string. LINQ is cool, but sometimes I think folks at Microsoft think it's only real or invented if they do it ....

LINQ is cool, but sometimes I think folks at Microsoft think it's only real or invented if they do it ....

And a lot of people seem to think their solution is already the best. Your syntax looks quite a deal different from LINQ. When companies pour developer time into a language or even just a construct, its usually not just to get the basic idea coded up, but to
also come up with a good "syntactic logic". As it was explained in the video, SQL has been done for a long time as "SELECT * FROM TABLE etc". They turned that around and worked in a different direction.

To Top it the ADO.NET Entity Framework and the EDM models will just rock the world. The distance between the Data Access Layer and the real database will be negligible or transparent so to speak. Real excited!

I was sitting through the video thinking to myself that "this is cool", "that is cool", "Wonder where this will fit in my n-tier apps"..

Actually with N-tier apps do not have a need for ADO.NET and it should be hitting the classes anyways.

They are just wrapping reflection around the queries. Which is what many world class tier apps already do. It's just easier now.

Hell I havent even seen someone use a DataSet in a year or 2 now. And if they do I call them a noob. ( jokingly of course. Its actually peoples flavor ) Usually people who shift to true OOP go with classes only, which is all ADO.NET is anyways.

SQL Server has been developed over a long time and is very very good at doing things like getting the two records out of 100 million that you want very quickly. I hope DLinq takes advantage of this - I mean, does it as Minh asks do a full scan of the table
or does it parse your DLinq query in to T-SQL?

Object databases have been developed for the last 5 years and a few are .net open source projects. Some already handle indexing.

Great video and information about Linq. Does anyone know if we will be able to use this type of language in Web Service calls. Would be great improvement. Will there ever be a wizard for creating web service calls?

﻿Great video and information about Linq. Does anyone know if we will be able to use this type of language in Web Service calls. Would be great improvement.
Will there ever be a wizard for creating web service calls?

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>?

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.

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.

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.

Remove this comment

Remove this thread

Comments Closed

Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation,
please create a new thread in our Forums, or
Contact Us and let us know.