Showing posts with label LinQ. Show all posts
Showing posts with label LinQ. Show all posts

Wednesday, August 19, 2009

Dynamic LINQ

Linq Example :

var query = from g in db.Goan_Classifications
orderby g.Goan_Classification_Name
select g;

Dynamic Linq Example :

var query = db.Goan_Classifications.OrderBy("Goan_Classification_Name");

So it makes more easy.But the thing is that we need to use the system.Linq.Dymaic class,Which makes the development more easy.

Read More

Saturday, August 15, 2009

Linq to Sql Debug Visualizer

Probably the biggest programming model improvement being made in .NET 3.5 is the work being done to make querying data a first class programming concept. We call this overall querying programming model "LINQ", which stands for .NET Language Integrated Query.Read More

Thursday, July 2, 2009

Linq(Language integrated Query) Part 1

LinQ
LinQ is tightly coupled to C# and VB

Imperative Programming language: Programmers want to describe the statement(C# and VB)

Declartive Programming language : In the case of SQL,the engine determines the physical strategy to retrive the logical request made in the form of a query.

Most mordern language supports RDBMS in their code,like Xml .But nothing was type safe.Microsoft solution is LinQ ,a type safe query.
Note : LinQ can be coded in Lambda syntax(Anonymous code blocks from functional programming Community ) and comprehension syntax.

Lambda Syntax : Normally takes => as expression.
How linq makes development Easy

Example 1 : without using LinQ

void NameContainsA()
{
List cell = new List ();

string[] Names = new string[]{
"Anish"
,"Varghese"
,"Linq"
,"Anish Varghese"};

for(int iCount=0; iCount<>
{
if(Names [iCount].StartsWith("A"))
{
cell.Add(Names[i]);
}
}

Example 2 : With LinQ

void NameContainsA()
{
List cell = new List ();

string[] Names = new string[]{
"Anish"
,"Varghese"
,"Linq"
,"Anish Varghese"};

cell = (from n in Names where n.StartsWith("A") select n).ToList();
}

Note : this makes the development very easy.

Example 3 : With Linq (above same example with less number of codes)

void NameContainsA()
{
List cell = new List ();

string[] Names = new string[]{
"Anish"
,"Varghese"
,"Linq"
,"Anish Varghese"};

cell = Names.Where(x => x.StartsWith("A")).ToList();
}


 
Counter