From 6ead0496ef91507968adf162408c6a3b4bcc0c26 Mon Sep 17 00:00:00 2001
From: 2881099 <2881099@qq.com>
Date: Fri, 20 Dec 2024 18:25:23 +0800
Subject: [PATCH] =?UTF-8?q?-=20=E5=A2=9E=E5=8A=A0=20ToChunkAsync=20?=
=?UTF-8?q?=E5=BC=82=E6=AD=A5=20Api=EF=BC=9B#1952?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
FreeSql/FreeSql.xml | 123 -----------
FreeSql/Interface/Curd/ISelect/ISelect2`16.cs | 43 +++-
.../SelectProvider/Select0ProviderReader.cs | 142 +++++++++++++
.../SelectProvider/Select1Provider2`16.cs | 197 ++++++++++++++++++
.../SelectProvider/T4Temp/ISelect2`16.tt | 2 +
.../T4Temp/Select1Provider2`16.tt | 13 ++
6 files changed, 395 insertions(+), 125 deletions(-)
diff --git a/FreeSql/FreeSql.xml b/FreeSql/FreeSql.xml
index c21ae6656..25f23c323 100644
--- a/FreeSql/FreeSql.xml
+++ b/FreeSql/FreeSql.xml
@@ -6376,126 +6376,3 @@
-
-
-
-
- 插入数据,传入实体集合
-
-
-
-
-
-
-
- 插入数据,传入实体集合
-
-
-
-
-
-
-
- 插入或更新数据,此功能依赖数据库特性(低版本可能不支持),参考如下:
- MySql 5.6+: on duplicate key update
- PostgreSQL 9.4+: on conflict do update
- SqlServer 2008+: merge into
- Oracle 11+: merge into
- Sqlite: replace into
- DuckDB: on conflict do update
- 达梦: merge into
- 人大金仓:on conflict do update
- 神通:merge into
- MsAccess:不支持
- 注意区别:FreeSql.Repository 仓储也有 InsertOrUpdate 方法(不依赖数据库特性)
-
-
-
-
-
-
- 修改数据
-
-
-
-
-
-
- 修改数据,传入动态条件,如:主键值 | new[]{主键值1,主键值2} | TEntity1 | new[]{TEntity1,TEntity2} | new{id=1}
-
-
- 主键值、主键值集合、实体、实体集合、匿名对象、匿名对象集合
-
-
-
-
- 查询数据
-
-
-
-
-
-
- 查询数据,传入动态条件,如:主键值 | new[]{主键值1,主键值2} | TEntity1 | new[]{TEntity1,TEntity2} | new{id=1}
-
-
- 主键值、主键值集合、实体、实体集合、匿名对象、匿名对象集合
-
-
-
-
- 删除数据
-
-
-
-
-
-
- 删除数据,传入动态条件,如:主键值 | new[]{主键值1,主键值2} | TEntity1 | new[]{TEntity1,TEntity2} | new{id=1}
-
-
- 主键值、主键值集合、实体、实体集合、匿名对象、匿名对象集合
-
-
-
-
- 开启事务(不支持异步)
- v1.5.0 关闭了线程事务超时自动提交的机制
-
- 事务体 () => {}
-
-
-
- 开启事务(不支持异步)
- v1.5.0 关闭了线程事务超时自动提交的机制
-
-
- 事务体 () => {}
-
-
-
- 数据库访问对象
-
-
-
-
- 所有拦截方法都在这里
-
-
-
-
- CodeFirst 模式开发相关方法
-
-
-
-
- DbFirst 模式开发相关方法
-
-
-
-
- 全局过滤设置,可默认附加为 Select/Update/Delete 条件
-
-
-
-
diff --git a/FreeSql/Interface/Curd/ISelect/ISelect2`16.cs b/FreeSql/Interface/Curd/ISelect/ISelect2`16.cs
index 0601093ee..a9c1214ba 100644
--- a/FreeSql/Interface/Curd/ISelect/ISelect2`16.cs
+++ b/FreeSql/Interface/Curd/ISelect/ISelect2`16.cs
@@ -1,4 +1,5 @@
-using FreeSql.Internal.Model;
+
+using FreeSql.Internal.Model;
using System;
using System.Collections.Generic;
using System.Data;
@@ -10,6 +11,12 @@ namespace FreeSql
{
+
+
+
+
+
+
public interface ISelect : ISelect0, T1> where T2 : class
{
@@ -20,6 +27,7 @@ public interface ISelect : ISelect0, T1> where T2 : clas
Task ToDataTableAsync(Expression> select, CancellationToken cancellationToken = default);
Task> ToListAsync(Expression> select, CancellationToken cancellationToken = default);
Task> ToListAsync(CancellationToken cancellationToken = default);
+ Task ToChunkAsync(Expression> select, int size, Func>, Task> done, CancellationToken cancellationToken = default);
Task ToOneAsync(Expression> select, CancellationToken cancellationToken = default);
Task FirstAsync(Expression> select, CancellationToken cancellationToken = default);
@@ -37,6 +45,7 @@ public interface ISelect : ISelect0, T1> where T2 : clas
Task InsertIntoAsync(string tableName, Expression, TTargetEntity>> select, CancellationToken cancellationToken = default) where TTargetEntity : class;
Task ToDataTableAsync(Expression, TReturn>> select, CancellationToken cancellationToken = default);
Task> ToListAsync(Expression, TReturn>> select, CancellationToken cancellationToken = default);
+ Task ToChunkAsync(Expression, TReturn>> select, int size, Func>, Task> done, CancellationToken cancellationToken = default);
Task ToOneAsync(Expression, TReturn>> select, CancellationToken cancellationToken = default);
Task FirstAsync(Expression, TReturn>> select, CancellationToken cancellationToken = default);
@@ -139,6 +148,7 @@ public interface ISelect : ISelect0, T1> where T
Task ToDataTableAsync(Expression> select, CancellationToken cancellationToken = default);
Task> ToListAsync(Expression> select, CancellationToken cancellationToken = default);
Task> ToListAsync(CancellationToken cancellationToken = default);
+ Task ToChunkAsync(Expression> select, int size, Func>, Task> done, CancellationToken cancellationToken = default);
Task ToOneAsync(Expression> select, CancellationToken cancellationToken = default);
Task FirstAsync(Expression> select, CancellationToken cancellationToken = default);
@@ -156,6 +166,7 @@ public interface ISelect : ISelect0, T1> where T
Task InsertIntoAsync(string tableName, Expression, TTargetEntity>> select, CancellationToken cancellationToken = default) where TTargetEntity : class;
Task ToDataTableAsync(Expression, TReturn>> select, CancellationToken cancellationToken = default);
Task> ToListAsync(Expression, TReturn>> select, CancellationToken cancellationToken = default);
+ Task ToChunkAsync(Expression, TReturn>> select, int size, Func>, Task> done, CancellationToken cancellationToken = default);
Task ToOneAsync(Expression, TReturn>> select, CancellationToken cancellationToken = default);
Task FirstAsync(Expression, TReturn>> select, CancellationToken cancellationToken = default);
@@ -258,6 +269,7 @@ public interface ISelect : ISelect0, T1>
Task ToDataTableAsync(Expression> select, CancellationToken cancellationToken = default);
Task> ToListAsync(Expression> select, CancellationToken cancellationToken = default);
Task> ToListAsync(CancellationToken cancellationToken = default);
+ Task ToChunkAsync(Expression> select, int size, Func>, Task> done, CancellationToken cancellationToken = default);
Task ToOneAsync(Expression> select, CancellationToken cancellationToken = default);
Task FirstAsync(Expression> select, CancellationToken cancellationToken = default);
@@ -275,6 +287,7 @@ public interface ISelect : ISelect0, T1>
Task InsertIntoAsync(string tableName, Expression, TTargetEntity>> select, CancellationToken cancellationToken = default) where TTargetEntity : class;
Task ToDataTableAsync(Expression, TReturn>> select, CancellationToken cancellationToken = default);
Task> ToListAsync(Expression, TReturn>> select, CancellationToken cancellationToken = default);
+ Task ToChunkAsync(Expression, TReturn>> select, int size, Func>, Task> done, CancellationToken cancellationToken = default);
Task ToOneAsync(Expression, TReturn>> select, CancellationToken cancellationToken = default);
Task FirstAsync(Expression, TReturn>> select, CancellationToken cancellationToken = default);
@@ -377,6 +390,7 @@ public interface ISelect : ISelect0 ToDataTableAsync(Expression> select, CancellationToken cancellationToken = default);
Task> ToListAsync(Expression> select, CancellationToken cancellationToken = default);
Task> ToListAsync(CancellationToken cancellationToken = default);
+ Task ToChunkAsync(Expression> select, int size, Func>, Task> done, CancellationToken cancellationToken = default);
Task ToOneAsync(Expression> select, CancellationToken cancellationToken = default);
Task FirstAsync(Expression> select, CancellationToken cancellationToken = default);
@@ -394,6 +408,7 @@ public interface ISelect : ISelect0 InsertIntoAsync(string tableName, Expression, TTargetEntity>> select, CancellationToken cancellationToken = default) where TTargetEntity : class;
Task ToDataTableAsync(Expression, TReturn>> select, CancellationToken cancellationToken = default);
Task> ToListAsync(Expression, TReturn>> select, CancellationToken cancellationToken = default);
+ Task ToChunkAsync(Expression, TReturn>> select, int size, Func>, Task> done, CancellationToken cancellationToken = default);
Task ToOneAsync(Expression, TReturn>> select, CancellationToken cancellationToken = default);
Task FirstAsync(Expression, TReturn>> select, CancellationToken cancellationToken = default);
@@ -496,6 +511,7 @@ public interface ISelect : ISelect0 ToDataTableAsync(Expression> select, CancellationToken cancellationToken = default);
Task> ToListAsync(Expression> select, CancellationToken cancellationToken = default);
Task> ToListAsync(CancellationToken cancellationToken = default);
+ Task ToChunkAsync(Expression> select, int size, Func>, Task> done, CancellationToken cancellationToken = default);
Task ToOneAsync(Expression> select, CancellationToken cancellationToken = default);
Task FirstAsync(Expression> select, CancellationToken cancellationToken = default);
@@ -513,6 +529,7 @@ public interface ISelect : ISelect0 InsertIntoAsync(string tableName, Expression, TTargetEntity>> select, CancellationToken cancellationToken = default) where TTargetEntity : class;
Task ToDataTableAsync(Expression, TReturn>> select, CancellationToken cancellationToken = default);
Task> ToListAsync(Expression, TReturn>> select, CancellationToken cancellationToken = default);
+ Task ToChunkAsync(Expression, TReturn>> select, int size, Func>, Task> done, CancellationToken cancellationToken = default);
Task ToOneAsync(Expression, TReturn>> select, CancellationToken cancellationToken = default);
Task FirstAsync(Expression, TReturn>> select, CancellationToken cancellationToken = default);
@@ -615,6 +632,7 @@ public interface ISelect : ISelect0 ToDataTableAsync(Expression> select, CancellationToken cancellationToken = default);
Task> ToListAsync(Expression> select, CancellationToken cancellationToken = default);
Task> ToListAsync(CancellationToken cancellationToken = default);
+ Task ToChunkAsync(Expression> select, int size, Func>, Task> done, CancellationToken cancellationToken = default);
Task ToOneAsync(Expression> select, CancellationToken cancellationToken = default);
Task FirstAsync(Expression> select, CancellationToken cancellationToken = default);
@@ -632,6 +650,7 @@ public interface ISelect : ISelect0 InsertIntoAsync(string tableName, Expression, TTargetEntity>> select, CancellationToken cancellationToken = default) where TTargetEntity : class;
Task ToDataTableAsync(Expression, TReturn>> select, CancellationToken cancellationToken = default);
Task> ToListAsync(Expression, TReturn>> select, CancellationToken cancellationToken = default);
+ Task ToChunkAsync(Expression, TReturn>> select, int size, Func>, Task> done, CancellationToken cancellationToken = default);
Task ToOneAsync(Expression, TReturn>> select, CancellationToken cancellationToken = default);
Task FirstAsync(Expression, TReturn>> select, CancellationToken cancellationToken = default);
@@ -734,6 +753,7 @@ public interface ISelect : ISelect0 ToDataTableAsync(Expression> select, CancellationToken cancellationToken = default);
Task> ToListAsync(Expression> select, CancellationToken cancellationToken = default);
Task> ToListAsync(CancellationToken cancellationToken = default);
+ Task ToChunkAsync(Expression> select, int size, Func>, Task> done, CancellationToken cancellationToken = default);
Task ToOneAsync(Expression> select, CancellationToken cancellationToken = default);
Task FirstAsync(Expression> select, CancellationToken cancellationToken = default);
@@ -751,6 +771,7 @@ public interface ISelect : ISelect0 InsertIntoAsync(string tableName, Expression, TTargetEntity>> select, CancellationToken cancellationToken = default) where TTargetEntity : class;
Task ToDataTableAsync(Expression