Language-Integrated Query (LINQ) is the name for a set of technologies based on the integration of query capabilities directly into the C# language.
- Traditionally, queries against data are expressed as simple strings without type checking at compile time or IntelliSense support.
- Furthermore, you have to learn a different query language for each type of data source: SQL databases, XML documents, various Web services, etc.
You can write LINQ queries in C# for SQL Server databases, XML documents, ADO.NET Datasets, and any collection of objects that supports IEnumerable or the generic IEnumerable
In this article, we will discuss the top 10 LINQ libraries, or you can say the most useful libraries which are used in 2017.
1. Remotion.Linq By FabianSchmied
A foundation for parsing LINQ expression trees and generating queries in SQL or other languages. With re-linq, it's now easier than ever to create full-featured LINQ providers. It is used by Entity Framework 7 and NHibernate.
- Transforms expression trees into abstract syntax trees resembling LINQ query expressions
- Simplifies many aspects of this tree (subqueries, transparent identifiers, pre-evaluation, etc.)
- Provides basic infrastructure for backend development (e.g., SQL generation)
- Provides a framework for user-defined query extensions and transformations
For further details, you can visit https://github.com/re-motion/Relinq
2. LinqKit By bigsan
LINQKit is a free library providing a set of extensions for LINQ to SQL and EntityFramework power users. It comprises the following:
- An extensible implementation of AsExpandable()
- A public expression visitor base class (ExpressionVisitor)
- Linq.Expr and Linq.Func shortcut methods
With LINQKit, you can:
- Plug expressions into EntitySets and EntityCollections
- Use expression variables in subqueries
- · Combine expressions (have one expression call another)
- Dynamically build predicates
- Leverage AsExpandable to add your extensions.
For further details, you can visit https://github.com/scottksmith95/LINQKit
3. MoreLINQ By raboof
LINQ to Objects is missing a few desirable features. This project enhances LINQ to Objects with extra methods, in a manner which keeps to the spirit of LINQ.
For further details, you can visit https://github.com/morelinq/MoreLINQ
4. LinqToTwitter By joemayo
LINQ to Twitter is an open source 3rd party LINQ Provider (Twitter Library) for the Twitter micro-blogging service. It uses standard LINQ syntax for queries and includes method calls for changes via the Twitter API.
5. LinqToExcel By paulyoder
- LinqToExcel is a .Net library that allows you to query Excel spreadsheets using the LINQ syntax.
- The default query expects the first row to be the header row containing column names that match the property names on the generic class being used. It also assumes the data to be in the worksheet named "Sheet1".
- To query a worksheet with a different name, pass the worksheet name in as an argument.
6. LinqToCsv By msony
Popular, easy to use library to read and write CSV and tab delimited files.
- Supports data fields containing commas and line breaks.
- Supports different character encodings, separator characters and date and number formats.
- Robust error handling lets you quickly fix problems in large input files.
7. linq2db By Igor Tkachev
LINQ to DB is the fastest LINQ database access library offering a simple, light, fast, and type-safe layer between your POCO objects and your database.
- Architecturally it is one step above micro-ORMs like Dapper, Massive, or PetaPoco, in that you work with LINQ expressions, not with magic strings, while maintaining a thin abstraction layer between your code and the database.
- The C# compiler checks your queries and allows for easy refactoring.
- However, it's not as heavy as LINQ to SQL or Entity Framework.
- There is no change-tracking, so you have to manage that yourself, but on the plus side, you get more control and faster access to your data.
For further details, you can visit https://linq2db.github.io/
8. Linq2Couchbase By couchbase
The official Language Integrated Query (LINQ) provider for querying Couchbase Server 4.0 with N1QL using the Couchbase .NET SDK.
- The goal of Linq2Couchbase is to create a lightweight ORM/ODM for querying Couchbase Buckets using LINQ as the lingua-franca between your application and Couchbase Server 4.0 using N1QL, a SQL-like query language for JSON documents.
- It also provides a write API for performing CRUD operations on JSON documents.
For further details, you can visit https://github.com/couchbaselabs/Linq2Couchbase
9. Serialize.Linq By esskar >
Serialize.Linq is a c# library for serializing LINQ expressions. Formats it supports (but it is not limited to) are JSON, XML, and BINARY.
For further details, you can visit https://github.com/esskar/Serialize.Linq
10. Shaolinq By tumtumtum
Shaolinq is a powerful ORM and Linq provider for C# and .NET. It provides a thoughtful, fast and powerful alternative to Linq to SQL and the Entity Framework.
- Top class LINQ support with everything entity framework supports and beyond
- First class composite primary key support
- Fully configurable naming by convention using attributes or configuration
- Full support for async/await that goes beyond what's possible with the Entity Framework
For further details, you can visit https://github.com/tumtumtum/Shaolinq