Last post Aug 05, 2009 05:50 AM by Ian P
Mar 22, 2008 08:55 AMfirstname.lastname@example.org|LINK
Mar 22, 2008 10:02 AM|Mikesdotnetting|LINK
LINQ does not replace Sql Management Studio. They have nothing to do with eachother.
Mar 24, 2008 12:22 AMemail@example.com|LINK
Thanks for your answer,
then may i know what are the advantages of LINQ?
Mar 24, 2008 01:59 AM|Mikesdotnetting|LINK
It allows you to query collections like arrays, enumerable classes etc in the native language of your application, like VB or C# in much the same way as you would query a database using SQL. LINQ to SQL, which is what most of the current fuss is about, is
an Object/Relational Mapper (O/RM) built in to Visual Studio. It automatically generates entity classes based on the database schema, so it helps speed up development of n-layer arhitecture applications.
Mar 25, 2008 06:24 AMfirstname.lastname@example.org|LINK
Thanks for your answer ,
Finaly have one more question
Is LINQ speed up the database operation compared than sqlclient(Sqlconnection,SqlCommand etc.,) ?
If yes then tell me the difference in Seconds / Minutes ?
LINQ is came under Ado.Net or separately ?
linq speed up
Mar 25, 2008 10:39 AM|Mikesdotnetting|LINK
No it doesn't necessarily speed up operations. It is part of ADO.NET according to this article:
Mar 25, 2008 12:00 PM|bitmask|LINK
As Mike said, LINQ to SQL is not nessecarily going to speed up data access code. Since LINQ to SQL is abstraction over the low level ADO.NET command and connection classes, it's bound to be a bit slower at runtime (but hopefully faster to develop with).
There is more to LINQ than just database work, too. I have an intro article on LINQ here:
Hope that helps,
Mar 25, 2008 12:13 PM|Mikesdotnetting|LINK
it's bound to be a bit slower at runtime
Before jeyaseelan asks, it's probably worth pointing out that the difference would be in milliseconds, not seconds or minutes....
Apr 18, 2008 06:56 AM|kmughal|LINK
one reason is might be that extracting data from sql users have to perform lot of operation to organize the data but in LINQ all the operations are supported bec you are writing the database extraction query in the same language.
May 12, 2008 12:02 PM|ex glider pilot|LINK
It seems to m that the main advantage of Linq over writing a stored procedure in management studio is the hard typing of tables and parameters and auto completion of column names. The amount of code to connect to the database is significantly reduced - to
one or two lines making code much more readable and removing coding errors. A major disadvantage seem to be that in the current release the declarative order of the columns is not maintained int the query output:
In simple terms if (In SQL Structured Query Language) I declare
SELECT Zulu, Uniform, Xray FROM MyTable
The results are in column order Zulu, Uniform, Xray
In simple terms if (In LINQ Language Integrated Query I declare
FROM MyTable SELECT Zulu, Uniform, Xray
The results are in column order X, Y , Z
This is (to me) nonsensical. Actually the way around seems to be to not auto generate columns, and cut the aspx - which largely eliminated the advantages of using linq in the first place....
Aug 04, 2009 05:51 PM|hafizsuleman|LINK
as you told " Linkq allows you to query collections like arrays, enumerable classes etc in the native language of your application, like VB or C# in much the same way as you would query a database using SQL."
so what is advantage of to query to arrays, enumerable etc in that way ?
Why not i use the old style ?
Is there any advantage over there ?
I can access collection by Index , so why should I use Linq.
Aug 05, 2009 05:50 AM|Ian P|LINK
There are a few points here:
1. You get automcomplete on the (column / field names) and an error if you mistype or mismatch - your code is much more robust.
2. Say you access your code via a stored procedure (to apply filtering, groupling, join etc) and you (or someone edits) your stored procedure, to add a (returned) column which happens to be the 3rd column of 7: then that will break your code which refers
to ordinal position. Actually if you got to the spec for SQL, you will find that ordinal position on a table may not be maintained, where as column name is guaranteed.
3. Now that the ordinal position problem in the VB implimentation is fixed (ms actually appologised and fixed it after I raised it with them see my earlier post) you can happly manipulate to you hearts content.
4. It quicker to code once you start doing more cool things. For example say you have a list of items and somewhere else on you page you want to display counts, sums or other agregate functions. Eg A list of shifts and a summary to the top: There are 17
shifts, the total time worked is 105 hours, the average per week is 28.5 hours, then list the shifts below. You can do mutiple queries (and round trips to the database: very expensive in terms of display time and scalability) or use linq to return the collection
(one round trip), display it and do the sums.