Showing posts with label Linq. Show all posts
Showing posts with label Linq. Show all posts

Sunday, February 1, 2015

Brief Introduction of Linq



Today I am going to explain a very good topic....Linq. So, First question is What is Linq. Linq is basically stand for Language-Integrated Query. Basically LINQ address the current database development model in the context of Object Oriented Programming Model. If you wants to develop database application on .Net most of us prefer to use ADO.Net. ADO.Net is working as middle ware in application and give us complete object oriented wrapper around the database SQL.

So Programmer must have good knowledge of object oriented programming concept as well as SQL to develop an application. But incase of Linq SQL statements are become part of the C# and VB.Net code so there are less chance of mistake.

Type of Linq


1.               Linq to Objects

When you use Linq to object than It gives you  the facility to query any kind of C# in-memory objects, like as lists, generic list arrays and other collection types.Linq to object query returns IEnumerable collection. It gives a approach to query collection with filtering, grouping and ordering with minimum code.

2.               Linq to Ado.Net

When you use Linq to Ado.Net, It has different flavors of Linq to query data from different databases like as Microsoft SQL Server, Oracle, and others. It has following flavours

2.1.               Linq to Sql

 It is designed to work with Sql Server database. It gives us run-time infrastructure for managing relational data as objects. Linq to Sql  also supports transactions, views and stored procedures etc. It is an object-relational mapping  framework that allow  us to create 1-1 mapping of Sql Server database to .net classes. In this  classes that match the database table are created automatically from the database.

2.2.               Linq to Dataset

It is an very easy and we can say a faster way to query data cached in the DataSet object. It also allow us Linq to query over any type of database  that can be query with Ado.Net.

2.3.               Linq to Entities

It basically use when you are using entity framework. It is very similar to Linq to Sql. It uses a conceptual Entity Data Model . The Ado.Net Entity Framework has improved in .NET framework 4.0/.NET framework 4.5 to query any type of database like Sql Server, DB2, Oracle, MySql, and many more.

3.               Linq to Xml

It is created for xml programming interface.  System.Xml.Linq namespace contains classes for Linq to Xml. When you use this you can query, modify xml document and also save document after modification.

4.               Parallel Linq (PLinq)

PLinq is introduced by Microsoft in  .Net framework 4.0. It extends the feature of Linq  to Objects with a new parallel programming library. when you use this, you  can break/split up a query to execute simultaneously/parallel on different processors.


If you like this post share it.. If you encounter any problems, feel free and

comment below to find solution. Share Your Experience with us.