Inkslab.Transactions 1.2.82

There is a newer version of this package available.
See the version list below for details.
dotnet add package Inkslab.Transactions --version 1.2.82
                    
NuGet\Install-Package Inkslab.Transactions -Version 1.2.82
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Inkslab.Transactions" Version="1.2.82" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Inkslab.Transactions" Version="1.2.82" />
                    
Directory.Packages.props
<PackageReference Include="Inkslab.Transactions" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Inkslab.Transactions --version 1.2.82
                    
#r "nuget: Inkslab.Transactions, 1.2.82"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Inkslab.Transactions@1.2.82
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Inkslab.Transactions&version=1.2.82
                    
Install as a Cake Addin
#tool nuget:?package=Inkslab.Transactions&version=1.2.82
                    
Install as a Cake Tool

Inkslab.Linq

高性能 .NET LINQ-to-SQL ORM 框架,支持 MySQL、SQL Server、PostgreSQL 多数据库引擎,提供类型安全的查询构建、仓储模式、事务管理和批量操作能力。

License: MIT Version .NET GitHub Issues


目录


快速开始

安装 NuGet 包

# 核心库(必选)
dotnet add package Inkslab.Linq

# 数据库适配器(选其一或多个)
dotnet add package Inkslab.Linq.MySql
dotnet add package Inkslab.Linq.SqlServer
dotnet add package Inkslab.Linq.PostgreSQL

# 事务管理(可选)
dotnet add package Inkslab.Transactions

注册服务

using Microsoft.Extensions.DependencyInjection;

// MySQL
services.UseMySql()
    .UseLinq("server=localhost;uid=root;pwd=password;database=mydb;Charset=utf8mb4;");

// SQL Server
services.UseSqlServer()
    .UseLinq("Server=localhost;Database=MyDB;Trusted_Connection=true;");

// PostgreSQL
services.UsePostgreSQL()
    .UseLinq("Host=localhost;Database=mydb;Username=postgres;Password=password;");

注册完成后,通过依赖注入获取以下服务:

服务类型 说明
IQueryable<TEntity> LINQ 查询入口
IRepository<TEntity> 仓储操作(增删改)
IDatabase 原生 SQL 执行
IDatabaseFactory 动态创建数据库实例

项目架构

解决方案结构

inkslab.linq.sln
├── src/
│   ├── Inkslab.Linq/                # 核心抽象层与 LINQ-to-SQL 翻译引擎
│   ├── Inkslab.Linq.MySql/          # MySQL 适配器(MySqlConnector)
│   ├── Inkslab.Linq.SqlServer/      # SQL Server 适配器(Microsoft.Data.SqlClient)
│   ├── Inkslab.Linq.PostgreSQL/     # PostgreSQL 适配器(Npgsql)
│   └── Inkslab.Transactions/        # 事务管理(TransactionUnit)
└── tests/
    ├── Inkslab.Linq.Tests/          # 核心测试(MySQL)
    ├── SqlServer.Tests/             # SQL Server 测试
    ├── PostgreSQL.Tests/            # PostgreSQL 测试
    └── Combination.Tests/           # 多数据库组合测试

核心组件关系

IQueryable<T> ──→ QueryProvider ──→ LINQ Expression Tree ──→ SQL
                                                              │
IRepository<T> ──→ RepositoryExecutor ──→ IDbAdapter ─────────┤
                                              │               │
IDatabase<T> ──→ DatabaseExecutor ────────────┘               │
                       │                                      ▼
                 IDbConnectionPipeline ──→ DbConnection ──→ 数据库

数据库引擎枚举

public enum DatabaseEngine
{
    SQLite = 1, MySQL = 2, SqlServer = 3, PostgreSQL = 4,
    Oracle = 5, DB2 = 6, Sybase = 7
}

📚 模块文档

完整使用文档按模块拆分如下,按需查阅:

模块 内容
实体与映射 实体注解、[Version] 规则、列值类型映射、分片表定义、Fluent API
LINQ 查询 基础/Join/子查询/分组/Union、异步方法、字符串与日期函数、IQueryable 扩展
仓储操作 插入与 PopulateIdentity 反写、更新、删除、仓储方法链
动态条件与排序 Conditions、WhereIf、Expression 组合、Ranks 动态排序
原生 SQL 与 IDatabase 查询/执行/多结果集/存储过程/ExecuteMultiple/DynamicParameter
事务与连接复用 TransactionUnit 事务、SerializableScope、批量操作
高级特性 JSON/JSONB、分片表、多数据库配置、LinqAnalyzer
LINQ 编写规则与禁令清单 LINQ → SQL 翻译的严格校验规则(AI 编码依据)
API 速查表 接口继承链、IDatabase 方法、CommandSql、异常体系、测试与构建

完整异常清单(含源码位置与原文)见 docs/LINQ与命令翻译报错规则.md


许可证

MIT License - Copyright (c) 2023 Yuanli He

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.1

    • No dependencies.
  • net6.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Inkslab.Transactions:

Package Downloads
Inkslab.Linq

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.2.83 171 6/30/2026
1.2.82 235 6/29/2026
1.2.81 250 6/10/2026
1.2.80 237 6/9/2026
1.2.78 242 5/29/2026
1.2.77 246 4/27/2026
1.2.76 227 4/22/2026
1.2.75 226 4/21/2026
1.2.74 252 4/9/2026
1.2.73 235 4/9/2026
1.2.72 241 4/8/2026
1.2.70 242 4/7/2026
1.2.69 235 4/3/2026
1.2.68 247 3/31/2026
1.2.67 255 3/27/2026
1.2.66 245 3/24/2026
1.2.65 338 3/16/2026
1.2.64 338 3/13/2026
1.2.61 246 2/24/2026
1.2.60 262 2/14/2026
Loading failed