I'm actually trying to understand more about LINQ and I find that LINQ is clever solution. What LINQ is trying to address is the conceptual and technical difficulties when using different data sources with .NET Programming language.Microsoft’s intention was to provide a solution for the problem of object-relational mapping, as well as to simplify the interaction between objects and data sources.
LINQ unifies data access, whatever the source of data, and allows mixing data from different kind of sources.
Before LINQ, we had to juggle different languages like SQL, XML, or XPath along with various technologies and APIs like ADO.NET or System.Xml in every application written using general-purpose languages such as C# or VB.NET. With LINQ, we can use a single language to query SQL, XML and other data sources without re-learning different techniques for drawing data from it's sources.
From my notes,
LINQ is :
- All about searching efficiently and consistently
- Can be used with different data source. Does not need to know the underlying data source being queried from
- No longer matters where the data is coming from
4 basic patterns for LINQ :
- Linq to Object
- Linq to DataSet
- Linq to SQL
- Linq to XML
Different Linq providers are shown here :
Note though that because LINQ exists, everything must go with it. LINQ has performance overhead, so be careful. Basic rule is that LINQ is used mostly on a little more complex lists.
LINQ Namespaces :
System.Linq namespace contains all basic classes and interfaces that you use to work with LINQ.
System.Linq.Expressions namespace contains the classes, interfaces, and enumerations used to create expressions. Expressions is essentially a tree of nodes that define how a query works. For example, you can create a binary expression that defines how to subtract one number from another. Essential expression types are :
System.Data.Linq namespace contains the classes, structures, interfaces, and enumerations used for SQL database interactions.
System.Data.Linq.Mapping namespace contains the classes and enumerations to map data between an imperative language such as C# or Visual Basic .NET and a declarative language such as SQL. It also comes into play when working with technologies such as XML. In short, you'll use this class when working with any external data source that has a different representation from the standard object-oriented view of data found in the .NET Framework. More about this in :
namespace contains classes and enumerations used to interact with XML data of all type. When you think about the number of ways in which modern computer systems use XML data, this namespace covers a significant amount of ground. http://msdn2.microsoft.com/en-us/library/system.xml.linq.aspx