1 / 11

LINQ ( Language-INtegrated Query )

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ść.

niran
Download Presentation

LINQ ( Language-INtegrated Query )

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. LINQ (Language-INtegratedQuery) Marcin Bohdziewicz s4070

  2. Architektura LINQ

  3. Zalety • Uniwersalność • Rozszerzalność • Poprawność kodu • Podniesienie poziomu abstrakcji

  4. Uniwersalność • LINQ to Objects • LINQ to SQL • LINQ to XML • LINQ to DataSets • LINQ to Entities

  5. Rozszerzalność • LINQ to Amazon • LINQ to Flickr • DbLinq: LINQ to MySQL, PostgreSQL, Oracle, Ingres, SQLite • LINQ to Google • LINQ to System Search • Etc.

  6. Poprawność kodu • SqlCommandcommand = new SqlCommand("SELEECT * FROM [dbo].[Tabela]”);

  7. Podniesienie poziomu abstrakcji • Różni dostawcy – różna składnia SqlConnectionsqlConnection =newSqlConnection(); MySqlConnectionmySqlConnection =newMySqlConnection(); SqlCommandsqlCommand = new SqlCommand("SELECT TOP 10 * FROM [dbo].[Tabela]"); MySqlCommandmySqlCommand = new MySqlCommand("SELECT * FROM TabelaLIMIT 10");

  8. Nowości w .NET 3.5 • Metody rozszerzające • Wyrażenia Lambda • Typy anonimowe

  9. Operatory • Select • Where • Sum • Join • Take • GroupBy • OrderBy • Etc.

  10. Zapytania i metody varresults = from w inwords wherew.Contains(„z”) select w; varresults = words.Where( w => w.Contains(„z”) ).Select( w => w );

  11. Porównanie: List<EmployeeDetails> employees=db.GetEmployees(); List<EmployeeDetails> matches = newList<EmployeeDetails> (); Foreach (EmployeeDetailsemployeeinemployees){ if( employee.LastName.StartsWith(„D”)){ matches.Add(employee); } } matches= fromemployeeinemployees whereemployee.LastNAme.StartsWith(„D”) selectemployee;

More Related