On October 23rd, 2014, we updated our
By continuing to use LinkedIn’s SlideShare service, you agree to the revised terms, so please take a few minutes to review them.
LINQ Architecture .NET Language Integrated Query C# 3.0 VB 9.0 Others… LINQ to Objects LINQ to SQL LINQ to XML LINQ to DataSets Objects <book> <title/> <author/> <year/> <price/> </book> XML Relational
Benefits of Using LINQ
May not need to build an entire DAL (data access layer)
Much easier to query XML – don’t have to use Xpath
Work with data in a consistent way – whether it is SQL Server data, XML data, ADO .Net dataset, an object collection, or data in memory
Offers compile time checking, autocompletion, and Intellisense
New C# Language Features that Support LINQ p902
Three Parts of a LINQ Query
Obtain the data source
Create the query
Execute the query
What’s a DataContext?
The DataContext is the source of all entities mapped over a database connection
It tracks changes that you made to all retrieved entities and maintains an "identity cache" that guarantees that entities retrieved more than one time are represented by using the same object instance.