Tuesday, 14 August 2012

LINQ - .Net Framework


  • Linq is uniform programming model which can interact with any kind of Data access like access,xml , SQL server, Oracle. 
  • Linq enables you to query and manipulate the data independently of data sources and any transformation. It is generalize interface which can query to any data source.
  •  Linq also provide type safety and any kind of data compile time checking.
  • It can serve as good entity for middle tier. So it is between UI and data access layer.
  • It provides declaratives syntax and enable developer to compile or provide what to do.
  • Hierarchical feature of LINQ allows you to easily see the relationship between tables, thereby making it easy to quickly compose queries that join multiple tables.
  • If you know Linq to object, it is easier to learn linq to SQL and Linq to XML
  • The composable feature of LINQ also makes it easy to break complex problems into a series of short, comprehensible queries that are easy to debug
  • Because LINQ is composable, you can easily join multiple data sources in a single query, or in a series of related queries
  • The compiler and provider translate declarative code into the code that is actually executed. As a rule, LINQ knows more than the average developer about how to write highly optimized, efficient code.

Entity Framework  - .Net Framework 4.5

Auto-Compiled LINQ Queries

When you write a LINQ to Entities query before .Net framework 4.5, the Entity Framework walks over the expression tree generated by the C#/Visual Basic compiler and translates (or compiles) that into SQL

Compiling the expression tree into SQL involves some overhead, though, particularly for more complex queries. In previous versions of the Entity Framework, if you wanted to avoid having to pay this performance penalty every time a LINQ query was executed, you had to use the CompiledQuery class.

This new version of the Entity Framework 4.5 supports a new feature called Auto-Compiled LINQ Queries. Now every LINQ to Entities query that you execute automatically gets compiled and placed in the Entity Framework query plan cache. Each additional time you run the query, the Entity Framework will find it in its query cache and won’t have to go through the whole compilation process again. 

No comments:

Post a Comment