SlideShare uma empresa Scribd logo
1 de 12
LINQ Samnang Cheng MUM – 2011 http://samneang-ngeth.blogspot.com
Agenda What is LINQ? Why LINQ? LINQ with Object LINQ with XML LINQ with SQL Demo Q & A
What is LINQ? Stands for Language INtegrated Query. It is a Microsoft .NET Framework component that adds native data querying capabilities to .NET languages. It follows query expression rule.
Why? It provides consistent model for working with data across various kinds of data sources and formats, such as, Object, XML, Dataset, SQL, Entity with short  and effective syntax. Improve performance.
LINQ
Operation Classification
LINQto Object The LINQ to Objects provider is used for querying in-memory collections, using the local query execution engine of LINQ. Example: string[] greetings = { "Hello world", "Hello LINQ", "Hello Apress"}; var items = from s in greetings where s.EndsWith("LINQ") select s; foreach (var item in items) txtResult.Text += item + ""; Result => Hello LINQ
LINQto XML The LINQ to XML provider converts an XML document to a collection of XElement objects, which are then queried against using the local execution engine that is provided as a part of the implementation of the standard query operator.  Example: var titles = from book in books.Elements("book")                          where (string)book.Element("author") == "Steve Nolle"                          select book.Element("title"); foreach (var title in titles) txtResult.Text = title.Value; Result => Software Engineering
LINQto SQL The LINQ to SQL provider allows LINQ to be used to query SQL Server databases, including SQL Server Compact databases.  Example: DataClasses1DataContext dc1 = new DataClasses1DataContext(); var hotel = from h in dc1.tbl_Hotels                         where h.city == "London"                         select h.hotelName; foreach (string h in hotel) txtResult.Text += h + "";
LINQto SQL DEMO The LINQ to SQL provider allows LINQ to be used to query SQL Server databases, including SQL Server Compact databases.  Example: DataClasses1DataContext dc1 = new DataClasses1DataContext(); var hotel = from h in dc1.tbl_Hotels                         where h.city == "London"                         select h.hotelName; foreach (string h in hotel) txtResult.Text += h + "";
References “LINQ Quickly“ - N Satheesh Kumar “Pro LINQ in C# 2008” - Joseph C. Rattz, Jr. http://en.wikipedia.org/wiki/Language_Integrated_Query
Thank you!Q & A Samnang Cheng MUM – 2011 http://samneang-ngeth.blogspot.com

Mais conteúdo relacionado

Mais procurados

Language Integrated Query - LINQ
Language Integrated Query - LINQLanguage Integrated Query - LINQ
Language Integrated Query - LINQ
Doncho Minkov
 
ADO.NET Entity Framework
ADO.NET Entity FrameworkADO.NET Entity Framework
ADO.NET Entity Framework
Doncho Minkov
 
Introducing Arc: A Common Intermediate Language for Unified Batch and Stream...
Introducing Arc:  A Common Intermediate Language for Unified Batch and Stream...Introducing Arc:  A Common Intermediate Language for Unified Batch and Stream...
Introducing Arc: A Common Intermediate Language for Unified Batch and Stream...
Flink Forward
 
Introduction to NHibernate
Introduction to NHibernateIntroduction to NHibernate
Introduction to NHibernate
Dublin Alt,Net
 
NHibernate for .NET
NHibernate for .NETNHibernate for .NET
NHibernate for .NET
Guo Albert
 

Mais procurados (19)

Language Integrated Query - LINQ
Language Integrated Query - LINQLanguage Integrated Query - LINQ
Language Integrated Query - LINQ
 
Link quries
Link quriesLink quries
Link quries
 
Apollo Server III
Apollo Server IIIApollo Server III
Apollo Server III
 
Apollo Server IV
Apollo Server IVApollo Server IV
Apollo Server IV
 
Linq in asp.net
Linq in asp.netLinq in asp.net
Linq in asp.net
 
Apollo Server
Apollo ServerApollo Server
Apollo Server
 
Entity Framework
Entity FrameworkEntity Framework
Entity Framework
 
Easy Dataweave transformations - Ashutosh
Easy Dataweave transformations - AshutoshEasy Dataweave transformations - Ashutosh
Easy Dataweave transformations - Ashutosh
 
Apollo server II
Apollo server IIApollo server II
Apollo server II
 
Introduction to RxJava on Android
Introduction to RxJava on AndroidIntroduction to RxJava on Android
Introduction to RxJava on Android
 
ADO.NET Entity Framework
ADO.NET Entity FrameworkADO.NET Entity Framework
ADO.NET Entity Framework
 
Introducing Arc: A Common Intermediate Language for Unified Batch and Stream...
Introducing Arc:  A Common Intermediate Language for Unified Batch and Stream...Introducing Arc:  A Common Intermediate Language for Unified Batch and Stream...
Introducing Arc: A Common Intermediate Language for Unified Batch and Stream...
 
B_110500002
B_110500002B_110500002
B_110500002
 
Introduction to NHibernate
Introduction to NHibernateIntroduction to NHibernate
Introduction to NHibernate
 
Functional programming in Javascript
Functional programming in JavascriptFunctional programming in Javascript
Functional programming in Javascript
 
NHibernate for .NET
NHibernate for .NETNHibernate for .NET
NHibernate for .NET
 
Entity framework 4.0
Entity framework 4.0Entity framework 4.0
Entity framework 4.0
 
Tolog Updates
Tolog UpdatesTolog Updates
Tolog Updates
 
NHibernate
NHibernateNHibernate
NHibernate
 

Semelhante a Linq

Dev-In-Town:Linq To Sql by Chan Ming Man
Dev-In-Town:Linq To Sql by Chan Ming ManDev-In-Town:Linq To Sql by Chan Ming Man
Dev-In-Town:Linq To Sql by Chan Ming Man
Quek Lilian
 
What's New for Data?
What's New for Data?What's New for Data?
What's New for Data?
ukdpe
 
Linqtosql 090629035715 Phpapp01
Linqtosql 090629035715 Phpapp01Linqtosql 090629035715 Phpapp01
Linqtosql 090629035715 Phpapp01
google
 
Visual studio 2008
Visual studio 2008Visual studio 2008
Visual studio 2008
Luis Enrique
 
Toub parallelism tour_oct2009
Toub parallelism tour_oct2009Toub parallelism tour_oct2009
Toub parallelism tour_oct2009
nkaluva
 
Exploring SharePoint with F#
Exploring SharePoint with F#Exploring SharePoint with F#
Exploring SharePoint with F#
Talbott Crowell
 
SQL Server 2000 Research Series - Transact SQL
SQL Server 2000 Research Series - Transact SQLSQL Server 2000 Research Series - Transact SQL
SQL Server 2000 Research Series - Transact SQL
Jerry Yang
 

Semelhante a Linq (20)

NoSQL Endgame DevoxxUA Conference 2020
NoSQL Endgame DevoxxUA Conference 2020NoSQL Endgame DevoxxUA Conference 2020
NoSQL Endgame DevoxxUA Conference 2020
 
Dev-In-Town:Linq To Sql by Chan Ming Man
Dev-In-Town:Linq To Sql by Chan Ming ManDev-In-Town:Linq To Sql by Chan Ming Man
Dev-In-Town:Linq To Sql by Chan Ming Man
 
LINQ-Introduction.ppt
LINQ-Introduction.pptLINQ-Introduction.ppt
LINQ-Introduction.ppt
 
What's New for Data?
What's New for Data?What's New for Data?
What's New for Data?
 
Linq
LinqLinq
Linq
 
Intake 37 linq3
Intake 37 linq3Intake 37 linq3
Intake 37 linq3
 
Linqtosql 090629035715 Phpapp01
Linqtosql 090629035715 Phpapp01Linqtosql 090629035715 Phpapp01
Linqtosql 090629035715 Phpapp01
 
SQL Server - CLR integration
SQL Server - CLR integrationSQL Server - CLR integration
SQL Server - CLR integration
 
Spark sql meetup
Spark sql meetupSpark sql meetup
Spark sql meetup
 
Linq in C#
Linq in C#Linq in C#
Linq in C#
 
Language Integrated Query By Nyros Developer
Language Integrated Query By Nyros DeveloperLanguage Integrated Query By Nyros Developer
Language Integrated Query By Nyros Developer
 
LINQ to Relational in Visual Studio 2008 SP1
LINQ to Relational in Visual Studio 2008 SP1LINQ to Relational in Visual Studio 2008 SP1
LINQ to Relational in Visual Studio 2008 SP1
 
Asp.Net 3.5 Part 2
Asp.Net 3.5 Part 2Asp.Net 3.5 Part 2
Asp.Net 3.5 Part 2
 
Visual studio 2008
Visual studio 2008Visual studio 2008
Visual studio 2008
 
Toub parallelism tour_oct2009
Toub parallelism tour_oct2009Toub parallelism tour_oct2009
Toub parallelism tour_oct2009
 
70487.pdf
70487.pdf70487.pdf
70487.pdf
 
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
 
C# advanced topics and future - C#5
C# advanced topics and future - C#5C# advanced topics and future - C#5
C# advanced topics and future - C#5
 
Exploring SharePoint with F#
Exploring SharePoint with F#Exploring SharePoint with F#
Exploring SharePoint with F#
 
SQL Server 2000 Research Series - Transact SQL
SQL Server 2000 Research Series - Transact SQLSQL Server 2000 Research Series - Transact SQL
SQL Server 2000 Research Series - Transact SQL
 

Último

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
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
 

Último (20)

Spatium Project Simulation student brief
Spatium Project Simulation student briefSpatium Project Simulation student brief
Spatium Project Simulation student brief
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
 
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
 
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
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
 
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
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptx
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
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
 
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
 
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...
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptx
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 

Linq

  • 1. LINQ Samnang Cheng MUM – 2011 http://samneang-ngeth.blogspot.com
  • 2. Agenda What is LINQ? Why LINQ? LINQ with Object LINQ with XML LINQ with SQL Demo Q & A
  • 3. What is LINQ? Stands for Language INtegrated Query. It is a Microsoft .NET Framework component that adds native data querying capabilities to .NET languages. It follows query expression rule.
  • 4. Why? It provides consistent model for working with data across various kinds of data sources and formats, such as, Object, XML, Dataset, SQL, Entity with short and effective syntax. Improve performance.
  • 7. LINQto Object The LINQ to Objects provider is used for querying in-memory collections, using the local query execution engine of LINQ. Example: string[] greetings = { "Hello world", "Hello LINQ", "Hello Apress"}; var items = from s in greetings where s.EndsWith("LINQ") select s; foreach (var item in items) txtResult.Text += item + ""; Result => Hello LINQ
  • 8. LINQto XML The LINQ to XML provider converts an XML document to a collection of XElement objects, which are then queried against using the local execution engine that is provided as a part of the implementation of the standard query operator. Example: var titles = from book in books.Elements("book") where (string)book.Element("author") == "Steve Nolle" select book.Element("title"); foreach (var title in titles) txtResult.Text = title.Value; Result => Software Engineering
  • 9. LINQto SQL The LINQ to SQL provider allows LINQ to be used to query SQL Server databases, including SQL Server Compact databases. Example: DataClasses1DataContext dc1 = new DataClasses1DataContext(); var hotel = from h in dc1.tbl_Hotels where h.city == "London" select h.hotelName; foreach (string h in hotel) txtResult.Text += h + "";
  • 10. LINQto SQL DEMO The LINQ to SQL provider allows LINQ to be used to query SQL Server databases, including SQL Server Compact databases. Example: DataClasses1DataContext dc1 = new DataClasses1DataContext(); var hotel = from h in dc1.tbl_Hotels where h.city == "London" select h.hotelName; foreach (string h in hotel) txtResult.Text += h + "";
  • 11. References “LINQ Quickly“ - N Satheesh Kumar “Pro LINQ in C# 2008” - Joseph C. Rattz, Jr. http://en.wikipedia.org/wiki/Language_Integrated_Query
  • 12. Thank you!Q & A Samnang Cheng MUM – 2011 http://samneang-ngeth.blogspot.com