/LinqSharp

LinqSharp is a smarter linq extension. It allows you to write simpler code to generate complex queries.

Primary LanguageC#Apache License 2.0Apache-2.0

LinqSharp

Other Language: 中文


LinqSharp is an open source LINQ extension library that allows you to write simple code to generate complex queries, including query extensions and dynamic query generation.

LinqSharp.EFCore is an enhanced library for EntityFramework, providing more data annotations, database functions, and custom storage rules, etc.


LinqSharp provides enhancements to LINQ in the following ways:

LinqSharp.EFCore provides enhancements to Entity Frameowk in the following ways:

  • [no documentation yet, but have chinese version] Data annotations for table design
  • [no documentation yet] Data annotations for field standard
  • [no documentation yet] Function mapping
  • [no documentation yet] Column storage agent
  • [no documentation yet] Data calculation and audit

Supported version of Entity Framework:

  • Entity Framework Core 3.1
  • Entity Framework Core 2.1+

**Restricted supported version of Entity Framework: **

  • Entity Framework Core 3.0+ : 1 failed.

Install

You can install LinqSharp through NuGet

Package Manager

Install-Package LinqSharp
Install-Package LinqSharp.EFCore

.NET CLI

dotnet add package LinqSharp
dotnet add package LinqSharp.EFCore

Try using the sample database

Northwnd, an early sample database shipped with SQL Server, describes a simple "enterprise sales network" scenario.

The database includes a network of employees, orders, and suppliers.


The NuGet version of Northwnd is a SQLite database (Code First).

Repository:https://github.com/zmjack/Northwnd


You can install Northwnd through NuGet

Install-Package Northwnd
dotnet add package Northwnd

Then, you can try LinqSharp:

using (var context = NorthwndContext.UseSqliteResource())
{
    ...
}

For example:

using (var sqlite = NorthwndContext.UseSqliteResource())
{
    var query = sqlite.Shippers.Where(x => x.CompanyName == "Speedy Express");
    var sql = query.ToSql();
}

The variable sql is:

SELECT "x"."ShipperID", "x"."CompanyName", "x"."Phone"
FROM "Shippers" AS "x"
WHERE "x"."CompanyName" = 'Speedy Express';