LINQ

1.What is LINQ ?
LINQ stands for language integrated query. Its a part of .Net 3.5 framework.It provides quering capabilities in .Net languages.it intergrates databse model into programming model.logic can be used to retrieve data with sql like statements in C#.

2.What are diff area in which LINQ can be used ?
LINQ is divided into 3 categories --
a)linq to objects--this includes mainly quering collections which implemet IEnumerable interface.
b)linq to ADO.NET
  •  linq to SQL
  •  linq to DataSet
  •  linq to Entities(ORM model)
c)linq to XML 

3.When not to use LINQ ? 
a)It should not be used in C# if the same logic is achieved by simple c# coding. 
b)linq to sql involves performance overhead hence should be used efficiently.

4.Use LINQ to query the numbers greater than 5 from a collection of array.int[] nums = new int[] {0,4,2,6,3,8,3,1};
var result = from n in nums
             where n > 5
             orderby n             //orders in asc order
             select n;

5. What is ORM ?

it stands for object relational mapping wherein it provides the user with the ability to change and manipulate the objects without having to worry about how the objects are related to their datasource.


 

5 comments:

  1. Today at least I came to know what is LINQ. Thanks for blogging and spending your valuable time teaching others :)

    - Pavan

    ReplyDelete
  2. Nice post and looking for more question and answers post it as soon as
    http://DotnetProgrammer.com/LINQ-and-AJAX

    ReplyDelete