Pages

Monday, April 23, 2012

LINQ Overview

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 :
  1. All about searching efficiently and consistently
  2. Can be used with different data source. Does not need to know the underlying data source being queried from
  3. No longer matters where the data is coming from
4 basic patterns for LINQ :
  1. Linq to Object
  2. Linq to DataSet
  3. Linq to SQL
  4. 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 :

  • BinaryExpression
  • ConditionalExpression
  • ConstantExpression
  • InvocationExpression
  • LambdaExpression
  • ListInitExpression
  • MemberExpression
  • MemberInitExpression
  • MethodCallExpression
  • NewArrayExpression
  • NewExpression
  • ParameterExpression
  • TypeBinaryExpression
  • UnaryExpression
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 : 


System.Data.SqlClient namespace contains the classes used to create a basic connection with SQL Server. Although you might use this namespace in a number of scenarios, you'll generally use it exclusively with SQL Server.  http://msdn2.microsoft.com/en-us/library/system.data.linq.sqlclient.aspx


System.Xml.Linq 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

1 comment:

  1. Appropriate a great way of Being Introduced to this topic LINQ Overview material. It was great catching up is this? be grateful you gently for the conclusion,

    ReplyDelete