3. Introduction Alexandre Marreiros, 2011 Linq acronym for: Language Integrated Query It extends .NET to access Data in a easy and integrated way to CLI Languages. Almost anything can be a DataSource to Linq. Data Sources Linq .Net Framework WPF WCF WWF WPF .Net Framework
4. Introduction LINQ extends CLI languages with the power to querying data, directly. Avaiable to VB.net and C#. .NET Standard to query multiple data sources. Declarative style of programming. Support for multithread programming. Alexandre Marreiros, 2011
8. LINQ Principles Alexandre Marreiros, 2011 Integrated One of the main goals of LINQ is to integrate a flexible query sintax in to .NET languages. Querying data in .net can be confused and tricky theres an example: SqlConnection connection = new SqlConnection(connectionString); connection.Open(); System.Data.SqlClient.SqlCommand sqlCommand = new SqlCommand(); sqlCommand.Connection = connection; sqlCommand.CommandText = "Select * from Customer"; sqlCommand.ExecuteReader(CommandBehavior.CloseConnection);
9. LINQ Principles Alexandre Marreiros, 2011 Integrated LINQ offers a mutch more integrated mode and code cust effective. Querying in LINQ: Contacts DB = new Contacts(@c:ontacts.mdf); var query = from contact in DB.Contacts; select c;
10. LINQ Principles Alexandre Marreiros, 2011 Unitive Without LINQ a data driven programs will have in the same code a mix off different technologies Just LINQ Just # SQL C# And, OR XML Parsing C#
11. LINQ Principles Alexandre Marreiros, 2011 Extendable LINQ is a technologie based in providers. You Can extend LINQ Implementing new Providers. All providers are adressed with the same syntax.
12. LINQ Principles Alexandre Marreiros, 2011 Declarative varqueryNames = from realNamein names where realName != "" select realName; Focus in What You Want Not In How you do
16. Using Linq Use Linq to easy query datasources as databases, object collections, XML, Excel Files and others. Extend Linq to support aditional datasources. In database or business service Layers use Linq to reduce Complexity. Don´t throw away ADO.NET in data relational database think if he can be a best Aproach. Alexandre Marreiros, 2011
17. Commingnext NowthatwealreadyunderstandWhat´s LINQ inthenextpartwewillseehow to use thedifferent LINQ model’s. (LINQ to SQL, LINQ to XML, LINQ to Object,How to extend LINQ, LINQ to Sharepoint) Alexandre Marreiros, 2011
18. Alexandre Marreiros, 2011 References http://msdn.microsoft.com/en-us/netframework/aa904594Http://download.microsoft.com/download/4/7/0/4703eba2-78c4-4b09-8912-69f6c38d3a56/LINQ.wmvLinq in Action – Fabrice MargueirePro Linq Language integrated query 2010 in c# 2010 – Joseph C. RattzProgramming Microsoft ASP.NET 3.5 – Dino Esposito