Top Banner
By: Luis Carranco CIS764 - Fall 2008
9

By: Luis Carranco CIS764 - Fall 2008. What is LINQ Architecture How does it work? Samples/Demo Why to use LINQ? 2.

Jan 17, 2016

Download

Documents

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: By: Luis Carranco CIS764 - Fall 2008.  What is LINQ  Architecture  How does it work?  Samples/Demo  Why to use LINQ? 2.

By: Luis Carranco CIS764 - Fall 2008

Page 2: By: Luis Carranco CIS764 - Fall 2008.  What is LINQ  Architecture  How does it work?  Samples/Demo  Why to use LINQ? 2.

What is LINQ Architecture How does it work? Samples/Demo Why to use LINQ?

2

Page 3: By: Luis Carranco CIS764 - Fall 2008.  What is LINQ  Architecture  How does it work?  Samples/Demo  Why to use LINQ? 2.

Language Integrated Query for .NET C# 3.0, VB 9.0 Unifies the way data can be retrieved from

any object that implements the IEnumerable<T> interface.◦ Relational data◦ XML◦ Object collections

3

Page 4: By: Luis Carranco CIS764 - Fall 2008.  What is LINQ  Architecture  How does it work?  Samples/Demo  Why to use LINQ? 2.

44Image taken from LINQ for Visual C# 2008. Fabio Ferracchiati

Page 5: By: Luis Carranco CIS764 - Fall 2008.  What is LINQ  Architecture  How does it work?  Samples/Demo  Why to use LINQ? 2.

5

LINQ to SQLLINQ to SQL

from c in db.Customerswhere c.City == "London"select c.CompanyName

from c in db.Customerswhere c.City == "London"select c.CompanyName

ExecuteExecute(Iteration)(Iteration)

SELECT CompanyNameFROM CustomerWHERE City = 'London'

SELECT CompanyNameFROM CustomerWHERE City = 'London'

SQL QuerySQL Query RowsRows

ObjectsObjects

db.Customers.Add(c1);c2.City = “Seattle";db.Customers.Remove(c3);

db.Customers.Add(c1);c2.City = “Seattle";db.Customers.Remove(c3);

SubmitChanges()SubmitChanges()

INSERT INTO Customer …UPDATE Customer …DELETE FROM Customer …

INSERT INTO Customer …UPDATE Customer …DELETE FROM Customer …

DML DML

Page 6: By: Luis Carranco CIS764 - Fall 2008.  What is LINQ  Architecture  How does it work?  Samples/Demo  Why to use LINQ? 2.

6

Page 7: By: Luis Carranco CIS764 - Fall 2008.  What is LINQ  Architecture  How does it work?  Samples/Demo  Why to use LINQ? 2.

Only one syntax to retrieve data from any data source

Productivity. Focus on business Compiler checks queries and type safety Avoid SQL, XPath Rich set of instructions to implement

complex queries that support data aggregation, joins, sorting, and much more

7

Page 8: By: Luis Carranco CIS764 - Fall 2008.  What is LINQ  Architecture  How does it work?  Samples/Demo  Why to use LINQ? 2.

The LINQ Project http://msdn.microsoft.com/en-us/netframework/aa904594.aspxAccessed 11/16/2008

LINQ for Visual C# 2008. Fabio Claudio Ferracchiati. 1st Edition. Apress.

Programming Microsoft LINQ. Paolo Pialors, Marco Russo. MSPress.

8

Page 9: By: Luis Carranco CIS764 - Fall 2008.  What is LINQ  Architecture  How does it work?  Samples/Demo  Why to use LINQ? 2.

9