PDA

Click to See Complete Forum and Search --> : Question on LINQ


timeshifter
Dec 12th, 2007, 06:05 PM
I've been curious about this from the first time I saw it, but never really liked the idea... maybe I just didn't see enough of it to fully understand why it is now in existence.

First, from what I've seen, it looks more than anything like a way to write database transaction commands inline with the VB code. Is this its' primary role? I can understand why the hobby programmer would like that, but as an ASP.NET developer with a SQL backend, I write all my database transactions in stored procedures in SQL itself, for the speed and for how clean it makes the code. This leaves me little motivation to use LINQ.

Second, why is the order of directives being thrown around? Every database system that I've worked with has had a similar syntax, some less similar than others, but they all have the same order of directives. Why does LINQ rearrange that?

funkyonex
Dec 12th, 2007, 07:40 PM
Hi timeshifter,

LINQ is not specific to just querying relational data (like T-SQL or FoxPro), you can query ANY object collection in the .NET framework. You can also use LINQ to query XML (as well as DataSets and SQL server). It's not limited to flat result sets either, it can project object heirarchies as well. LINQ is a much broader set of query operations than what were used to and it's a large subject. Here are some short How-to videos to help get you started: http://msdn2.microsoft.com/en-us/vbasic/bb466226.aspx?wt.slv=topsectionsee#linq

HTH,
-B

Paul M
Dec 12th, 2007, 10:00 PM
Man that "How Do I" video series is excellent :)

Nice video to Beth! (#1 Video in VB Section)

Merrion
Dec 13th, 2007, 05:00 AM
Second, why is the order of directives being thrown around? Every database system that I've worked with has had a similar syntax, some less similar than others, but they all have the same order of directives. Why does LINQ rearrange that?

For the second bit the reason is to do with intellisense and compiler determinism...

when you type:
SELECT A.

There is no way to know what list of fields to drop down because we don't know what A is until you type the FROM part.

This is also why so few database editors have intellisense like operations