Introduction to LINQ - PowerPoint PPT Presentation

About This Presentation
Title:

Introduction to LINQ

Description:

LINQ to Entities DEMO Summary Had a quick intro on LINQ and its need Key Language features LINQ Architecture LINQ Types LINQ Operators For more information ... – PowerPoint PPT presentation

Number of Views:152
Avg rating:3.0/5.0
Slides: 20
Provided by: gmuthaiaF
Category:

less

Transcript and Presenter's Notes

Title: Introduction to LINQ


1
Introduction to LINQ
  • Ganesan Muthiah
  • http//gmuthaia.wordpress.com/
  • gmuthaia_at_live.com

2
Introduction
  • How do you interrogate/manipulate data?
  • What if you could do the work in a type-safe,"
    string-free manner?
  • What if you could use a consistent querying
    syntax for data, objects or XML?

3
Agenda
  • What is LINQ
  • Queries without LINQ
  • Key features of LINQ
  • LINQ Architecture
  • LINQ to

4
What is LINQ?
  • Language Integrated Query
  • Make query a part of the language
  • Component of .NET Framework 3.5

5
Queries without LINQ
6
Key Features of LINQ
  • Delayed Execution
  • LINQ queries don't execute until they must
  • Retrieve specific values
  • Iterate through the collection
  • Perform an operation
  • Write Data Access Code directly
  • Compile time syntax and schema checking
    (intellisense too)
  • no need of inline sql or to wait until runtime to
    see if it is ok
  • LINQ data access code abstracted from underlying
    data
  • consistent syntax across various data sources
  • can join information from different sources.

7
Architecture
8
LINQ to
  • LINQ to Objects
  • LINQ to SQL (formerly known as DLINQ)
  • LINQ to XML (formerly known as XLINQ)
  • LINQ to Entities (ADO.NET Entities)

9
LINQ to Objects
  • Query any IEnumerableltTgt sourceIncludes arrays,
    ListltTgt, Dictionary...
  • Many useful operators availableSum, Max, Min,
    Distinct, Intersect, Union
  • Expose your own data with IEnumerableltTgt or
    IQueryableltTgt
  • Create operators using extension methods

10
LINQ to Objects
  • DEMO

11
LINQ to SQL (formerly known as DLinq)
  • Object-relational mapping (ORM)
  • Records become strongly-typed objects.
  • Includes tracking of changed objects and
    persistence.
  • Ensures that you will not obtain multiple objects
    for the same underlying row in the database (
    Fowlers Identity Map)
  • Data context is the controller mechanism
  • Facilitates update, delete insert
  • Type, parameter and injection safe

12
LINQ to SQL
  • DEMO

13
LINQ to XML (formerly known as XLinq)
  • Similar to LINQ to SQL but along the idea of
    querying XML documents using LINQ syntax rather
    than the XPath/XQuery syntax.

14
LINQ to XML
  • DEMO

15
LINQ to Entities
  • LINQ to Entities (ADO.NET Entities)
  • A more advanced ORM solution that allows more
    extensive mapping and manipulation between how
    the object appears and the underlying data
    source.
  • LINQ to Entity provides
  • Excellent build support if it isn't mapped
    100, it won't build
  • It works with other databases (I'm currently
    using it with Oracle)
  • It properly seperates the structural model from
    the conceptual entity model.
  • It maps many to many relationships properly.

16
LINQ to Entities
  • DEMO

17
Summary
  • Had a quick intro on
  • LINQ and its need
  • Key Language features
  • LINQ Architecture
  • LINQ Types
  • LINQ Operators

18
For more information.
  • Official site
  • http//msdn.microsoft.com/en-us/netframework/aa904
    594.aspx
  • Tutorials
  • http//weblogs.asp.net/scottgu/archive/tags/LINQ/d
    efault.aspx
  • 101 LINQ Samples
  • http//msdn.microsoft.com/en-us/vcsharp/aa336746.a
    spx
  • LINQ Pad
  • http//www.linqpad.net/

19
  • Thank you
  • Questions?
Write a Comment
User Comments (0)
About PowerShow.com