90 likes | 379 Views
MS LINQ. By: Luis Carranco CIS764 - Fall 2008. Content. What is LINQ Architecture How does it work? Samples/Demo Why to use LINQ?. What is LINQ?. Language Integrated Query for .NET C# 3.0, VB 9.0
E N D
MSLINQ By: Luis Carranco CIS764 - Fall 2008
Content • What is LINQ • Architecture • How does it work? • Samples/Demo • Why to use LINQ?
What is LINQ? • 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
Architecture 4 Image taken from LINQ for Visual C# 2008. Fabio Ferracchiati
db.Customers.Add(c1); c2.City = “Seattle"; db.Customers.Remove(c3); from c in db.Customers where c.City == "London" select c.CompanyName Execute(Iteration) Objects SubmitChanges() SQL Query Rows DML How it works SQL Server INSERT INTO Customer … UPDATE Customer …DELETE FROM Customer … SELECT CompanyName FROM Customer WHERE City = 'London' Application LINQ to SQL
Why to use LINQ? • 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
Resources • The LINQ Projecthttp://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.