SlideShare uma empresa Scribd logo
1 de 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

Mais conteúdo relacionado

Mais procurados

Bài 3: Ngôn ngữ truy vân có cấu trúc (SQL) - Giáo trình FPT
Bài 3: Ngôn ngữ truy vân có cấu trúc (SQL) - Giáo trình FPTBài 3: Ngôn ngữ truy vân có cấu trúc (SQL) - Giáo trình FPT
Bài 3: Ngôn ngữ truy vân có cấu trúc (SQL) - Giáo trình FPTMasterCode.vn
 
Bài giảng kiến trúc máy tính
Bài giảng kiến trúc máy tínhBài giảng kiến trúc máy tính
Bài giảng kiến trúc máy tínhCao Toa
 
Automata slide
Automata slide Automata slide
Automata slide vanms1989
 
PostgreSQL Tutorial for Beginners | Edureka
PostgreSQL Tutorial for Beginners | EdurekaPostgreSQL Tutorial for Beginners | Edureka
PostgreSQL Tutorial for Beginners | EdurekaEdureka!
 
Ebook hướng dẫn lập trình từ điển
Ebook hướng dẫn lập trình từ điểnEbook hướng dẫn lập trình từ điển
Ebook hướng dẫn lập trình từ điểnAnh Pham Duy
 
Khóa luận nghiên cứu bài toán phân tích cảm xúc của người hùng 9166421
Khóa luận nghiên cứu bài toán phân tích cảm xúc của người hùng 9166421Khóa luận nghiên cứu bài toán phân tích cảm xúc của người hùng 9166421
Khóa luận nghiên cứu bài toán phân tích cảm xúc của người hùng 9166421jackjohn45
 
Master page and Theme ASP.NET with VB.NET
Master page and Theme ASP.NET with VB.NETMaster page and Theme ASP.NET with VB.NET
Master page and Theme ASP.NET with VB.NETShyam Sir
 
Bài 5: Thiết kế giao diện - Giáo trình FPT
Bài 5: Thiết kế giao diện - Giáo trình FPTBài 5: Thiết kế giao diện - Giáo trình FPT
Bài 5: Thiết kế giao diện - Giáo trình FPTMasterCode.vn
 
Báo cáo đồ án tốt nghiệp "Ứng dụng trí tuệ nhân tạo nhận dạng chữ viết tay xâ...
Báo cáo đồ án tốt nghiệp "Ứng dụng trí tuệ nhân tạo nhận dạng chữ viết tay xâ...Báo cáo đồ án tốt nghiệp "Ứng dụng trí tuệ nhân tạo nhận dạng chữ viết tay xâ...
Báo cáo đồ án tốt nghiệp "Ứng dụng trí tuệ nhân tạo nhận dạng chữ viết tay xâ...The Boss
 
Giới thiệu cách sử dụng Bootstrap CSS Framework
Giới thiệu cách sử dụng Bootstrap CSS FrameworkGiới thiệu cách sử dụng Bootstrap CSS Framework
Giới thiệu cách sử dụng Bootstrap CSS Frameworkhocwebgiare
 
Bài tập xâu cơ bản-nâng cao
Bài tập xâu cơ bản-nâng caoBài tập xâu cơ bản-nâng cao
Bài tập xâu cơ bản-nâng caoTường Tường
 
Bai giang-ctdl
Bai giang-ctdlBai giang-ctdl
Bai giang-ctdlPhong Vân
 
Connecting and using PostgreSQL database with psycopg2 [Python 2.7]
Connecting and using PostgreSQL database with psycopg2 [Python 2.7]Connecting and using PostgreSQL database with psycopg2 [Python 2.7]
Connecting and using PostgreSQL database with psycopg2 [Python 2.7]Dinesh Neupane
 
Phân tích cảm xúc trong tiếng việt bằng phương pháp máy học.pdf
Phân tích cảm xúc trong tiếng việt bằng phương pháp máy học.pdfPhân tích cảm xúc trong tiếng việt bằng phương pháp máy học.pdf
Phân tích cảm xúc trong tiếng việt bằng phương pháp máy học.pdfMan_Ebook
 
Chuyên Đề Áp Dụng Sơ Đồ Tư Duy Vào Quá Trình Dạy Học Cấp Tiểu Học.pdf
Chuyên Đề Áp Dụng Sơ Đồ Tư Duy Vào Quá Trình Dạy Học Cấp Tiểu Học.pdfChuyên Đề Áp Dụng Sơ Đồ Tư Duy Vào Quá Trình Dạy Học Cấp Tiểu Học.pdf
Chuyên Đề Áp Dụng Sơ Đồ Tư Duy Vào Quá Trình Dạy Học Cấp Tiểu Học.pdfHanaTiti
 

Mais procurados (20)

Bài 3: Ngôn ngữ truy vân có cấu trúc (SQL) - Giáo trình FPT
Bài 3: Ngôn ngữ truy vân có cấu trúc (SQL) - Giáo trình FPTBài 3: Ngôn ngữ truy vân có cấu trúc (SQL) - Giáo trình FPT
Bài 3: Ngôn ngữ truy vân có cấu trúc (SQL) - Giáo trình FPT
 
Bài giảng kiến trúc máy tính
Bài giảng kiến trúc máy tínhBài giảng kiến trúc máy tính
Bài giảng kiến trúc máy tính
 
Automata slide
Automata slide Automata slide
Automata slide
 
PostgreSQL Tutorial for Beginners | Edureka
PostgreSQL Tutorial for Beginners | EdurekaPostgreSQL Tutorial for Beginners | Edureka
PostgreSQL Tutorial for Beginners | Edureka
 
Ebook hướng dẫn lập trình từ điển
Ebook hướng dẫn lập trình từ điểnEbook hướng dẫn lập trình từ điển
Ebook hướng dẫn lập trình từ điển
 
The PostgreSQL Query Planner
The PostgreSQL Query PlannerThe PostgreSQL Query Planner
The PostgreSQL Query Planner
 
Khóa luận nghiên cứu bài toán phân tích cảm xúc của người hùng 9166421
Khóa luận nghiên cứu bài toán phân tích cảm xúc của người hùng 9166421Khóa luận nghiên cứu bài toán phân tích cảm xúc của người hùng 9166421
Khóa luận nghiên cứu bài toán phân tích cảm xúc của người hùng 9166421
 
Master page and Theme ASP.NET with VB.NET
Master page and Theme ASP.NET with VB.NETMaster page and Theme ASP.NET with VB.NET
Master page and Theme ASP.NET with VB.NET
 
Bài 5: Thiết kế giao diện - Giáo trình FPT
Bài 5: Thiết kế giao diện - Giáo trình FPTBài 5: Thiết kế giao diện - Giáo trình FPT
Bài 5: Thiết kế giao diện - Giáo trình FPT
 
Luận văn: Các dạng phương trình lượng giác, HAY, 9đ
Luận văn: Các dạng phương trình lượng giác, HAY, 9đLuận văn: Các dạng phương trình lượng giác, HAY, 9đ
Luận văn: Các dạng phương trình lượng giác, HAY, 9đ
 
Báo cáo đồ án tốt nghiệp "Ứng dụng trí tuệ nhân tạo nhận dạng chữ viết tay xâ...
Báo cáo đồ án tốt nghiệp "Ứng dụng trí tuệ nhân tạo nhận dạng chữ viết tay xâ...Báo cáo đồ án tốt nghiệp "Ứng dụng trí tuệ nhân tạo nhận dạng chữ viết tay xâ...
Báo cáo đồ án tốt nghiệp "Ứng dụng trí tuệ nhân tạo nhận dạng chữ viết tay xâ...
 
Đề tài: Tìm hiểu về JQsuery – UI – Bootstrap và ứng dụng, 9đ
Đề tài: Tìm hiểu về JQsuery – UI – Bootstrap và ứng dụng, 9đĐề tài: Tìm hiểu về JQsuery – UI – Bootstrap và ứng dụng, 9đ
Đề tài: Tìm hiểu về JQsuery – UI – Bootstrap và ứng dụng, 9đ
 
Giới thiệu cách sử dụng Bootstrap CSS Framework
Giới thiệu cách sử dụng Bootstrap CSS FrameworkGiới thiệu cách sử dụng Bootstrap CSS Framework
Giới thiệu cách sử dụng Bootstrap CSS Framework
 
Bài tập xâu cơ bản-nâng cao
Bài tập xâu cơ bản-nâng caoBài tập xâu cơ bản-nâng cao
Bài tập xâu cơ bản-nâng cao
 
Bai giang-ctdl
Bai giang-ctdlBai giang-ctdl
Bai giang-ctdl
 
Xây dựng website theo dõi việc cấp bằng, chứng chỉ cho sinh viên
Xây dựng website theo dõi việc cấp bằng, chứng chỉ cho sinh viên Xây dựng website theo dõi việc cấp bằng, chứng chỉ cho sinh viên
Xây dựng website theo dõi việc cấp bằng, chứng chỉ cho sinh viên
 
Connecting and using PostgreSQL database with psycopg2 [Python 2.7]
Connecting and using PostgreSQL database with psycopg2 [Python 2.7]Connecting and using PostgreSQL database with psycopg2 [Python 2.7]
Connecting and using PostgreSQL database with psycopg2 [Python 2.7]
 
Phân tích cảm xúc trong tiếng việt bằng phương pháp máy học.pdf
Phân tích cảm xúc trong tiếng việt bằng phương pháp máy học.pdfPhân tích cảm xúc trong tiếng việt bằng phương pháp máy học.pdf
Phân tích cảm xúc trong tiếng việt bằng phương pháp máy học.pdf
 
Đề tài: Nghiên cứu thuật toán K-nearest neighbor, HAY, 9đ
Đề tài: Nghiên cứu thuật toán K-nearest neighbor, HAY, 9đĐề tài: Nghiên cứu thuật toán K-nearest neighbor, HAY, 9đ
Đề tài: Nghiên cứu thuật toán K-nearest neighbor, HAY, 9đ
 
Chuyên Đề Áp Dụng Sơ Đồ Tư Duy Vào Quá Trình Dạy Học Cấp Tiểu Học.pdf
Chuyên Đề Áp Dụng Sơ Đồ Tư Duy Vào Quá Trình Dạy Học Cấp Tiểu Học.pdfChuyên Đề Áp Dụng Sơ Đồ Tư Duy Vào Quá Trình Dạy Học Cấp Tiểu Học.pdf
Chuyên Đề Áp Dụng Sơ Đồ Tư Duy Vào Quá Trình Dạy Học Cấp Tiểu Học.pdf
 

Destaque

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 analysisAlexander Konduforov
 
Linq to entity
Linq to entityLinq to entity
Linq to entitybuianhtai
 
20130329 introduction to linq
20130329 introduction to linq20130329 introduction to linq
20130329 introduction to linqLearningTech
 
Entity Framework - Queries
Entity Framework -  QueriesEntity Framework -  Queries
Entity Framework - QueriesEyal Vardi
 
Entity framework
Entity frameworkEntity framework
Entity frameworkicubesystem
 
Entity Framework - Entity Data Model (edm)
Entity Framework - Entity Data Model (edm)Entity Framework - Entity Data Model (edm)
Entity Framework - Entity Data Model (edm)Eyal Vardi
 
メタプログラミング C#
メタプログラミング C#メタプログラミング C#
メタプログラミング C#Fujio Kojima
 
C# 式木 (Expression Tree) ~ LINQをより深く理解するために ~
C# 式木 (Expression Tree) ~ LINQをより深く理解するために ~C# 式木 (Expression Tree) ~ LINQをより深く理解するために ~
C# 式木 (Expression Tree) ~ LINQをより深く理解するために ~Fujio Kojima
 
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 GroupShahzad
 

Destaque (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
 

Semelhante a 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 JavaJevgeni Kabanov
 
Visual studio 2008
Visual studio 2008Visual studio 2008
Visual studio 2008Luis Enrique
 
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?Kevin Pilch
 
Attributes & .NET components
Attributes & .NET componentsAttributes & .NET components
Attributes & .NET componentsBình Trọng Án
 
Micro-ORM Introduction - Don't overcomplicate
Micro-ORM Introduction - Don't overcomplicateMicro-ORM Introduction - Don't overcomplicate
Micro-ORM Introduction - Don't overcomplicateKiev ALT.NET
 
Language Integrated Query By Nyros Developer
Language Integrated Query By Nyros DeveloperLanguage Integrated Query By Nyros Developer
Language Integrated Query By Nyros DeveloperNyros Technologies
 
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-05CHOOSE
 
Introduction To Csharp
Introduction To CsharpIntroduction To Csharp
Introduction To Csharpg_hemanth17
 
Introduction to-csharp-1229579367461426-1
Introduction to-csharp-1229579367461426-1Introduction to-csharp-1229579367461426-1
Introduction to-csharp-1229579367461426-1Sachin Singh
 
Introduction to CSharp
Introduction to CSharpIntroduction to CSharp
Introduction to CSharpMody Farouk
 
Introduction to csharp
Introduction to csharpIntroduction to csharp
Introduction to csharpRaga Vahini
 
Introduction to csharp
Introduction to csharpIntroduction to csharp
Introduction to csharpSatish Verma
 
Introduction to csharp
Introduction to csharpIntroduction to csharp
Introduction to csharpsinghadarsh
 
Introduction to-csharp
Introduction to-csharpIntroduction to-csharp
Introduction to-csharpSDFG5
 
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
 
Introduction-to-Csharp.ppt
Introduction-to-Csharp.pptIntroduction-to-Csharp.ppt
Introduction-to-Csharp.pptAlmamoon
 
Introduction-to-Csharp.ppt
Introduction-to-Csharp.pptIntroduction-to-Csharp.ppt
Introduction-to-Csharp.pptmothertheressa
 

Semelhante a 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
 

Mais de Bình Trọng Án

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 MediatRBình Trọng Án
 
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ắpBình Trọng Án
 
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àngBình Trọng Án
 
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ủ địnhBì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-1Bình Trọng Án
 
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ọcBình Trọng Án
 
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 betaBì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 XSLBình Trọng Án
 

Mais 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
 

Último

Dyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxDyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxcallscotland1987
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...Poonam Aher Patil
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the ClassroomPooky Knightsmith
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentationcamerronhm
 
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.pdfPoh-Sun Goh
 
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).pptxVishalSingh1417
 
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.christianmathematics
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Jisc
 
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 POSCeline George
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and ModificationsMJDuyan
 
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.pptxAreebaZafar22
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...pradhanghanshyam7136
 
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.pdfAdmir Softic
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxVishalSingh1417
 
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.pdfNirmal Dwivedi
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxDr. Sarita Anand
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - Englishneillewis46
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxJisc
 

Último (20)

Dyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxDyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptx
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the Classroom
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
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
 
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
 
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.
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
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
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
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
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
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
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
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
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptx
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 

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.