SlideShare a Scribd company logo
1 of 16
LINQ (Language-Integrated
Query)
Md Ariful Haque
Software Engineer
Desme Bangladesh
What is LINQ
• Language Integrated Query (LINQ, pronounced "link") is
a Microsoft .NET Framework component that adds native
data querying capabilities to .NET languages, although ports exist
for Java, PHP, JavaScript, TypeScript, and ActionScript.
• LINQ was released as a major part of .NET Framework 3.5 on November
19, 2007.
Why LINQ
• LINQ is a query syntax, not a language or an O/RM.
You can build an O/RM on top of the syntax
provided by LINQ
• Familiar language to code in (C#/ VB.NET)
• Easier to maintain (we have more .NET than SQL
gurus on staff)
• SQL generated is well structured and very optimal
• Allows direct translation of business rules to SQL
while still keeping all business logic in a single
project
LINQ Architecture
Types of LINQ
• LINQ to Objects: Provides queries on any kind of C# in-memory object, such as
arrays, lists, and other collection types.
• LINQ to XML: Provides creation and manipulation of XML documents using the
same syntax and general query mechanism as the other LINQ varieties.
• LINQ to ADO.NET: ADO.NET or Active Data Objects for .NET is an umbrella term
that includes all the different classes and libraries in .NET for accessing data in
databases, such as Microsoft SQL Server, Oracle, and others. LINQ to ADO.NET
includes LINQ to Entities, LINQ to DataSet, and LINQ to SQL.
• LINQ to Entities: The ADO.NET Entity Framework is the newest set of data
interface classes in .NET 4, recommended by Microsoft for new development.
• LINQ to DataSet: The DataSet object was introduced in the first version of the
.NET Framework. This variety of LINQ enables legacy .NET data to be queried
easily with LINQ.
• LINQ to SQL: This is an alternate LINQ interface for .NET 3.5, targeted mainly at
Microsoft SQL Server, that has been superseded by LINQ to Entities in .NET 4.
• PLINQ: PLINQ or Parallel LINQ extends LINQ to Objects with a parallel
programming library that can split up a query to execute simultaneously on a
multicore processor.
Understanding LINQ (C#)
LINQ - Query Operators
• Filtering Operators
• Join Operators
• Projection Operations
• Sorting Operators
• Grouping Operators
• Conversions
• Concatenation
• Aggregation
• Quantifier Operations
• Partition Operations
• Generation Operations
• Set Operations
• Equality
• Element Operators
LINQ - Example
Benefits of LINQ
• These features make it easy to write accurate
queries and to discover mistakes at design time.
• Time consuming
• Tables are automatically created into class
• Columns are automatically created into properties
• Relationship are automatically appeaded to classes
• queries with the integrated debugger.
• Lambda expressions are awesome
• Data is easy to setup and use
Disadvantages of LINQ
• No clear outline for Tiers
• No good way of view permissions
• Small data sets will take longer to build the query
than execute
• There is an overhead for creating queries
• When queries are moved from sql to application
side, joins are very slow
• DBML concurrency issues
• Hard to understand advance queries using
Expressions
Advanced LINQ to SQL features
• Handling concurrency
• Working directly with the database using pass-
through queries, stored procedures, and user
defined functions
• Improving the business tier with compiled queries,
partial classes, partial methods, and object
inheritance
• Comparison of LINQ to SQL with LINQ to Entities
Handling concurrency
• System.Data.Linq.ObjectChangeConflict
• System.Data.Linq.MemberChangeConflict
• System.Data.Linq.ChangeConflictCollection
• System.Data.Linq.ChangeConflictException
• DataContext.ChangeConflicts
• DataContext.SubmitChanges
• DataContext.Refresh
• ColumnAttribute.UpdateCheck
• System.Data.Linq.Mapping.UpdateCheck
• System.Data.Linq.RefreshMode
Linq Query or Lambda expression
• Lambda expression:Query Expression compiles into
Method Expression
Entity Framework vs LINQ to SQL
• Entity Framework
Enterprise Development.
Works with Conceptual model of database.
Works with all data sources.
".EDMX" is created while using Entity Framework.
• LINQ
Rapid Application Development.
Works with objects in database.
Mainly woks with SQL Server.
".dbml" is created while using LINQ to SQL.
Thanks
IEnumerable<T> ???
IQueryable<T> ???
Async ???

More Related Content

What's hot

Cassandra Summit 2015 - Building a multi-tenant API PaaS with DataStax Enterp...
Cassandra Summit 2015 - Building a multi-tenant API PaaS with DataStax Enterp...Cassandra Summit 2015 - Building a multi-tenant API PaaS with DataStax Enterp...
Cassandra Summit 2015 - Building a multi-tenant API PaaS with DataStax Enterp...Restlet
 
GraphQL - A love story
GraphQL -  A love storyGraphQL -  A love story
GraphQL - A love storybwullems
 
Berlin Apache Flink Meetup May 2015, Community Update
Berlin Apache Flink Meetup May 2015, Community UpdateBerlin Apache Flink Meetup May 2015, Community Update
Berlin Apache Flink Meetup May 2015, Community UpdateRobert Metzger
 
(ATS6-DEV05) Building Interactive Web Applications with the Reporting Collection
(ATS6-DEV05) Building Interactive Web Applications with the Reporting Collection(ATS6-DEV05) Building Interactive Web Applications with the Reporting Collection
(ATS6-DEV05) Building Interactive Web Applications with the Reporting CollectionBIOVIA
 
C# Advanced L06-SQL Server+LINQ to SQL
C# Advanced L06-SQL Server+LINQ to SQLC# Advanced L06-SQL Server+LINQ to SQL
C# Advanced L06-SQL Server+LINQ to SQLMohammad Shaker
 
ResourceSpace: Recent pains and future gains
ResourceSpace: Recent pains and future gainsResourceSpace: Recent pains and future gains
ResourceSpace: Recent pains and future gainsResourceSpace
 
(ATS6-GS02) Integrating Contur and HEOS
(ATS6-GS02) Integrating Contur and HEOS(ATS6-GS02) Integrating Contur and HEOS
(ATS6-GS02) Integrating Contur and HEOSBIOVIA
 
Welcome to New Swift: Library Evolution & LSP Support
Welcome to New Swift: Library Evolution & LSP SupportWelcome to New Swift: Library Evolution & LSP Support
Welcome to New Swift: Library Evolution & LSP SupportG ABHISEK
 
An API-first approach. Integrating ckan with RDM services
An API-first approach. Integrating ckan with RDM servicesAn API-first approach. Integrating ckan with RDM services
An API-first approach. Integrating ckan with RDM servicesJoss Winn
 
LSC@LDAPCon 2011
LSC@LDAPCon 2011LSC@LDAPCon 2011
LSC@LDAPCon 2011sbahloul
 
Where the &amp;$%! did this come from e resources in alma%2-f_primo a teachi...
Where the &amp;$%! did this come from  e resources in alma%2-f_primo a teachi...Where the &amp;$%! did this come from  e resources in alma%2-f_primo a teachi...
Where the &amp;$%! did this come from e resources in alma%2-f_primo a teachi...Martin Patrick
 
Product Camp Silicon Valley 2018 - PM Technical Skills
Product Camp Silicon Valley 2018 - PM Technical SkillsProduct Camp Silicon Valley 2018 - PM Technical Skills
Product Camp Silicon Valley 2018 - PM Technical SkillsSandeep Adwankar
 
Flink September 2015 Community Update
Flink September 2015 Community UpdateFlink September 2015 Community Update
Flink September 2015 Community UpdateRobert Metzger
 
Apache ManifoldCF @ Linux Day 2012
Apache ManifoldCF @ Linux Day 2012Apache ManifoldCF @ Linux Day 2012
Apache ManifoldCF @ Linux Day 2012Piergiorgio Lucidi
 
UWP apps development - Part 2
UWP apps development - Part 2UWP apps development - Part 2
UWP apps development - Part 2Jiri Danihelka
 

What's hot (19)

Cassandra Summit 2015 - Building a multi-tenant API PaaS with DataStax Enterp...
Cassandra Summit 2015 - Building a multi-tenant API PaaS with DataStax Enterp...Cassandra Summit 2015 - Building a multi-tenant API PaaS with DataStax Enterp...
Cassandra Summit 2015 - Building a multi-tenant API PaaS with DataStax Enterp...
 
GraphQL - A love story
GraphQL -  A love storyGraphQL -  A love story
GraphQL - A love story
 
Berlin Apache Flink Meetup May 2015, Community Update
Berlin Apache Flink Meetup May 2015, Community UpdateBerlin Apache Flink Meetup May 2015, Community Update
Berlin Apache Flink Meetup May 2015, Community Update
 
(ATS6-DEV05) Building Interactive Web Applications with the Reporting Collection
(ATS6-DEV05) Building Interactive Web Applications with the Reporting Collection(ATS6-DEV05) Building Interactive Web Applications with the Reporting Collection
(ATS6-DEV05) Building Interactive Web Applications with the Reporting Collection
 
C# Advanced L06-SQL Server+LINQ to SQL
C# Advanced L06-SQL Server+LINQ to SQLC# Advanced L06-SQL Server+LINQ to SQL
C# Advanced L06-SQL Server+LINQ to SQL
 
ResourceSpace: Recent pains and future gains
ResourceSpace: Recent pains and future gainsResourceSpace: Recent pains and future gains
ResourceSpace: Recent pains and future gains
 
Asp.net
Asp.netAsp.net
Asp.net
 
(ATS6-GS02) Integrating Contur and HEOS
(ATS6-GS02) Integrating Contur and HEOS(ATS6-GS02) Integrating Contur and HEOS
(ATS6-GS02) Integrating Contur and HEOS
 
Welcome to New Swift: Library Evolution & LSP Support
Welcome to New Swift: Library Evolution & LSP SupportWelcome to New Swift: Library Evolution & LSP Support
Welcome to New Swift: Library Evolution & LSP Support
 
An API-first approach. Integrating ckan with RDM services
An API-first approach. Integrating ckan with RDM servicesAn API-first approach. Integrating ckan with RDM services
An API-first approach. Integrating ckan with RDM services
 
LSC@LDAPCon 2011
LSC@LDAPCon 2011LSC@LDAPCon 2011
LSC@LDAPCon 2011
 
Wakanda db parisjs-2011-12
Wakanda db parisjs-2011-12Wakanda db parisjs-2011-12
Wakanda db parisjs-2011-12
 
Where the &amp;$%! did this come from e resources in alma%2-f_primo a teachi...
Where the &amp;$%! did this come from  e resources in alma%2-f_primo a teachi...Where the &amp;$%! did this come from  e resources in alma%2-f_primo a teachi...
Where the &amp;$%! did this come from e resources in alma%2-f_primo a teachi...
 
Product Camp Silicon Valley 2018 - PM Technical Skills
Product Camp Silicon Valley 2018 - PM Technical SkillsProduct Camp Silicon Valley 2018 - PM Technical Skills
Product Camp Silicon Valley 2018 - PM Technical Skills
 
Linq in asp.net
Linq in asp.netLinq in asp.net
Linq in asp.net
 
Sql implementations
Sql implementationsSql implementations
Sql implementations
 
Flink September 2015 Community Update
Flink September 2015 Community UpdateFlink September 2015 Community Update
Flink September 2015 Community Update
 
Apache ManifoldCF @ Linux Day 2012
Apache ManifoldCF @ Linux Day 2012Apache ManifoldCF @ Linux Day 2012
Apache ManifoldCF @ Linux Day 2012
 
UWP apps development - Part 2
UWP apps development - Part 2UWP apps development - Part 2
UWP apps development - Part 2
 

Similar to LINQ (Language-Integrated Query) Guide

Understanding LINQ in C#
Understanding LINQ in C# Understanding LINQ in C#
Understanding LINQ in C# MD. Shohag Mia
 
Taking a look under the hood of Apache Flink's relational APIs.
Taking a look under the hood of Apache Flink's relational APIs.Taking a look under the hood of Apache Flink's relational APIs.
Taking a look under the hood of Apache Flink's relational APIs.Fabian Hueske
 
Fabian Hueske - Taking a look under the hood of Apache Flink’s relational APIs
Fabian Hueske - Taking a look under the hood of Apache Flink’s relational APIsFabian Hueske - Taking a look under the hood of Apache Flink’s relational APIs
Fabian Hueske - Taking a look under the hood of Apache Flink’s relational APIsFlink Forward
 
The LINQ Between XML and Database
The LINQ Between XML and DatabaseThe LINQ Between XML and Database
The LINQ Between XML and DatabaseIRJET Journal
 
Rajnish singh(presentation on oracle )
Rajnish singh(presentation on  oracle )Rajnish singh(presentation on  oracle )
Rajnish singh(presentation on oracle )Rajput Rajnish
 
Unboxing ASP.NET Core
Unboxing ASP.NET CoreUnboxing ASP.NET Core
Unboxing ASP.NET CoreKevin Leung
 
Dot net platform and dotnet core fundamentals
Dot net platform and dotnet core fundamentalsDot net platform and dotnet core fundamentals
Dot net platform and dotnet core fundamentalsLalit Kale
 
The View - Leveraging Lotuscript for Database Connectivity
The View - Leveraging Lotuscript for Database ConnectivityThe View - Leveraging Lotuscript for Database Connectivity
The View - Leveraging Lotuscript for Database ConnectivityBill Buchan
 
NoSql Data Management
NoSql Data ManagementNoSql Data Management
NoSql Data Managementsameerfaizan
 
Дмитрий Тежельников «Разработка вэб-решений с использованием Asp.NET.Core и ...
Дмитрий Тежельников  «Разработка вэб-решений с использованием Asp.NET.Core и ...Дмитрий Тежельников  «Разработка вэб-решений с использованием Asp.NET.Core и ...
Дмитрий Тежельников «Разработка вэб-решений с использованием Asp.NET.Core и ...MskDotNet Community
 
What's New in .Net 4.5
What's New in .Net 4.5What's New in .Net 4.5
What's New in .Net 4.5Malam Team
 
Iterator - a powerful but underappreciated design pattern
Iterator - a powerful but underappreciated design patternIterator - a powerful but underappreciated design pattern
Iterator - a powerful but underappreciated design patternNitin Bhide
 
Entity Framework Overview
Entity Framework OverviewEntity Framework Overview
Entity Framework Overviewukdpe
 

Similar to LINQ (Language-Integrated Query) Guide (20)

Understanding LINQ in C#
Understanding LINQ in C# Understanding LINQ in C#
Understanding LINQ in C#
 
LINQ PPT.pptx
LINQ PPT.pptxLINQ PPT.pptx
LINQ PPT.pptx
 
Linq in C#
Linq in C#Linq in C#
Linq in C#
 
Linq to sql
Linq to sqlLinq to sql
Linq to sql
 
Taking a look under the hood of Apache Flink's relational APIs.
Taking a look under the hood of Apache Flink's relational APIs.Taking a look under the hood of Apache Flink's relational APIs.
Taking a look under the hood of Apache Flink's relational APIs.
 
Fabian Hueske - Taking a look under the hood of Apache Flink’s relational APIs
Fabian Hueske - Taking a look under the hood of Apache Flink’s relational APIsFabian Hueske - Taking a look under the hood of Apache Flink’s relational APIs
Fabian Hueske - Taking a look under the hood of Apache Flink’s relational APIs
 
The LINQ Between XML and Database
The LINQ Between XML and DatabaseThe LINQ Between XML and Database
The LINQ Between XML and Database
 
70487.pdf
70487.pdf70487.pdf
70487.pdf
 
LINQ in C#
LINQ in C#LINQ in C#
LINQ in C#
 
Presentation1.pptx
Presentation1.pptxPresentation1.pptx
Presentation1.pptx
 
Rajnish singh(presentation on oracle )
Rajnish singh(presentation on  oracle )Rajnish singh(presentation on  oracle )
Rajnish singh(presentation on oracle )
 
Unboxing ASP.NET Core
Unboxing ASP.NET CoreUnboxing ASP.NET Core
Unboxing ASP.NET Core
 
Dot net platform and dotnet core fundamentals
Dot net platform and dotnet core fundamentalsDot net platform and dotnet core fundamentals
Dot net platform and dotnet core fundamentals
 
The View - Leveraging Lotuscript for Database Connectivity
The View - Leveraging Lotuscript for Database ConnectivityThe View - Leveraging Lotuscript for Database Connectivity
The View - Leveraging Lotuscript for Database Connectivity
 
NoSql Data Management
NoSql Data ManagementNoSql Data Management
NoSql Data Management
 
Ow
OwOw
Ow
 
Дмитрий Тежельников «Разработка вэб-решений с использованием Asp.NET.Core и ...
Дмитрий Тежельников  «Разработка вэб-решений с использованием Asp.NET.Core и ...Дмитрий Тежельников  «Разработка вэб-решений с использованием Asp.NET.Core и ...
Дмитрий Тежельников «Разработка вэб-решений с использованием Asp.NET.Core и ...
 
What's New in .Net 4.5
What's New in .Net 4.5What's New in .Net 4.5
What's New in .Net 4.5
 
Iterator - a powerful but underappreciated design pattern
Iterator - a powerful but underappreciated design patternIterator - a powerful but underappreciated design pattern
Iterator - a powerful but underappreciated design pattern
 
Entity Framework Overview
Entity Framework OverviewEntity Framework Overview
Entity Framework Overview
 

Recently uploaded

TEST CASE GENERATION GENERATION BLOCK BOX APPROACH
TEST CASE GENERATION GENERATION BLOCK BOX APPROACHTEST CASE GENERATION GENERATION BLOCK BOX APPROACH
TEST CASE GENERATION GENERATION BLOCK BOX APPROACHSneha Padhiar
 
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor CatchersTechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catcherssdickerson1
 
multiple access in wireless communication
multiple access in wireless communicationmultiple access in wireless communication
multiple access in wireless communicationpanditadesh123
 
Industrial Applications of Centrifugal Compressors
Industrial Applications of Centrifugal CompressorsIndustrial Applications of Centrifugal Compressors
Industrial Applications of Centrifugal CompressorsAlirezaBagherian3
 
FUNCTIONAL AND NON FUNCTIONAL REQUIREMENT
FUNCTIONAL AND NON FUNCTIONAL REQUIREMENTFUNCTIONAL AND NON FUNCTIONAL REQUIREMENT
FUNCTIONAL AND NON FUNCTIONAL REQUIREMENTSneha Padhiar
 
System Simulation and Modelling with types and Event Scheduling
System Simulation and Modelling with types and Event SchedulingSystem Simulation and Modelling with types and Event Scheduling
System Simulation and Modelling with types and Event SchedulingBootNeck1
 
Python Programming for basic beginners.pptx
Python Programming for basic beginners.pptxPython Programming for basic beginners.pptx
Python Programming for basic beginners.pptxmohitesoham12
 
Computer Graphics Introduction, Open GL, Line and Circle drawing algorithm
Computer Graphics Introduction, Open GL, Line and Circle drawing algorithmComputer Graphics Introduction, Open GL, Line and Circle drawing algorithm
Computer Graphics Introduction, Open GL, Line and Circle drawing algorithmDeepika Walanjkar
 
Module-1-(Building Acoustics) Noise Control (Unit-3). pdf
Module-1-(Building Acoustics) Noise Control (Unit-3). pdfModule-1-(Building Acoustics) Noise Control (Unit-3). pdf
Module-1-(Building Acoustics) Noise Control (Unit-3). pdfManish Kumar
 
signals in triangulation .. ...Surveying
signals in triangulation .. ...Surveyingsignals in triangulation .. ...Surveying
signals in triangulation .. ...Surveyingsapna80328
 
『澳洲文凭』买麦考瑞大学毕业证书成绩单办理澳洲Macquarie文凭学位证书
『澳洲文凭』买麦考瑞大学毕业证书成绩单办理澳洲Macquarie文凭学位证书『澳洲文凭』买麦考瑞大学毕业证书成绩单办理澳洲Macquarie文凭学位证书
『澳洲文凭』买麦考瑞大学毕业证书成绩单办理澳洲Macquarie文凭学位证书rnrncn29
 
THE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTION
THE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTIONTHE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTION
THE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTIONjhunlian
 
Earthing details of Electrical Substation
Earthing details of Electrical SubstationEarthing details of Electrical Substation
Earthing details of Electrical Substationstephanwindworld
 
Engineering Drawing section of solid
Engineering Drawing     section of solidEngineering Drawing     section of solid
Engineering Drawing section of solidnamansinghjarodiya
 
Comprehensive energy systems.pdf Comprehensive energy systems.pdf
Comprehensive energy systems.pdf Comprehensive energy systems.pdfComprehensive energy systems.pdf Comprehensive energy systems.pdf
Comprehensive energy systems.pdf Comprehensive energy systems.pdfalene1
 
Immutable Image-Based Operating Systems - EW2024.pdf
Immutable Image-Based Operating Systems - EW2024.pdfImmutable Image-Based Operating Systems - EW2024.pdf
Immutable Image-Based Operating Systems - EW2024.pdfDrew Moseley
 
SOFTWARE ESTIMATION COCOMO AND FP CALCULATION
SOFTWARE ESTIMATION COCOMO AND FP CALCULATIONSOFTWARE ESTIMATION COCOMO AND FP CALCULATION
SOFTWARE ESTIMATION COCOMO AND FP CALCULATIONSneha Padhiar
 
"Exploring the Essential Functions and Design Considerations of Spillways in ...
"Exploring the Essential Functions and Design Considerations of Spillways in ..."Exploring the Essential Functions and Design Considerations of Spillways in ...
"Exploring the Essential Functions and Design Considerations of Spillways in ...Erbil Polytechnic University
 
Input Output Management in Operating System
Input Output Management in Operating SystemInput Output Management in Operating System
Input Output Management in Operating SystemRashmi Bhat
 

Recently uploaded (20)

TEST CASE GENERATION GENERATION BLOCK BOX APPROACH
TEST CASE GENERATION GENERATION BLOCK BOX APPROACHTEST CASE GENERATION GENERATION BLOCK BOX APPROACH
TEST CASE GENERATION GENERATION BLOCK BOX APPROACH
 
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor CatchersTechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
 
multiple access in wireless communication
multiple access in wireless communicationmultiple access in wireless communication
multiple access in wireless communication
 
Industrial Applications of Centrifugal Compressors
Industrial Applications of Centrifugal CompressorsIndustrial Applications of Centrifugal Compressors
Industrial Applications of Centrifugal Compressors
 
FUNCTIONAL AND NON FUNCTIONAL REQUIREMENT
FUNCTIONAL AND NON FUNCTIONAL REQUIREMENTFUNCTIONAL AND NON FUNCTIONAL REQUIREMENT
FUNCTIONAL AND NON FUNCTIONAL REQUIREMENT
 
System Simulation and Modelling with types and Event Scheduling
System Simulation and Modelling with types and Event SchedulingSystem Simulation and Modelling with types and Event Scheduling
System Simulation and Modelling with types and Event Scheduling
 
Python Programming for basic beginners.pptx
Python Programming for basic beginners.pptxPython Programming for basic beginners.pptx
Python Programming for basic beginners.pptx
 
Computer Graphics Introduction, Open GL, Line and Circle drawing algorithm
Computer Graphics Introduction, Open GL, Line and Circle drawing algorithmComputer Graphics Introduction, Open GL, Line and Circle drawing algorithm
Computer Graphics Introduction, Open GL, Line and Circle drawing algorithm
 
Module-1-(Building Acoustics) Noise Control (Unit-3). pdf
Module-1-(Building Acoustics) Noise Control (Unit-3). pdfModule-1-(Building Acoustics) Noise Control (Unit-3). pdf
Module-1-(Building Acoustics) Noise Control (Unit-3). pdf
 
signals in triangulation .. ...Surveying
signals in triangulation .. ...Surveyingsignals in triangulation .. ...Surveying
signals in triangulation .. ...Surveying
 
『澳洲文凭』买麦考瑞大学毕业证书成绩单办理澳洲Macquarie文凭学位证书
『澳洲文凭』买麦考瑞大学毕业证书成绩单办理澳洲Macquarie文凭学位证书『澳洲文凭』买麦考瑞大学毕业证书成绩单办理澳洲Macquarie文凭学位证书
『澳洲文凭』买麦考瑞大学毕业证书成绩单办理澳洲Macquarie文凭学位证书
 
THE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTION
THE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTIONTHE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTION
THE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTION
 
Earthing details of Electrical Substation
Earthing details of Electrical SubstationEarthing details of Electrical Substation
Earthing details of Electrical Substation
 
Engineering Drawing section of solid
Engineering Drawing     section of solidEngineering Drawing     section of solid
Engineering Drawing section of solid
 
Comprehensive energy systems.pdf Comprehensive energy systems.pdf
Comprehensive energy systems.pdf Comprehensive energy systems.pdfComprehensive energy systems.pdf Comprehensive energy systems.pdf
Comprehensive energy systems.pdf Comprehensive energy systems.pdf
 
Immutable Image-Based Operating Systems - EW2024.pdf
Immutable Image-Based Operating Systems - EW2024.pdfImmutable Image-Based Operating Systems - EW2024.pdf
Immutable Image-Based Operating Systems - EW2024.pdf
 
SOFTWARE ESTIMATION COCOMO AND FP CALCULATION
SOFTWARE ESTIMATION COCOMO AND FP CALCULATIONSOFTWARE ESTIMATION COCOMO AND FP CALCULATION
SOFTWARE ESTIMATION COCOMO AND FP CALCULATION
 
"Exploring the Essential Functions and Design Considerations of Spillways in ...
"Exploring the Essential Functions and Design Considerations of Spillways in ..."Exploring the Essential Functions and Design Considerations of Spillways in ...
"Exploring the Essential Functions and Design Considerations of Spillways in ...
 
Input Output Management in Operating System
Input Output Management in Operating SystemInput Output Management in Operating System
Input Output Management in Operating System
 
Designing pile caps according to ACI 318-19.pptx
Designing pile caps according to ACI 318-19.pptxDesigning pile caps according to ACI 318-19.pptx
Designing pile caps according to ACI 318-19.pptx
 

LINQ (Language-Integrated Query) Guide

  • 1. LINQ (Language-Integrated Query) Md Ariful Haque Software Engineer Desme Bangladesh
  • 2. What is LINQ • Language Integrated Query (LINQ, pronounced "link") is a Microsoft .NET Framework component that adds native data querying capabilities to .NET languages, although ports exist for Java, PHP, JavaScript, TypeScript, and ActionScript. • LINQ was released as a major part of .NET Framework 3.5 on November 19, 2007.
  • 3. Why LINQ • LINQ is a query syntax, not a language or an O/RM. You can build an O/RM on top of the syntax provided by LINQ • Familiar language to code in (C#/ VB.NET) • Easier to maintain (we have more .NET than SQL gurus on staff) • SQL generated is well structured and very optimal • Allows direct translation of business rules to SQL while still keeping all business logic in a single project
  • 5. Types of LINQ • LINQ to Objects: Provides queries on any kind of C# in-memory object, such as arrays, lists, and other collection types. • LINQ to XML: Provides creation and manipulation of XML documents using the same syntax and general query mechanism as the other LINQ varieties. • LINQ to ADO.NET: ADO.NET or Active Data Objects for .NET is an umbrella term that includes all the different classes and libraries in .NET for accessing data in databases, such as Microsoft SQL Server, Oracle, and others. LINQ to ADO.NET includes LINQ to Entities, LINQ to DataSet, and LINQ to SQL. • LINQ to Entities: The ADO.NET Entity Framework is the newest set of data interface classes in .NET 4, recommended by Microsoft for new development. • LINQ to DataSet: The DataSet object was introduced in the first version of the .NET Framework. This variety of LINQ enables legacy .NET data to be queried easily with LINQ. • LINQ to SQL: This is an alternate LINQ interface for .NET 3.5, targeted mainly at Microsoft SQL Server, that has been superseded by LINQ to Entities in .NET 4. • PLINQ: PLINQ or Parallel LINQ extends LINQ to Objects with a parallel programming library that can split up a query to execute simultaneously on a multicore processor.
  • 7. LINQ - Query Operators • Filtering Operators • Join Operators • Projection Operations • Sorting Operators • Grouping Operators • Conversions • Concatenation • Aggregation • Quantifier Operations • Partition Operations • Generation Operations • Set Operations • Equality • Element Operators
  • 9. Benefits of LINQ • These features make it easy to write accurate queries and to discover mistakes at design time. • Time consuming • Tables are automatically created into class • Columns are automatically created into properties • Relationship are automatically appeaded to classes • queries with the integrated debugger. • Lambda expressions are awesome • Data is easy to setup and use
  • 10. Disadvantages of LINQ • No clear outline for Tiers • No good way of view permissions • Small data sets will take longer to build the query than execute • There is an overhead for creating queries • When queries are moved from sql to application side, joins are very slow • DBML concurrency issues • Hard to understand advance queries using Expressions
  • 11. Advanced LINQ to SQL features • Handling concurrency • Working directly with the database using pass- through queries, stored procedures, and user defined functions • Improving the business tier with compiled queries, partial classes, partial methods, and object inheritance • Comparison of LINQ to SQL with LINQ to Entities
  • 12. Handling concurrency • System.Data.Linq.ObjectChangeConflict • System.Data.Linq.MemberChangeConflict • System.Data.Linq.ChangeConflictCollection • System.Data.Linq.ChangeConflictException • DataContext.ChangeConflicts • DataContext.SubmitChanges • DataContext.Refresh • ColumnAttribute.UpdateCheck • System.Data.Linq.Mapping.UpdateCheck • System.Data.Linq.RefreshMode
  • 13. Linq Query or Lambda expression • Lambda expression:Query Expression compiles into Method Expression
  • 14. Entity Framework vs LINQ to SQL • Entity Framework Enterprise Development. Works with Conceptual model of database. Works with all data sources. ".EDMX" is created while using Entity Framework. • LINQ Rapid Application Development. Works with objects in database. Mainly woks with SQL Server. ".dbml" is created while using LINQ to SQL.