LINQ ( Language-INtegrated Query )

Download LINQ ( Language-INtegrated Query )

Post on 06-Feb-2016

68 views

Category:

Documents

0 download

Embed Size (px)

DESCRIPTION

LINQ ( Language-INtegrated Query ). Marcin Bohdziewicz s4070. Architektura LINQ. Zalety. Uniwersalno Rozszerzalno Poprawno kodu Podniesienie poziomu abstrakcji. Uniwersalno. LINQ to Objects LINQ to SQL LINQ to XML LINQ to DataSets LINQ to Entities. Rozszerzalno. - PowerPoint PPT Presentation

TRANSCRIPT

LINQ (Language-INtegrated Query)

LINQ (Language-INtegrated Query)Marcin Bohdziewicz s4070Architektura LINQ

ZaletyUniwersalnoRozszerzalnoPoprawno koduPodniesienie poziomu abstrakcjiUniwersalnoLINQ to ObjectsLINQ to SQLLINQ to XMLLINQ to DataSetsLINQ to EntitiesRozszerzalnoLINQ to AmazonLINQ to FlickrDbLinq: LINQ to MySQL, PostgreSQL, Oracle, Ingres, SQLiteLINQ to GoogleLINQ to System SearchEtc.Poprawno koduSqlCommand command = new SqlCommand("SELEECT * FROM [dbo].[Tabela]);

Podniesienie poziomu abstrakcjiRni dostawcy rna skadnia

SqlConnection sqlConnection = new SqlConnection();

MySqlConnection mySqlConnection = new MySqlConnection();

SqlCommand sqlCommand = new SqlCommand("SELECT TOP 10 * FROM [dbo].[Tabela]");

MySqlCommand mySqlCommand = new MySqlCommand("SELECT * FROM Tabela LIMIT 10");

Nowoci w .NET 3.5Metody rozszerzajceWyraenia LambdaTypy anonimoweOperatorySelectWhereSumJoinTakeGroupByOrderByEtc.Zapytania i metodyvar results = from w in wordswhere w.Contains(z)select w;

var results = words.Where( w => w.Contains(z) ).Select( w => w );Porwnanie:List employees = db.GetEmployees();

List matches = new List ();Foreach (EmployeeDetails employee in employees){if ( employee.LastName.StartsWith(D)){matches.Add(employee);}}

matches = from employee in employeeswhere employee.LastNAme.StartsWith(D)select employee;

Recommended

View more >