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 ?
LINQ-to-SQL functions well as a light-weight ORM via the DMBL designer. It has built-in language support and makes it pretty easy to access your entities using standard access patterns. I use it in all of my new projects and find that it is a significant improvement for me in simplicity and testability. There is a lot more info at this post.
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 you're question is really When to use LINQ to SQL I'll just address that.
LINQ to SQL is a best used when you:
- Are only ever targetting MS SQL 2000+
- Doing RAD
I've used LINQ to SQL on a couple of commerical products and quite a few of my own products. I find 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:
- Bart De Smet - advanced
- Charlie Calvert
- Wriju
This is a fair question but has been asked many times already. See these earlier questions for a more in depth and broader coverage:
LINQ is some kind of universal query language. If you learn it you don't have to limit yourself to the database but you can also use it to manipulate XML files, or JSON files or arrays, Lists<> and dictionairies<,> . It's great.
There is even LinqToFlickr, LinqToExcel and LinqToGoogle. It is much more than an OR mapper. See: http://blogs.msdn.com/charlie/archive/2008/02/28/link-to-everything-a-list-of-linq-providers.aspx