Language Integrated Query
Encyclopedia
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
and JavaScript
.
LINQ defines a set of method names (called standard query operators, or standard sequence operators), along with translation rules from so-called query expressions to expressions using these method names, lambda expressions and anonymous types.
These can, for example, be used to project and filter data in arrays, enumerable class
es, XML
(LINQ to XML), relational database
s, and third party data sources. Other uses, which utilize query expressions as a general framework for readably composing arbitrary computations, include the construction of event handlers or monadic parsers
.
Many of the concepts that LINQ has introduced were originally tested in Microsoft's Cω research project. LINQ was released as a part of .NET Framework 3.5 on November 19, 2007.
The set of query operator
s defined by LINQ is exposed to the user as the Standard Query Operator API. The query operators supported by the API are:
Select:
The Select operator performs a projection on the collection to select
interesting aspects of the elements.
The user supplies an arbitrary function, as a delegate
or lambda expression
, which projects the data members.
Where:
The Where operator allows the definition of a set of predicate rules that are evaluated for each object in the collection, while objects that do not match the rule are filtered away. The predicate is supplied to the operator as a delegate.
SelectMany:
For a user-provided mapping from collection elements to collections, semantically two steps are performed. First, every element is mapped to its corresponding collection. Second, the result of the first step is flattened by one level. Note: Select and Filter are both implementable in terms of SelectMany, as long as singleton and empty collections are available. The translation rules mentioned above still make it mandatory for a LINQ provider to provide the other two operators.
Sum / Min / Max / Average:
These operators optionally take a lambda that retrieves a certain numeric value from each element in the collection and uses it to find the sum, minimum, maximum or average values of all the elements in the collection, respectively. Overloaded versions take no lambda and act as if the identity is given as the lambda.
Aggregate:
A generalized Sum / Min / Max. This operator takes a lambda that specifies how two values are combined to form an intermediate or the final result. Optionally, a starting value can be supplied, enabling the result type of the aggregation to be arbitrary. Furthermore, a finalization function, taking the aggregation result to yet another value, can be supplied.
Join / GroupJoin: The Join operator performs an inner join on two collections, based on matching keys for objects in each collection. It takes two functions as delegates, one for each collection, that it executes on each object in the collection to extract the key from the object. It also takes another delegate via which the user specifies which data elements, from the two matched elements, should be used to create the resultant object. The GroupJoin operator performs a group join. Like the Select operator, the results of a join are instantiations of a different class, with all the data members of both the types of the source objects, or a subset of them.
Take / TakeWhile: The Take operator selects the first n objects from a collection, while the TakeWhile operator, which takes a predicate, selects those objects that match the predicate.
Skip / SkipWhile: The Skip and SkipWhile operators are complements of Take and TakeWhile - they skip the first n objects from a collection, or those objects that match a predicate (for the case of SkipWhile).
OfType: The OfType operator is used to select the elements of a certain type.
Concat: The Concat operator concatenates
two collections.
OrderBy / ThenBy: The OrderBy operator is used to specify the primary sort ordering of the elements in a collection according to some key. The default ordering is in ascending order, to reverse the order, the OrderByDescending operator is to be used. ThenBy and ThenByDescending specifies subsequent ordering of the elements. The function to extract the key value from the object is specified by the user as a delegate.
Reverse: The Reverse operator reverses a collection.
GroupBy: The GroupBy operator takes a delegate that extracts a key value and returns a collection of
Distinct: The Distinct operator removes duplicate instances of a key value from a collection. The function to retrieve the key value is to be supplied as a delegate.
Union / Intersect / Except: These operators are used to perform a union
, intersection
and difference
operation on two sequences, respectively.
SequenceEqual: The SequenceEqual operator determines whether all elements in two collections are equal and in the same order.
First / FirstOrDefault / Last / LastOrDefault: These operators take a predicate. The First operator returns the first element for which the predicate yields true or throws an exception, if nothing matches. The FirstOrDefault operator is like the First operator except that it returns the default value for the element type (usually a null reference) in case nothing matches the predicate. The last operator retrieves the last element to match the predicate, or throws an exception in case nothing matches. The LastOrDefault returns the default element value, if nothing matches.
Single: The Single operator takes a predicate and returns the element that matches the predicate. An exception is thrown, if none or more than one element match the predicate.
ElementAt: The ElementAt operator retrieves the element at a given index in the collection.
Any / All / Contains: The Any operator checks, if there are any elements in the collection matching the predicate. It does not select the element, but returns true for a match. The All operator checks, if all elements match the predicate. The Contains operator checks, if the collection contains a given value.
Count: The Count operator counts the number of elements in the given collection.
The Standard Query Operator API also specifies certain operators that convert a collection into another type:
and provide syntactic sugar
for writing queries. These language extensions have initially been implemented in C# 3.0, VB 9.0 and Oxygene, with other languages like F# and Nemerle having announced preliminary support. The language extensions include:
For example, in the query to select all the objects in a collection with
the types of variables result, c and results all are inferred by the compiler in accordance to the signatures of the methods eventually used. The basis for choosing the methods is formed by the query expression-free translation result
The expression trees are at the core of the LINQ extensibility mechanism, by which LINQ can be adapted for many data sources. The expression trees are handed over to LINQ Providers, which are data source-specific implementations that adapt the LINQ queries to be used with the data source. If they choose so, the LINQ Providers analyze the expression trees contained in a query in order to generate essential pieces needed for the execution of a query. This can be SQL fragments or any other completely different representation of code as further manipulatable data.
LINQ comes with LINQ Providers for in-memory object collections, SQL Server databases, ADO.NET
datasets and XML documents. These different providers define the different flavors of LINQ:
databases. Since SQL Server data may reside on a remote server, and because SQL Server has its own query engine, LINQ to SQL does not use the query engine of LINQ. Instead, it converts a LINQ query to a SQL
query that is then sent to SQL Server for processing. However, since SQL Server stores the data as relational data
and LINQ works with data encapsulated in objects, the two representations must be mapped
to one another. For this reason, LINQ to SQL also defines a mapping framework. The mapping is done by defining classes that correspond to the tables in the database, and containing all or a subset of the columns in the table as data members. The correspondence, along with other relational model
attributes such as primary keys, are specified using LINQ to SQL-defined attributes
. For example,
This class definition maps to a table named
, as well as allow manual editing to create a different view by using only a subset of the tables or columns in a table.
The mapping is implemented by the
s on the server. Any changes to the result set are tracked and can be submitted back to the database server.
databases; to support any generic database, LINQ also includes the LINQ to DataSets, which uses ADO.NET to handle the communication with the database. Once the data is in ADO.NET Datasets, LINQ to DataSets execute queries against these datasets.
LINQ to XML and LINQ to SQL performance compared to ADO.NET depends on the use case.
execution engine for LINQ queries. It defines the
Microsoft
Microsoft Corporation is an American public multinational corporation headquartered in Redmond, Washington, USA that develops, manufactures, licenses, and supports a wide range of products and services predominantly related to computing through its various product divisions...
.NET Framework
.NET Framework
The .NET Framework is a software framework that runs primarily on Microsoft Windows. It includes a large library and supports several programming languages which allows language interoperability...
component that adds native data querying
Query language
Query languages are computer languages used to make queries into databases and information systems.Broadly, query languages can be classified according to whether they are database query languages or information retrieval query languages...
capabilities to .NET languages, although ports exist for Java
Java (programming language)
Java is a programming language originally developed by James Gosling at Sun Microsystems and released in 1995 as a core component of Sun Microsystems' Java platform. The language derives much of its syntax from C and C++ but has a simpler object model and fewer low-level facilities...
, PHP
PHP
PHP is a general-purpose server-side scripting language originally designed for web development to produce dynamic web pages. For this purpose, PHP code is embedded into the HTML source document and interpreted by a web server with a PHP processor module, which generates the web page document...
and JavaScript
JavaScript
JavaScript is a prototype-based scripting language that is dynamic, weakly typed and has first-class functions. It is a multi-paradigm language, supporting object-oriented, imperative, and functional programming styles....
.
LINQ defines a set of method names (called standard query operators, or standard sequence operators), along with translation rules from so-called query expressions to expressions using these method names, lambda expressions and anonymous types.
These can, for example, be used to project and filter data in arrays, enumerable class
Class (computer science)
In object-oriented programming, a class is a construct that is used as a blueprint to create instances of itself – referred to as class instances, class objects, instance objects or simply objects. A class defines constituent members which enable these class instances to have state and behavior...
es, XML
XML
Extensible Markup Language is a set of rules for encoding documents in machine-readable form. It is defined in the XML 1.0 Specification produced by the W3C, and several other related specifications, all gratis open standards....
(LINQ to XML), relational database
Relational database
A relational database is a database that conforms to relational model theory. The software used in a relational database is called a relational database management system . Colloquial use of the term "relational database" may refer to the RDBMS software, or the relational database itself...
s, and third party data sources. Other uses, which utilize query expressions as a general framework for readably composing arbitrary computations, include the construction of event handlers or monadic parsers
Parsing
In computer science and linguistics, parsing, or, more formally, syntactic analysis, is the process of analyzing a text, made of a sequence of tokens , to determine its grammatical structure with respect to a given formal grammar...
.
Many of the concepts that LINQ has introduced were originally tested in Microsoft's Cω research project. LINQ was released as a part of .NET Framework 3.5 on November 19, 2007.
Standard Query Operators
In what follows, the descriptions of the operators are based on the application of working with collections.The set of query operator
Operator (programming)
Programming languages typically support a set of operators: operations which differ from the language's functions in calling syntax and/or argument passing mode. Common examples that differ by syntax are mathematical arithmetic operations, e.g...
s defined by LINQ is exposed to the user as the Standard Query Operator API. The query operators supported by the API are:
Select:
The Select operator performs a projection on the collection to select
interesting aspects of the elements.
The user supplies an arbitrary function, as a delegate
Delegate (.NET)
A delegate is a form of type-safe function pointer used by the .NET Framework. Delegates specify a method to call and optionally an object to call the method on. They are used, among other things, to implement callbacks and event listeners....
or lambda expression
Lambda expression
Lambda expression may refer to:*Anonymous function*Lambda calculus#Definition...
, which projects the data members.
Where:
The Where operator allows the definition of a set of predicate rules that are evaluated for each object in the collection, while objects that do not match the rule are filtered away. The predicate is supplied to the operator as a delegate.
SelectMany:
For a user-provided mapping from collection elements to collections, semantically two steps are performed. First, every element is mapped to its corresponding collection. Second, the result of the first step is flattened by one level. Note: Select and Filter are both implementable in terms of SelectMany, as long as singleton and empty collections are available. The translation rules mentioned above still make it mandatory for a LINQ provider to provide the other two operators.
Sum / Min / Max / Average:
These operators optionally take a lambda that retrieves a certain numeric value from each element in the collection and uses it to find the sum, minimum, maximum or average values of all the elements in the collection, respectively. Overloaded versions take no lambda and act as if the identity is given as the lambda.
Aggregate:
A generalized Sum / Min / Max. This operator takes a lambda that specifies how two values are combined to form an intermediate or the final result. Optionally, a starting value can be supplied, enabling the result type of the aggregation to be arbitrary. Furthermore, a finalization function, taking the aggregation result to yet another value, can be supplied.
Join / GroupJoin: The Join operator performs an inner join on two collections, based on matching keys for objects in each collection. It takes two functions as delegates, one for each collection, that it executes on each object in the collection to extract the key from the object. It also takes another delegate via which the user specifies which data elements, from the two matched elements, should be used to create the resultant object. The GroupJoin operator performs a group join. Like the Select operator, the results of a join are instantiations of a different class, with all the data members of both the types of the source objects, or a subset of them.
Take / TakeWhile: The Take operator selects the first n objects from a collection, while the TakeWhile operator, which takes a predicate, selects those objects that match the predicate.
Skip / SkipWhile: The Skip and SkipWhile operators are complements of Take and TakeWhile - they skip the first n objects from a collection, or those objects that match a predicate (for the case of SkipWhile).
OfType: The OfType operator is used to select the elements of a certain type.
Concat: The Concat operator concatenates
Concatenation
In computer programming, string concatenation is the operation of joining two character strings end-to-end. For example, the strings "snow" and "ball" may be concatenated to give "snowball"...
two collections.
OrderBy / ThenBy: The OrderBy operator is used to specify the primary sort ordering of the elements in a collection according to some key. The default ordering is in ascending order, to reverse the order, the OrderByDescending operator is to be used. ThenBy and ThenByDescending specifies subsequent ordering of the elements. The function to extract the key value from the object is specified by the user as a delegate.
Reverse: The Reverse operator reverses a collection.
GroupBy: The GroupBy operator takes a delegate that extracts a key value and returns a collection of
IGrouping
objects, for each distinct key value. The IGrouping
objects can then be used to enumerate all the objects for a particular key value.Distinct: The Distinct operator removes duplicate instances of a key value from a collection. The function to retrieve the key value is to be supplied as a delegate.
Union / Intersect / Except: These operators are used to perform a union
Union (set theory)
In set theory, the union of a collection of sets is the set of all distinct elements in the collection. The union of a collection of sets S_1, S_2, S_3, \dots , S_n\,\! gives a set S_1 \cup S_2 \cup S_3 \cup \dots \cup S_n.- Definition :...
, intersection
Intersection (set theory)
In mathematics, the intersection of two sets A and B is the set that contains all elements of A that also belong to B , but no other elements....
and difference
Complement (set theory)
In set theory, a complement of a set A refers to things not in , A. The relative complement of A with respect to a set B, is the set of elements in B but not in A...
operation on two sequences, respectively.
SequenceEqual: The SequenceEqual operator determines whether all elements in two collections are equal and in the same order.
First / FirstOrDefault / Last / LastOrDefault: These operators take a predicate. The First operator returns the first element for which the predicate yields true or throws an exception, if nothing matches. The FirstOrDefault operator is like the First operator except that it returns the default value for the element type (usually a null reference) in case nothing matches the predicate. The last operator retrieves the last element to match the predicate, or throws an exception in case nothing matches. The LastOrDefault returns the default element value, if nothing matches.
Single: The Single operator takes a predicate and returns the element that matches the predicate. An exception is thrown, if none or more than one element match the predicate.
ElementAt: The ElementAt operator retrieves the element at a given index in the collection.
Any / All / Contains: The Any operator checks, if there are any elements in the collection matching the predicate. It does not select the element, but returns true for a match. The All operator checks, if all elements match the predicate. The Contains operator checks, if the collection contains a given value.
Count: The Count operator counts the number of elements in the given collection.
The Standard Query Operator API also specifies certain operators that convert a collection into another type:
- AsEnumerable: converts the collection to
IEnumerable
type. - AsQueryable: converts the collection to
IQueryable
type. - ToArray: converts the collection to an array.
- ToList: converts the collection to
IList
type. - ToDictionary: converts the collection to
IDictionary
type, indexed by the key K. - ToLookup: converts the collection to
ILookup
type, indexed by the key K. - Cast: converts a non-generic
IEnumerable
collection to one ofIEnumerable
by casting each element to typeT
. Throws an exception for incompatible types. - OfType: converts a non-generic
IEnumerable
collection to one ofIEnumerable
. Only elements of typeT
are included.
Language extensions
While LINQ is primarily implemented as a library for .NET Framework 3.5, it also defines optional language extensions that make queries a first-class language constructLanguage construct
A language construct is a syntactically allowable part of a program that may be formed from one or more lexical tokens in accordance with the rules of a programming language....
and provide syntactic sugar
Syntactic sugar
Syntactic sugar is a computer science term that refers to syntax within a programming language that is designed to make things easier to read or to express....
for writing queries. These language extensions have initially been implemented in C# 3.0, VB 9.0 and Oxygene, with other languages like F# and Nemerle having announced preliminary support. The language extensions include:
- Query syntax: A language is free to choose a query syntax that it will recognize natively. These language keywords must be translated by the compiler to appropriate LINQ method calls.
- Implicitly typed variables: This enhancement allows variables to be declared without specifying their types. The languages C# 3.0 and Oxygene declare them with the
var
keyword. In VB9.0, theDim
keyword without type declaration accomplishes the same. Such objects are still strongly typed; for these objects the compiler infers the types of variables via type inferenceType inferenceType inference refers to the automatic deduction of the type of an expression in a programming language. If some, but not all, type annotations are already present it is referred to as type reconstruction....
, which allows the results of the queries to be specified and defined without declaring the type of the intermediate variables. - Anonymous typeAnonymous typeAnonymous types are a feature of C# 3.0, Visual Basic .NET 9.0, and Oxygene that allows data types to encapsulate a set of properties into a single object without having to first explicitly define a type. This is an important feature for the SQL-like LINQ feature that is integrated into C# and VB.net...
s: Anonymous types allow classes that contain only data-member declarations to be inferred by the compiler. This is useful for the Select and Join operators, whose result types may differ from the types of the original objects. The compiler uses type inference to determine the fields contained in the classes and generates accessors and mutatorsMutator methodIn computer science, a mutator method is a method used to control changes to a variable.The mutator method, sometimes called a "setter", is most often used in object-oriented programming, in keeping with the principle of encapsulation...
for these fields. - Object Initializer: Object initializers allow an object to be created and initialized in a single scope, as required for Select and Join operators.
- Lambda expressions: Lambda expressions denote delegates or expression trees, allowing predicates and extraction functions to be written inline with queries.
For example, in the query to select all the objects in a collection with
SomeProperty
less than 10,the types of variables result, c and results all are inferred by the compiler in accordance to the signatures of the methods eventually used. The basis for choosing the methods is formed by the query expression-free translation result
LINQ Providers
The C# 3.0 specification defines a so-called Query Expression Pattern along with translation rules from a LINQ expression to an expression in a subset of C# 3.0 without LINQ expressions. The translation thus defined is actually un-typed, which, in addition to lambda expressions being interpretable as either delegates or expression trees, allows for a great degree of flexibility for libraries wishing to expose parts of their interface as LINQ expression clauses. For example, LINQ to Objects works onIEnumerable
s and with delegates, whereas LINQ to SQL makes use of the expression trees.The expression trees are at the core of the LINQ extensibility mechanism, by which LINQ can be adapted for many data sources. The expression trees are handed over to LINQ Providers, which are data source-specific implementations that adapt the LINQ queries to be used with the data source. If they choose so, the LINQ Providers analyze the expression trees contained in a query in order to generate essential pieces needed for the execution of a query. This can be SQL fragments or any other completely different representation of code as further manipulatable data.
LINQ comes with LINQ Providers for in-memory object collections, SQL Server databases, ADO.NET
ADO.NET
ADO.NET is a set of computer software components that programmers can use to access data and data services. It is a part of the base class library that is included with the Microsoft .NET Framework. It is commonly used by programmers to access and modify data stored in relational database systems,...
datasets and XML documents. These different providers define the different flavors of LINQ:
LINQ to Objects
The LINQ to Objects provider is used for in-memory collections, using the local query execution engine of LINQ. The code generated by this provider refers to the implementation of the standard query operators as defined on theSequence
pattern and allows IEnumerable
collections to be queried locally. Current implementation of LINQ to Objects uses e.g. O(n) linear search for simple lookups, and is not optimised for complex queries.LINQ to XML (formerly called XLINQ)
The LINQ to XML provider converts an XML document to a collection ofXElement
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.LINQ to SQL (formerly called DLINQ)
The LINQ to SQL provider allows LINQ to be used to query SQL Server databases, including SQL Server CompactSQL Server Compact
Microsoft SQL Server Compact is a compact relational database produced by Microsoft for applications that run on mobile devices and desktops. Prior to the introduction of the desktop platform, it was known as SQL Server for Windows CE and SQL Server Mobile Edition...
databases. Since SQL Server data may reside on a remote server, and because SQL Server has its own query engine, LINQ to SQL does not use the query engine of LINQ. Instead, it converts a LINQ query to a SQL
SQL
SQL is a programming language designed for managing data in relational database management systems ....
query that is then sent to SQL Server for processing. However, since SQL Server stores the data as relational data
Relational database
A relational database is a database that conforms to relational model theory. The software used in a relational database is called a relational database management system . Colloquial use of the term "relational database" may refer to the RDBMS software, or the relational database itself...
and LINQ works with data encapsulated in objects, the two representations must be mapped
Object-relational mapping
Object-relational mapping in computer software is a programming technique for converting data between incompatible type systems in object-oriented programming languages. This creates, in effect, a "virtual object database" that can be used from within the programming language...
to one another. For this reason, LINQ to SQL also defines a mapping framework. The mapping is done by defining classes that correspond to the tables in the database, and containing all or a subset of the columns in the table as data members. The correspondence, along with other relational model
Relational model
The relational model for database management is a database model based on first-order predicate logic, first formulated and proposed in 1969 by Edgar F...
attributes such as primary keys, are specified using LINQ to SQL-defined attributes
Attribute (computing)
In computing, an attribute is a specification that defines a property of an object, element, or file. It may also refer to or set the specific value for a given instance of such....
. For example,
This class definition maps to a table named
Customers
and the two data members correspond to two columns. The classes must be defined before LINQ to SQL can be used. Visual Studio 2008 includes a mapping designer that can be used to create the mapping between the data schemas in the object as well as the relational domain. It can automatically create the corresponding classes from a database schemaDatabase schema
A database schema of a database system is its structure described in a formal language supported by the database management system and refers to the organization of data to create a blueprint of how a database will be constructed...
, as well as allow manual editing to create a different view by using only a subset of the tables or columns in a table.
The mapping is implemented by the
DataContext
that takes a connection string to the server, and can be used to generate a Table
where T is the type to which the database table will be mapped. The Table
encapsulates the data in the table, and implements the IQueryable
interface, so that the expression tree is created, which the LINQ to SQL provider handles. It converts the query into T-SQL and retrieves the result set from the database server. Since the processing happens at the database server, local methods, which are not defined as a part of the lambda expressions representing the predicates, cannot be used. However, it can use the stored procedureStored procedure
A stored procedure is a subroutine available to applications that access a relational database system. A stored procedure is actually stored in the database data dictionary.Typical uses for stored procedures include data validation or access control mechanisms...
s on the server. Any changes to the result set are tracked and can be submitted back to the database server.
LINQ to DataSets
The LINQ to SQL provider works only with Microsoft SQL ServerMicrosoft SQL Server
Microsoft SQL Server is a relational database server, developed by Microsoft: It is a software product whose primary function is to store and retrieve data as requested by other software applications, be it those on the same computer or those running on another computer across a network...
databases; to support any generic database, LINQ also includes the LINQ to DataSets, which uses ADO.NET to handle the communication with the database. Once the data is in ADO.NET Datasets, LINQ to DataSets execute queries against these datasets.
Other providers
The LINQ providers can be implemented by third parties for various data sources as well. Several database server specific providers are available from the database vendors. Some of the popular providers include:- Data ServicesADO.NET Data ServicesWCF Data Services is a platform for what Microsoft calls Data Services. It is actually a combination of the runtime and a web service through which the services are exposed. In addition, it also includes the Data Services Toolkit which lets Astoria Data Services be created from within ASP.NET itself...
: LINQ to ADO.NET Data Services - dotConnectDevart (company)Devart is a software development company founded in 1998. It delivers native connectivity solutions, development and administration tools for Oracle, SQL Server, MySQL, PostgreSQL, InterBase, Firebird, and SQLite databases...
: LINQ to OracleOracle DatabaseThe Oracle Database is an object-relational database management system produced and marketed by Oracle Corporation....
, MySQLMySQLMySQL officially, but also commonly "My Sequel") is a relational database management system that runs as a server providing multi-user access to a number of databases. It is named after developer Michael Widenius' daughter, My...
, PostgreSQLPostgreSQLPostgreSQL, often simply Postgres, is an object-relational database management system available for many platforms including Linux, FreeBSD, Solaris, MS Windows and Mac OS X. It is released under the PostgreSQL License, which is an MIT-style license, and is thus free and open source software...
, and SQLiteSQLiteSQLite is an ACID-compliant embedded relational database management system contained in a relatively small C programming library. The source code for SQLite is in the public domain and implements most of the SQL standard... - Entity FrameworkADO.NET Entity FrameworkADO.NET Entity Framework is an object-relational mapping framework for the .NET Framework.-Overview:ADO.NET Entity Framework abstracts the relational schema of the data that is stored in a database and presents its conceptual schema to the application...
: LINQ to Entities - SSAS Entity Framework Provider: LINQ to OLAPOLAPIn computing, online analytical processing, or OLAP , is an approach to swiftly answer multi-dimensional analytical queries. OLAP is part of the broader category of business intelligence, which also encompasses relational reporting and data mining...
cubes in SSASMicrosoft Analysis ServicesMicrosoft SQL Server Analysis Services is part of Microsoft SQL Server, a database management system. Microsoft has included a number of services in SQL Server related to business intelligence and data warehousing. These services include Integration Services and Analysis Services...
. - Windows SearchWindows SearchWindows Search is an indexed desktop search platform released by Microsoft for the Windows operating system....
: LINQ to System Search - Google searchGoogleGoogle Inc. is an American multinational public corporation invested in Internet search, cloud computing, and advertising technologies. Google hosts and develops a number of Internet-based services and products, and generates profit primarily from advertising through its AdWords program...
: LINQ to Google - DbLinq: LINQ to MySQLMySQLMySQL officially, but also commonly "My Sequel") is a relational database management system that runs as a server providing multi-user access to a number of databases. It is named after developer Michael Widenius' daughter, My...
, PostgreSQLPostgreSQLPostgreSQL, often simply Postgres, is an object-relational database management system available for many platforms including Linux, FreeBSD, Solaris, MS Windows and Mac OS X. It is released under the PostgreSQL License, which is an MIT-style license, and is thus free and open source software...
, OracleOracle DatabaseThe Oracle Database is an object-relational database management system produced and marketed by Oracle Corporation....
, Ingres, SQLiteSQLiteSQLite is an ACID-compliant embedded relational database management system contained in a relatively small C programming library. The source code for SQLite is in the public domain and implements most of the SQL standard...
and Microsoft SQL ServerMicrosoft SQL ServerMicrosoft SQL Server is a relational database server, developed by Microsoft: It is a software product whose primary function is to store and retrieve data as requested by other software applications, be it those on the same computer or those running on another computer across a network... - NHibernateNHibernate- External links :*** *NuGet...
:- LINQ to NHibernate contribution project
- Native LINQ support in the upcoming 3.0 release based on re-linq
- DataObjects.NETDataObjects.NETDataObjects.Net is a persistence and object-relational mapping framework for the Microsoft .NET Framework. It allows the developer to define the business logic directly in one of the .NET languages like C#. The persistent objects can be retrieved by LINQ queries...
: LINQ to DataObjects.NET - LLBLGen ProLLBLGen ProLLBLGen Pro is an O/R mapper and code generator for the Microsoft .NET platform, created by . Computer programmers and software architects use this software to create a data-access tier and business objects tier in C# or VB.NET for several O/R mapping frameworks, like NHibernate, Entity Framework,...
: LINQ to LLBLGen - OpenMapi: LINQ to MAPI
- CSVCSVCSV may refer to:* Clerics of Saint Viator* Common Stored Value Ticket* Confederación Sudamericana de Voleibol* Character Strengths and Virtues* Christian Social People's Party* Community Service Volunteers...
: LINQ to CSV - TwitterTwitterTwitter is an online social networking and microblogging service that enables its users to send and read text-based posts of up to 140 characters, informally known as "tweets".Twitter was created in March 2006 by Jack Dorsey and launched that July...
: LINQ to Twitter - db4oDb4odb4o is an embeddable open source object database for Java and .NET developers. It is developed, commercially licensed and supported by Versant....
: LINQ to db4o - WikipediaWikipediaWikipedia is a free, web-based, collaborative, multilingual encyclopedia project supported by the non-profit Wikimedia Foundation. Its 20 million articles have been written collaboratively by volunteers around the world. Almost all of its articles can be edited by anyone with access to the site,...
: LINQ to Wikipedia - LINQ to XSD: LINQ to XML Schema
Performance
Some benchmark on simple use cases tend to show that LINQ to Objects performance has a large overhead compared to normal operationLINQ to XML and LINQ to SQL performance compared to ADO.NET depends on the use case.
PLINQ
Version 4 of the .NET framework includes PLINQ, or Parallel LINQ, a parallelParallel computing
Parallel computing is a form of computation in which many calculations are carried out simultaneously, operating on the principle that large problems can often be divided into smaller ones, which are then solved concurrently . There are several different forms of parallel computing: bit-level,...
execution engine for LINQ queries. It defines the
IParallelEnumerable
interface. If the source collection implements this interface, the parallel execution engine is invoked. The PLINQ engine can execute parts of a query concurrently on multiple threads, providing faster results.Other language implementations
- Saffron is an extension to Java incorporating SQL-like relational expressions. Relations can be in-memory collections, database tables, or other data sources. It was developed independently of LINQ in 2001 by Julian Hyde, who later authored the Mondrian OLAP serverMondrian OLAP serverMondrian is an open source OLAP server,written in Java.It supports the MDX query languageand the XML for Analysis and interface specifications.It reads from SQL and other data sources...
. - jLinq jLinq is a fully extensible Javascript library that allows you to perform LINQ style queries on arrays of object.
- JSINQ is Kai Jäger's JavaScript implementation of LINQ to Objects. Also provides a compiler that translates LINQ-style query expressions into JavaScript code.
- JSLINQ JSLINQ is yet another Javascript library that allows you to perform LINQ style queries on data.
- Chris Pietschmann's LINQ to JavaScript is a LINQ implementation that extends JavaScriptJavaScriptJavaScript is a prototype-based scripting language that is dynamic, weakly typed and has first-class functions. It is a multi-paradigm language, supporting object-oriented, imperative, and functional programming styles....
's Array object with LINQ capabilities. - PHPLinq is Maarten Balliauw's PHPPHPPHP is a general-purpose server-side scripting language originally designed for web development to produce dynamic web pages. For this purpose, PHP code is embedded into the HTML source document and interpreted by a web server with a PHP processor module, which generates the web page document...
implementation of LINQ. - Quaere is a JavaJava (programming language)Java is a programming language originally developed by James Gosling at Sun Microsystems and released in 1995 as a core component of Sun Microsystems' Java platform. The language derives much of its syntax from C and C++ but has a simpler object model and fewer low-level facilities...
implementation of LINQ. - JaQue is a typesafe JavaJava (programming language)Java is a programming language originally developed by James Gosling at Sun Microsystems and released in 1995 as a core component of Sun Microsystems' Java platform. The language derives much of its syntax from C and C++ but has a simpler object model and fewer low-level facilities...
implementation of LINQ. - JaQu a JavaJava (programming language)Java is a programming language originally developed by James Gosling at Sun Microsystems and released in 1995 as a core component of Sun Microsystems' Java platform. The language derives much of its syntax from C and C++ but has a simpler object model and fewer low-level facilities...
implementation of LINQ. - Querydsl is a typesafe JavaJava (programming language)Java is a programming language originally developed by James Gosling at Sun Microsystems and released in 1995 as a core component of Sun Microsystems' Java platform. The language derives much of its syntax from C and C++ but has a simpler object model and fewer low-level facilities...
implementation of LINQ. - SBQL4J is a JavaJava (programming language)Java is a programming language originally developed by James Gosling at Sun Microsystems and released in 1995 as a core component of Sun Microsystems' Java platform. The language derives much of its syntax from C and C++ but has a simpler object model and fewer low-level facilities...
extension with capabilities of LINQ, based on Stack-Based Approach. It provides type safe queries to Java with powerful engine. - hxLINQ is a haXeHaXehaXe is a versatile open-source high-level multiplatform programming language described on its website as a "universal language".It can produce:* Flash applications and games* Multi-platform client-side web applications* Apache CGI web applications...
port of Chris Pietschmann's LINQ to JavaScript. - asq is a PythonPython (programming language)Python is a general-purpose, high-level programming language whose design philosophy emphasizes code readability. Python claims to "[combine] remarkable power with very clear syntax", and its standard library is large and comprehensive...
implementation of LINQ-to-objects and Parallel LINQ-to-objects (PLINQ). - Embarcadero Prism, also known as Delphi Prism, supports LINQ.
External links
- Official Microsoft LINQ Project
- 101 C# LINQ Samples
- 101 Visual Basic LINQ Samples
- LINQ to XML Documentation
- Microsoft LINQ forum
- LINQ to Objects for the .NET developer
- LINQ page on NetFXGuide.com
- LINQ wiki
- LINQ books
- Continuous LINQ
- LINQ To Sharepoint
- LINQ To Active Directory
- LINQ for Novell.Directory.Ldap
- LinqToWikipedia
- LINQ Tutorials and Active Articles
- Looking to LINQ - Will Microsoft's Language Integrated Query transform programmatic data access?
- Obtics (Observable Object LINQ)
- LINQ to SNMP
- Different Ways Of Retrieving Data From Collections
- Future of LINQ to SQL
- LINQ Exchange - Learn LINQ and Lambda Expressions
- MoreLINQ - Extensions to LINQ to Objects by Jon Skeet
- 50 LINQ Examples, Tips and How To's