Alex Rivera | Logout

Why and When to use LINQ?

Asked 2008-12-04T05:06:49.853
13

i have never used LINQ in any of my projects , i have always used ado.net /OR tool in my Business App projects , so i want to know What are the benefits of LINQ ? why and when anybody should use LINQ ?

Edit
Report

1 Answer

12

Just to clarify there are differences between the concept of LINQ and LINQ to SQL.

LINQ is a query syntax, not a language or an O/RM. You can build an O/RM on top of the syntax provided by LINQ.

Since I gather that your question is really When to use LINQ to SQL I'll just address that.

LINQ to SQL is best used when you are:

  • Only ever targeting MS SQL 2000+
  • Doing RAD

I've used LINQ to SQL on a couple of commercial products and quite a few of my own products and found these benefits:

  • Familiar language to code in (C#/ VB.NET)
  • Easier to maintain (we have more .NET than SQL gurus on staff)
  • SQL generated is well structured and very optimal
  • Allows direct translation of business rules to SQL while still keeping all business logic in a single project

As for LINQ as a concept I use it all the time, because I understand what it can/can't do and how to use it properly. Like any language feature it can be miss-used easily if people don't have an understanding of what it is and how to use it. I recommend the following blogs to get some of the concepts of LINQ down:

answered 2008-12-04T05:23:54.720

Your Answer