Advantages of LINQ?

Rate It (1)

Last post 11-25-2009 3:17 AM by webaspdotnet. 16 replies.

Sort Posts:

  • Advantages of LINQ?

    03-22-2008, 8:55 AM
    May i know what are the main advantages using LINQ over SQL management studio?
    Any doubts please feel free to ask me.

    If this post is answer of your question then don't forgot to Click Mark As Answer.

    Thanks & Regards,
    J.Jeyaseelan
    Filed under:
  • Re: Advantages of LINQ?

    03-22-2008, 10:02 AM

    LINQ does not replace Sql Management Studio.  They have nothing to do with eachother.

     

    Regards Mike
    [MVP - ASP/ASP.NET]
    My site
    What ASP.NET can and can't do
  • Re: Advantages of LINQ?

    03-24-2008, 12:22 AM

    Thanks for your answer,

                                    then may i know what are the advantages of LINQ?

    Any doubts please feel free to ask me.

    If this post is answer of your question then don't forgot to Click Mark As Answer.

    Thanks & Regards,
    J.Jeyaseelan
  • Re: Advantages of LINQ?

    03-24-2008, 1:59 AM
    Answer

    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.

     

    Regards Mike
    [MVP - ASP/ASP.NET]
    My site
    What ASP.NET can and can't do
  • Re: Advantages of LINQ?

    03-25-2008, 6:24 AM

    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 ? 

    Any doubts please feel free to ask me.

    If this post is answer of your question then don't forgot to Click Mark As Answer.

    Thanks & Regards,
    J.Jeyaseelan
    Filed under:
  • Re: Advantages of LINQ?

    03-25-2008, 10:39 AM

    No it doesn't necessarily speed up operations.  It is part of ADO.NET according to this article: http://msdn2.microsoft.com/en-us/library/bb386944.aspx

     

    Regards Mike
    [MVP - ASP/ASP.NET]
    My site
    What ASP.NET can and can't do
  • Re: Advantages of LINQ?

    03-25-2008, 12:00 PM
    • Contributor
      6,537 point Contributor
    • bitmask
    • Member since 07-29-2003, 3:18 PM
    • Citizen of the Earth
    • Posts 1,228
    • TrustedFriends-MVPs

    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: http://www.odetocode.com/articles/737.aspx

    Hope that helps,

    Scott
    http://www.OdeToCode.com/blogs/scott/
  • Re: Advantages of LINQ?

    03-25-2008, 12:13 PM

    bitmask:
    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....

     

    Regards Mike
    [MVP - ASP/ASP.NET]
    My site
    What ASP.NET can and can't do
  • Re: Advantages of LINQ?

    04-18-2008, 6:56 AM
    Answer
    • Member
      14 point Member
    • kmughal
    • Member since 04-18-2008, 10:45 AM
    • Posts 2

    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.

     

  • Re: Advantages of LINQ?

    05-12-2008, 12:02 PM

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

    Ian Pettman
    Ava producers of leading Temp Agency Software
    Filed under: , ,
  • Re: Advantages of LINQ?

    08-04-2009, 5:51 PM
    • Member
      2 point Member
    • hafizsuleman
    • Member since 08-04-2009, 9:47 PM
    • Posts 1

    Hi Mike


    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.


    Pleaes explain.


    Thanks

  • Re: Advantages of LINQ?

    08-05-2009, 5:50 AM
    • Member
      64 point Member
    • Ian P
    • Member since 12-26-2002, 7:24 AM
    • Posts 21

    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.


    HTH


    Ian 

    Temp staffing Agency Software htp://www.ava.co.uk
  • Re: Advantages of LINQ?

    08-21-2009, 11:28 AM

     Thanks

  • Re: Advantages of LINQ?

    10-18-2009, 3:31 AM
    • Member
      4 point Member
    • abo
    • Member since 10-18-2009, 7:29 AM
    • The Netherlands
    • Posts 2

    Thanks for the post. I'm busy getting my MCPD Windows Forms and this post helps to understands the advantages of LINQ 

    Kind Regards,

    André
  • Re: Advantages of LINQ?

    10-18-2009, 3:31 AM
    • Member
      4 point Member
    • abo
    • Member since 10-18-2009, 7:29 AM
    • The Netherlands
    • Posts 2

    Thanks for the post. I'm busy getting my MCPD Windows Forms and this post helps to understands the advantages of LINQ. 

    Kind Regards,

    André
Page 1 of 2 (17 items) 1 2 Next >