mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-06-19 20:38:16 +08:00
- 优化 BulkCopy 默认插入自增键;
- 优化 BulkCopy 对可空类型的属性处理;#227
This commit is contained in:
@ -31,7 +31,7 @@ public static class FreeSqlMySqlConnectorGlobalExtensions
|
||||
var insert = that as FreeSql.MySql.Curd.MySqlInsert<T>;
|
||||
if (insert == null) throw new Exception("ExecuteMySqlBulkCopy 是 FreeSql.Provider.MySqlConnector 特有的功能");
|
||||
|
||||
var dt = that.ToDataTable();
|
||||
var dt = that.InsertIdentity().ToDataTable();
|
||||
if (dt.Rows.Count == 0) return;
|
||||
|
||||
Action<MySqlBulkCopy> writeToServer = bulkCopy =>
|
||||
@ -90,7 +90,7 @@ public static class FreeSqlMySqlConnectorGlobalExtensions
|
||||
var insert = that as FreeSql.MySql.Curd.MySqlInsert<T>;
|
||||
if (insert == null) throw new Exception("ExecuteMySqlBulkCopyAsync 是 FreeSql.Provider.MySqlConnector 特有的功能");
|
||||
|
||||
var dt = that.ToDataTable();
|
||||
var dt = that.InsertIdentity().ToDataTable();
|
||||
if (dt.Rows.Count == 0) return;
|
||||
|
||||
Func<MySqlBulkCopy, Task> writeToServer = bulkCopy =>
|
||||
|
@ -52,7 +52,7 @@ public static partial class FreeSqlPostgreSQLGlobalExtensions
|
||||
var insert = that as FreeSql.PostgreSQL.Curd.PostgreSQLInsert<T>;
|
||||
if (insert == null) throw new Exception("ExecutePgCopy 是 FreeSql.Provider.PostgreSQL 特有的功能");
|
||||
|
||||
var dt = that.ToDataTable();
|
||||
var dt = that.InsertIdentity().ToDataTable();
|
||||
if (dt.Rows.Count == 0) return;
|
||||
|
||||
Action<NpgsqlConnection> binaryImport = conn =>
|
||||
@ -124,7 +124,7 @@ public static partial class FreeSqlPostgreSQLGlobalExtensions
|
||||
var insert = that as FreeSql.PostgreSQL.Curd.PostgreSQLInsert<T>;
|
||||
if (insert == null) throw new Exception("ExecutePgCopyAsync 是 FreeSql.Provider.PostgreSQL 特有的功能");
|
||||
|
||||
var dt = that.ToDataTable();
|
||||
var dt = that.InsertIdentity().ToDataTable();
|
||||
if (dt.Rows.Count == 0) return;
|
||||
Func<NpgsqlConnection, Task> binaryImportAsync = async conn =>
|
||||
{
|
||||
|
@ -70,7 +70,7 @@ public static partial class FreeSqlSqlServerGlobalExtensions
|
||||
var insert = that as FreeSql.SqlServer.Curd.SqlServerInsert<T>;
|
||||
if (insert == null) throw new Exception("ExecuteSqlBulkCopy 是 FreeSql.Provider.SqlServer 特有的功能");
|
||||
|
||||
var dt = that.ToDataTable();
|
||||
var dt = that.InsertIdentity().ToDataTable();
|
||||
if (dt.Rows.Count == 0) return;
|
||||
|
||||
Action<SqlBulkCopy> writeToServer = bulkCopy =>
|
||||
@ -145,7 +145,7 @@ public static partial class FreeSqlSqlServerGlobalExtensions
|
||||
var insert = that as FreeSql.SqlServer.Curd.SqlServerInsert<T>;
|
||||
if (insert == null) throw new Exception("ExecuteSqlBulkCopyAsync 是 FreeSql.Provider.SqlServer 特有的功能");
|
||||
|
||||
var dt = that.ToDataTable();
|
||||
var dt = that.InsertIdentity().ToDataTable();
|
||||
if (dt.Rows.Count == 0) return;
|
||||
|
||||
Func<SqlBulkCopy, Task> writeToServerAsync = bulkCopy =>
|
||||
|
Reference in New Issue
Block a user