SlideShare une entreprise Scribd logo
1  sur  32
Language Integrated Query (LINQ) Nguyen Minh Dao [email_address]
Introduction ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Agenda ,[object Object],[object Object],[object Object],[object Object],[object Object]
2006 2007 2008 .NET Framework - VS Roadmap ,[object Object],3.0 RTM 3.5 RTM ,[object Object],[object Object],ASP.NET AJAX 1.0 SQL Server 2008  ADO.NET Entity Framework ,[object Object],[object Object]
What is the .NET Framework 3.5? .NET Framework 2.0  + SP1 Windows Presentation Foundation Windows Communication Foundation Windows Workflow Foundation  Windows CardSpace .NET Framework 3.0 + SP1 .NET Framework 3.5 LINQ ASP.NET  3.5 CLR Add-in  Framework Additional Enhancements
Multi-targeting in Visual Studio 2008
Compiler Features ,[object Object],VB9 XML Literals Relaxed Delegates C# 3.0 Extension Methods Object Initialisers Anonymous Types Local Type Inference Lambda expressions Collection Initializers Partial Methods Automatic Properties If Ternary Operator Nullable Syntax Lambda statements
Language Innovations var contacts = from c in customers where c.City == "Hove" select new { c.Name, c.Phone }; var contacts = customers .Where(c => c.City == "Hove") .Select(c => new { c.Name, c.Phone }); Extension methods Lambda expressions Query expressions Object initializers Anonymous types Local variable type inference
Extension methods ,[object Object],[object Object],[object Object],string  name =  “Bart” ; string  reversed = name.Reverse(); static class  MyExtensions  {   public static string  Reverse( this string  s) {   char [] c = s.ToCharArray();   Array .Reverse(c);   return new string (c);   } } Promoted first parameter string  name =  “Bart” ; string  reversed =  MyExtensions .Reverse(name); static class  MyExtensions  {   public static string  Reverse( string  s) {   char [] c = s.ToCharArray();   Array .Reverse(c);   return new string (c);   } }
Automatic properties ,[object Object],[object Object],class  Customer  {   private string  _name;     public string  Name   {   get  {  return  _name; };   set  { _name =  value ; };   } } class  Customer  {   public string  Name {  get ;  set ; } } Setter required; can be private or internal
Object initializers ,[object Object],[object Object],[object Object],class  Customer  {   public string  Name {  get ;  set ; }   public int  Age {  get ;  set ; } } Customer   c =  new  Customer (); c.Name =  “Bart” ; c.Age = 24; var  c =  new  Customer (){ Name =  “Bart” , Age = 24}; Can be combined with any constructor call
Collection initializers ,[object Object],int [] ints =  new int [] { 1, 2, 3 }; List < int > lst =  new   List < int >(); lst.Add(1); lst.Add(2); lst.Add(3); int [] ints =  new int [] { 1, 2, 3 }; var  lst =  new   List < int >() { 1, 2, 3 }; Works for any ICollection class by calling its Add method
Anonymous types ,[object Object],[object Object],[object Object],[object Object],var  person =  new  { Name =  “Bart” , Age = 24 }; var  customer =  new  { Id = id, person.Name };
Lambda expressions ,[object Object],delegate  R  BinOp <A,B,R>(A a, B b);  int  Calc( BinOp < int ,  int ,  int > f,  int  a,  int  b) {   return  f(a, b) } int  result = Calc(   delegate  ( int  a,  int  b) {  return  a + b; },   1, 2); var  result = Calc((a, b) => a + b, 1, 2); Parameter types inferred based on the target delegate
Demo  Anonymous types, automatic properties, collection initializers, extension methods
First, A Taste of LINQ using  System; using  System.Query; using  System.Collections.Generic;   class   app  { static void  Main() { string [] names = { &quot;Burke&quot;, &quot;Connor&quot;,    &quot;Frank&quot;, &quot;Everett&quot;,      &quot;Albert&quot;, &quot;George&quot;,  &quot;Harris&quot;, &quot;David&quot; };   var  expr =  from  s  in  names  where  s.Length == 5 orderby  s select  s.ToUpper();   foreach  ( string  item  in  expr) Console .WriteLine(item); } } BURKE DAVID FRANK
Query Expressions ,[object Object],[object Object],from  itemName  in  srcExpr join  itemName  in  srcExpr  on  keyExpr  equals  keyExpr  (into  itemName )? let  itemName  =  selExpr where  predExpr orderby ( keyExpr  (ascending | descending)?)* select  selExpr group  selExpr  by  keyExpr   into  itemName query-body
LINQ  Architecture LINQ-enabled data sources LINQ  To Objects LINQ  To XML LINQ-enabled ADO.NET Visual Basic Others LINQ  To Entities LINQ  To SQL LINQ  To Datasets .Net Language Integrated Query (LINQ) Visual C# Objects Databases
LINQ  Architecture LINQ-enabled data sources LINQ  To Objects LINQ  To XML LINQ-enabled ADO.NET Visual Basic Others LINQ  To Entities LINQ  To SQL LINQ  To Datasets .Net Language Integrated Query (LINQ) Visual C# Objects Databases
LINQ to Objects ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],using  System; using  System.Query; using  System.Collections.Generic;   class   app  { static void  Main() { string [] names = { &quot;Burke&quot;, &quot;Connor&quot;,    &quot;Frank&quot;, &quot;Everett&quot;,      &quot;Albert&quot;, &quot;George&quot;,  &quot;Harris&quot;, &quot;David&quot; };    Func < string ,  bool > filter = s => s.Length == 5; Func < string ,  string > extract = s => s; Func < string ,  string > project = s = s.ToUpper();   IEnumerable < string > expr = names .Where(filter)  .OrderBy(extract) .Select(project);   foreach  ( string  item  in  expr) Console .WriteLine(item); } } BURKE DAVID FRANK using  System; using  System.Query; using  System.Collections.Generic;   class   app  { static void  Main() { string [] names = { &quot;Allen&quot;, &quot;Arthur&quot;,    &quot;Bennett&quot; };   IEnumerable < string > ayes = names .Where(s => s[0] == 'A');   foreach  ( string  item  in  ayes)  Console .WriteLine(item);   names[0] = &quot;Bob&quot;;   foreach  ( string  item  in  ayes)  Console .WriteLine(item); } } Arthur using  System; using  System.Query; using  System.Collections.Generic;   class   app  { static void  Main() { string [] names = { &quot;Allen&quot;, &quot;Arthur&quot;,    &quot;Bennett&quot; };   IEnumerable < string > ayes = names .Where(s => s[0] == 'A');   foreach  ( string  item  in  ayes)  Console .WriteLine(item);   names[0] = &quot;Bob&quot;;   foreach  ( string  item  in  ayes)  Console .WriteLine(item); } } Allen Arthur using  System; using  System.Query; using  System.Collections.Generic;   class   app  { static void  Main() { string [] names = { &quot;Burke&quot;, &quot;Connor&quot;,    &quot;Frank&quot;, &quot;Everett&quot;,      &quot;Albert&quot;, &quot;George&quot;,  &quot;Harris&quot;, &quot;David&quot; };   IEnumerable < string > expr =  from  s  in  names  where  s.Length == 5 orderby  s select  s.ToUpper();   foreach  ( string  item  in  expr) Console .WriteLine(item); } } BURKE DAVID FRANK
LINQ  Architecture LINQ-enabled data sources LINQ  To Objects LINQ  To XML LINQ-enabled ADO.NET Visual Basic Others LINQ  To Entities LINQ  To SQL LINQ  To Datasets .Net Language Integrated Query (LINQ) Visual C# Objects Databases
LINQ to SQL Overview
LINQ to SQL Architecture Enumerate SQL Query or SProc Rows Objects SubmitChanges() DML  or SProcs Application LINQ to SQL from c in db.Customers where c.City == &quot;London&quot; select c.CompanyName SELECT CompanyName FROM Customer WHERE City = 'London' db.Customers.Add(c1); c2.City = “Seattle&quot;; db.Customers.Remove(c3); INSERT INTO Customer … UPDATE Customer … DELETE FROM Customer …
LINQ to SQL ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
LINQ to DataSet ,[object Object],[object Object],[object Object],[object Object],[object Object]
Demo   LINQ to Objects LINQ to SQL
LINQ  Architecture LINQ-enabled data sources LINQ  To Objects LINQ  To XML LINQ-enabled ADO.NET Visual Basic Others LINQ  To Entities LINQ  To SQL LINQ  To Datasets .Net Language Integrated Query (LINQ) Visual C# Objects Databases
LINQ to XML ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Demo   LINQ to  XML
That’s LINQ ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
MSDN in the UK ,[object Object],[object Object],[object Object],[object Object],[object Object]
THANK YOU

Contenu connexe

Tendances

Báo cáo đồ án môn công nghệ phần mềm
Báo cáo đồ án môn công nghệ phần mềmBáo cáo đồ án môn công nghệ phần mềm
Báo cáo đồ án môn công nghệ phần mềm
RiTa15
 
Cơ sở dữ liệu đại học
Cơ sở dữ liệu đại họcCơ sở dữ liệu đại học
Cơ sở dữ liệu đại học
Chu TheKop
 
Bai tap va loi giai sql
Bai tap va loi giai sqlBai tap va loi giai sql
Bai tap va loi giai sql
. .
 

Tendances (20)

Báo cáo đồ án môn công nghệ phần mềm
Báo cáo đồ án môn công nghệ phần mềmBáo cáo đồ án môn công nghệ phần mềm
Báo cáo đồ án môn công nghệ phần mềm
 
13690151 slide-phan-tich-thiet-ke-he-thong-huong-doi-tuong-dai-hoc-bach-khoa-...
13690151 slide-phan-tich-thiet-ke-he-thong-huong-doi-tuong-dai-hoc-bach-khoa-...13690151 slide-phan-tich-thiet-ke-he-thong-huong-doi-tuong-dai-hoc-bach-khoa-...
13690151 slide-phan-tich-thiet-ke-he-thong-huong-doi-tuong-dai-hoc-bach-khoa-...
 
Object oriented programming With C#
Object oriented programming With C#Object oriented programming With C#
Object oriented programming With C#
 
Cơ sở dữ liệu đại học
Cơ sở dữ liệu đại họcCơ sở dữ liệu đại học
Cơ sở dữ liệu đại học
 
Database concepts
Database conceptsDatabase concepts
Database concepts
 
Views, Triggers, Functions, Stored Procedures, Indexing and Joins
Views, Triggers, Functions, Stored Procedures,  Indexing and JoinsViews, Triggers, Functions, Stored Procedures,  Indexing and Joins
Views, Triggers, Functions, Stored Procedures, Indexing and Joins
 
[Cntt] bài giảng lập trình java bkhcm
[Cntt] bài giảng lập trình java   bkhcm[Cntt] bài giảng lập trình java   bkhcm
[Cntt] bài giảng lập trình java bkhcm
 
Thuật Toán BEA (Bond Energy Algorithm)
Thuật Toán BEA (Bond Energy Algorithm) Thuật Toán BEA (Bond Energy Algorithm)
Thuật Toán BEA (Bond Energy Algorithm)
 
Bai tap thuc hanh
Bai tap thuc hanhBai tap thuc hanh
Bai tap thuc hanh
 
Bai tap va loi giai sql
Bai tap va loi giai sqlBai tap va loi giai sql
Bai tap va loi giai sql
 
Top 1000 Java Interview Questions Includes Spring, Hibernate, Microservices, ...
Top 1000 Java Interview Questions Includes Spring, Hibernate, Microservices, ...Top 1000 Java Interview Questions Includes Spring, Hibernate, Microservices, ...
Top 1000 Java Interview Questions Includes Spring, Hibernate, Microservices, ...
 
Lap trinh-huong-doi-tuong-bang-c#
Lap trinh-huong-doi-tuong-bang-c#Lap trinh-huong-doi-tuong-bang-c#
Lap trinh-huong-doi-tuong-bang-c#
 
Cơ sở dữ liệu PTIT đại số quan hệ
Cơ sở dữ liệu PTIT đại số quan hệCơ sở dữ liệu PTIT đại số quan hệ
Cơ sở dữ liệu PTIT đại số quan hệ
 
Uml hà
Uml hàUml hà
Uml hà
 
MySql slides (ppt)
MySql slides (ppt)MySql slides (ppt)
MySql slides (ppt)
 
Ado.net
Ado.netAdo.net
Ado.net
 
11. Java Objects and classes
11. Java  Objects and classes11. Java  Objects and classes
11. Java Objects and classes
 
Ltdt
LtdtLtdt
Ltdt
 
FSOFT - Test Java Exam
FSOFT - Test Java ExamFSOFT - Test Java Exam
FSOFT - Test Java Exam
 
Chapitre 11: Expression Lambda et Référence de méthode en Java
Chapitre 11: Expression Lambda et Référence de méthode en JavaChapitre 11: Expression Lambda et Référence de méthode en Java
Chapitre 11: Expression Lambda et Référence de méthode en Java
 

En vedette

Ling to SQL and Entity Framework performance analysis
Ling to SQL and Entity Framework performance analysisLing to SQL and Entity Framework performance analysis
Ling to SQL and Entity Framework performance analysis
Alexander Konduforov
 

En vedette (20)

Ling to SQL and Entity Framework performance analysis
Ling to SQL and Entity Framework performance analysisLing to SQL and Entity Framework performance analysis
Ling to SQL and Entity Framework performance analysis
 
Linq to entity
Linq to entityLinq to entity
Linq to entity
 
B_110500002
B_110500002B_110500002
B_110500002
 
20130329 introduction to linq
20130329 introduction to linq20130329 introduction to linq
20130329 introduction to linq
 
Linq e Ef
Linq e EfLinq e Ef
Linq e Ef
 
LINQ for absolute beginners
LINQ for absolute beginnersLINQ for absolute beginners
LINQ for absolute beginners
 
Linq
LinqLinq
Linq
 
Entity Framework - Queries
Entity Framework -  QueriesEntity Framework -  Queries
Entity Framework - Queries
 
Entity framework
Entity frameworkEntity framework
Entity framework
 
LINQ
LINQLINQ
LINQ
 
The Entity Data Model
The Entity Data ModelThe Entity Data Model
The Entity Data Model
 
Entity Framework - Entity Data Model (edm)
Entity Framework - Entity Data Model (edm)Entity Framework - Entity Data Model (edm)
Entity Framework - Entity Data Model (edm)
 
LINQ and LINQPad
LINQ and LINQPadLINQ and LINQPad
LINQ and LINQPad
 
Think in linq
Think in linqThink in linq
Think in linq
 
PostCss
PostCssPostCss
PostCss
 
メタプログラミング C#
メタプログラミング C#メタプログラミング C#
メタプログラミング C#
 
RAII and ScopeGuard
RAII and ScopeGuardRAII and ScopeGuard
RAII and ScopeGuard
 
C# 式木 (Expression Tree) ~ LINQをより深く理解するために ~
C# 式木 (Expression Tree) ~ LINQをより深く理解するために ~C# 式木 (Expression Tree) ~ LINQをより深く理解するために ~
C# 式木 (Expression Tree) ~ LINQをより深く理解するために ~
 
LINQ in C#
LINQ in C#LINQ in C#
LINQ in C#
 
LINQ 2 SQL Presentation To Palmchip And Trg, Technology Resource Group
LINQ 2 SQL Presentation To Palmchip  And Trg, Technology Resource GroupLINQ 2 SQL Presentation To Palmchip  And Trg, Technology Resource Group
LINQ 2 SQL Presentation To Palmchip And Trg, Technology Resource Group
 

Similaire à Linq intro

Embedded Typesafe Domain Specific Languages for Java
Embedded Typesafe Domain Specific Languages for JavaEmbedded Typesafe Domain Specific Languages for Java
Embedded Typesafe Domain Specific Languages for Java
Jevgeni Kabanov
 
Visual studio 2008
Visual studio 2008Visual studio 2008
Visual studio 2008
Luis Enrique
 
Micro-ORM Introduction - Don't overcomplicate
Micro-ORM Introduction - Don't overcomplicateMicro-ORM Introduction - Don't overcomplicate
Micro-ORM Introduction - Don't overcomplicate
Kiev ALT.NET
 
Introduction To Csharp
Introduction To CsharpIntroduction To Csharp
Introduction To Csharp
g_hemanth17
 
Introduction to-csharp-1229579367461426-1
Introduction to-csharp-1229579367461426-1Introduction to-csharp-1229579367461426-1
Introduction to-csharp-1229579367461426-1
Sachin Singh
 
Introduction to CSharp
Introduction to CSharpIntroduction to CSharp
Introduction to CSharp
Mody Farouk
 
Introduction to csharp
Introduction to csharpIntroduction to csharp
Introduction to csharp
Raga Vahini
 
Introduction to csharp
Introduction to csharpIntroduction to csharp
Introduction to csharp
Satish Verma
 
Introduction to csharp
Introduction to csharpIntroduction to csharp
Introduction to csharp
singhadarsh
 
Introduction to Csharp (C-Sharp) is a programming language developed by Micro...
Introduction to Csharp (C-Sharp) is a programming language developed by Micro...Introduction to Csharp (C-Sharp) is a programming language developed by Micro...
Introduction to Csharp (C-Sharp) is a programming language developed by Micro...
NALESVPMEngg
 

Similaire à Linq intro (20)

PostThis
PostThisPostThis
PostThis
 
Embedded Typesafe Domain Specific Languages for Java
Embedded Typesafe Domain Specific Languages for JavaEmbedded Typesafe Domain Specific Languages for Java
Embedded Typesafe Domain Specific Languages for Java
 
Visual studio 2008
Visual studio 2008Visual studio 2008
Visual studio 2008
 
TechTalk - Dotnet
TechTalk - DotnetTechTalk - Dotnet
TechTalk - Dotnet
 
devLink - What's New in C# 4?
devLink - What's New in C# 4?devLink - What's New in C# 4?
devLink - What's New in C# 4?
 
Attributes & .NET components
Attributes & .NET componentsAttributes & .NET components
Attributes & .NET components
 
Understanding linq
Understanding linqUnderstanding linq
Understanding linq
 
Micro-ORM Introduction - Don't overcomplicate
Micro-ORM Introduction - Don't overcomplicateMicro-ORM Introduction - Don't overcomplicate
Micro-ORM Introduction - Don't overcomplicate
 
Language Integrated Query By Nyros Developer
Language Integrated Query By Nyros DeveloperLanguage Integrated Query By Nyros Developer
Language Integrated Query By Nyros Developer
 
Ralf Laemmel - Not quite a sales pitch for C# 3.0 and .NET's LINQ - 2008-03-05
Ralf Laemmel - Not quite a sales pitch for C# 3.0 and .NET's LINQ - 2008-03-05Ralf Laemmel - Not quite a sales pitch for C# 3.0 and .NET's LINQ - 2008-03-05
Ralf Laemmel - Not quite a sales pitch for C# 3.0 and .NET's LINQ - 2008-03-05
 
Introduction To Csharp
Introduction To CsharpIntroduction To Csharp
Introduction To Csharp
 
Introduction to-csharp-1229579367461426-1
Introduction to-csharp-1229579367461426-1Introduction to-csharp-1229579367461426-1
Introduction to-csharp-1229579367461426-1
 
Introduction to CSharp
Introduction to CSharpIntroduction to CSharp
Introduction to CSharp
 
Introduction to csharp
Introduction to csharpIntroduction to csharp
Introduction to csharp
 
Introduction to csharp
Introduction to csharpIntroduction to csharp
Introduction to csharp
 
Introduction to csharp
Introduction to csharpIntroduction to csharp
Introduction to csharp
 
Introduction to-csharp
Introduction to-csharpIntroduction to-csharp
Introduction to-csharp
 
Introduction to Csharp (C-Sharp) is a programming language developed by Micro...
Introduction to Csharp (C-Sharp) is a programming language developed by Micro...Introduction to Csharp (C-Sharp) is a programming language developed by Micro...
Introduction to Csharp (C-Sharp) is a programming language developed by Micro...
 
Introduction-to-Csharp.ppt
Introduction-to-Csharp.pptIntroduction-to-Csharp.ppt
Introduction-to-Csharp.ppt
 
Introduction-to-Csharp.ppt
Introduction-to-Csharp.pptIntroduction-to-Csharp.ppt
Introduction-to-Csharp.ppt
 

Plus de Bình Trọng Án

2816 mcsa--part-11--domain-c111ntroller--join-domain-1
2816 mcsa--part-11--domain-c111ntroller--join-domain-12816 mcsa--part-11--domain-c111ntroller--join-domain-1
2816 mcsa--part-11--domain-c111ntroller--join-domain-1
Bình Trọng Án
 
Displaying XML Documents Using CSS and XSL
Displaying XML Documents Using CSS and XSLDisplaying XML Documents Using CSS and XSL
Displaying XML Documents Using CSS and XSL
Bình Trọng Án
 

Plus de Bình Trọng Án (19)

A Developer's Guide to CQRS Using .NET Core and MediatR
A Developer's Guide to CQRS Using .NET Core and MediatRA Developer's Guide to CQRS Using .NET Core and MediatR
A Developer's Guide to CQRS Using .NET Core and MediatR
 
Nếu con em vị nói lắp
Nếu con em vị nói lắpNếu con em vị nói lắp
Nếu con em vị nói lắp
 
Bài giảng chuyên đề - Lê Minh Hoàng
Bài giảng chuyên đề - Lê Minh HoàngBài giảng chuyên đề - Lê Minh Hoàng
Bài giảng chuyên đề - Lê Minh Hoàng
 
Tìm hiểu về NodeJs
Tìm hiểu về NodeJsTìm hiểu về NodeJs
Tìm hiểu về NodeJs
 
Clean code-v2.2
Clean code-v2.2Clean code-v2.2
Clean code-v2.2
 
Các câu chuyện toán học - Tập 3: Khẳng định trong phủ định
Các câu chuyện toán học - Tập 3: Khẳng định trong phủ địnhCác câu chuyện toán học - Tập 3: Khẳng định trong phủ định
Các câu chuyện toán học - Tập 3: Khẳng định trong phủ định
 
Luyện dịch Việt Anh
Luyện dịch Việt AnhLuyện dịch Việt Anh
Luyện dịch Việt Anh
 
2816 mcsa--part-11--domain-c111ntroller--join-domain-1
2816 mcsa--part-11--domain-c111ntroller--join-domain-12816 mcsa--part-11--domain-c111ntroller--join-domain-1
2816 mcsa--part-11--domain-c111ntroller--join-domain-1
 
LinQ to XML
LinQ to XMLLinQ to XML
LinQ to XML
 
Chuyên đề group policy
Chuyên đề group policyChuyên đề group policy
Chuyên đề group policy
 
Chapter 4 xml schema
Chapter 4   xml schemaChapter 4   xml schema
Chapter 4 xml schema
 
Tỷ lệ vàng - một phát hiện vĩ đại của hình học
Tỷ lệ vàng - một phát hiện vĩ đại của hình họcTỷ lệ vàng - một phát hiện vĩ đại của hình học
Tỷ lệ vàng - một phát hiện vĩ đại của hình học
 
Ajax Control ToolKit
Ajax Control ToolKitAjax Control ToolKit
Ajax Control ToolKit
 
Sách chữa tật nói lắp Version 1.0 beta
Sách chữa tật nói lắp Version 1.0 betaSách chữa tật nói lắp Version 1.0 beta
Sách chữa tật nói lắp Version 1.0 beta
 
Mô hình 3 lớp
Mô hình 3 lớpMô hình 3 lớp
Mô hình 3 lớp
 
Xsd examples
Xsd examplesXsd examples
Xsd examples
 
Displaying XML Documents Using CSS and XSL
Displaying XML Documents Using CSS and XSLDisplaying XML Documents Using CSS and XSL
Displaying XML Documents Using CSS and XSL
 
Tp2
Tp2Tp2
Tp2
 
Introduction to XML
Introduction to XMLIntroduction to XML
Introduction to XML
 

Dernier

Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
AnaAcapella
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
KarakKing
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
ZurliaSoop
 

Dernier (20)

Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 
Spatium Project Simulation student brief
Spatium Project Simulation student briefSpatium Project Simulation student brief
Spatium Project Simulation student brief
 
Dyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxDyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptx
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
 
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxSKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 

Linq intro

  • 1. Language Integrated Query (LINQ) Nguyen Minh Dao [email_address]
  • 2.
  • 3.
  • 4.
  • 5. What is the .NET Framework 3.5? .NET Framework 2.0 + SP1 Windows Presentation Foundation Windows Communication Foundation Windows Workflow Foundation Windows CardSpace .NET Framework 3.0 + SP1 .NET Framework 3.5 LINQ ASP.NET 3.5 CLR Add-in Framework Additional Enhancements
  • 7.
  • 8. Language Innovations var contacts = from c in customers where c.City == &quot;Hove&quot; select new { c.Name, c.Phone }; var contacts = customers .Where(c => c.City == &quot;Hove&quot;) .Select(c => new { c.Name, c.Phone }); Extension methods Lambda expressions Query expressions Object initializers Anonymous types Local variable type inference
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15. Demo Anonymous types, automatic properties, collection initializers, extension methods
  • 16. First, A Taste of LINQ using System; using System.Query; using System.Collections.Generic;   class app { static void Main() { string [] names = { &quot;Burke&quot;, &quot;Connor&quot;, &quot;Frank&quot;, &quot;Everett&quot;, &quot;Albert&quot;, &quot;George&quot;, &quot;Harris&quot;, &quot;David&quot; };   var expr = from s in names where s.Length == 5 orderby s select s.ToUpper();   foreach ( string item in expr) Console .WriteLine(item); } } BURKE DAVID FRANK
  • 17.
  • 18. LINQ Architecture LINQ-enabled data sources LINQ To Objects LINQ To XML LINQ-enabled ADO.NET Visual Basic Others LINQ To Entities LINQ To SQL LINQ To Datasets .Net Language Integrated Query (LINQ) Visual C# Objects Databases
  • 19. LINQ Architecture LINQ-enabled data sources LINQ To Objects LINQ To XML LINQ-enabled ADO.NET Visual Basic Others LINQ To Entities LINQ To SQL LINQ To Datasets .Net Language Integrated Query (LINQ) Visual C# Objects Databases
  • 20.
  • 21. LINQ Architecture LINQ-enabled data sources LINQ To Objects LINQ To XML LINQ-enabled ADO.NET Visual Basic Others LINQ To Entities LINQ To SQL LINQ To Datasets .Net Language Integrated Query (LINQ) Visual C# Objects Databases
  • 22. LINQ to SQL Overview
  • 23. LINQ to SQL Architecture Enumerate SQL Query or SProc Rows Objects SubmitChanges() DML or SProcs Application LINQ to SQL from c in db.Customers where c.City == &quot;London&quot; select c.CompanyName SELECT CompanyName FROM Customer WHERE City = 'London' db.Customers.Add(c1); c2.City = “Seattle&quot;; db.Customers.Remove(c3); INSERT INTO Customer … UPDATE Customer … DELETE FROM Customer …
  • 24.
  • 25.
  • 26. Demo LINQ to Objects LINQ to SQL
  • 27. LINQ Architecture LINQ-enabled data sources LINQ To Objects LINQ To XML LINQ-enabled ADO.NET Visual Basic Others LINQ To Entities LINQ To SQL LINQ To Datasets .Net Language Integrated Query (LINQ) Visual C# Objects Databases
  • 28.
  • 29. Demo LINQ to XML
  • 30.
  • 31.