by: luis carranco cis764 - fall 2008. what is linq architecture how does it work? samples/demo ...
TRANSCRIPT
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
44Image taken from LINQ for Visual C# 2008. Fabio Ferracchiati
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
6
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
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
9