From ea17bf3e7075d20d04d32704d02cb5df584a0d12 Mon Sep 17 00:00:00 2001
From: 2881099 <2881099@qq.com>
Date: Fri, 3 Mar 2023 16:50:30 +0800
Subject: [PATCH] =?UTF-8?q?-=20=E5=A2=9E=E5=8A=A0=20IInsertOrUpdate=20SetS?=
=?UTF-8?q?ource=20=E9=87=8D=E8=BD=BD=E6=96=B9=E6=B3=95=EF=BC=9B?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
FreeSql/Interface/Curd/IInsertOrUpdate.cs | 10 ++++++++++
.../Internal/CommonProvider/InsertOrUpdateProvider.cs | 1 +
2 files changed, 11 insertions(+)
diff --git a/FreeSql/Interface/Curd/IInsertOrUpdate.cs b/FreeSql/Interface/Curd/IInsertOrUpdate.cs
index e1ca5eff..1e019c50 100644
--- a/FreeSql/Interface/Curd/IInsertOrUpdate.cs
+++ b/FreeSql/Interface/Curd/IInsertOrUpdate.cs
@@ -36,6 +36,16 @@ namespace FreeSql
///
IInsertOrUpdate SetSource(T1 source);
///
+ /// 添加或更新,设置实体
+ ///
+ /// 实体
+ ///
+ /// 根据临时主键插入或更新,a => a.Name | a => new{a.Name,a.Time} | a => new[]{"name","time"}
+ /// 注意:不处理自增,因某些数据库依赖主键或唯一键,所以指定临时主键仅对 SqlServer/PostgreSQL/Firebird/达梦/南大通用/金仓/神通 有效
+ ///
+ ///
+ IInsertOrUpdate SetSource(T1 source, Expression> tempPrimarys);
+ ///
/// 添加或更新,设置实体集合
///
/// 实体集合
diff --git a/FreeSql/Internal/CommonProvider/InsertOrUpdateProvider.cs b/FreeSql/Internal/CommonProvider/InsertOrUpdateProvider.cs
index 557fcdf2..ed8dd94d 100644
--- a/FreeSql/Internal/CommonProvider/InsertOrUpdateProvider.cs
+++ b/FreeSql/Internal/CommonProvider/InsertOrUpdateProvider.cs
@@ -118,6 +118,7 @@ namespace FreeSql.Internal.CommonProvider
}
public IInsertOrUpdate SetSource(T1 source) => this.SetSource(new[] { source });
+ public IInsertOrUpdate SetSource(T1 source, Expression> tempPrimarys) => this.SetSource(new[] { source }, tempPrimarys);
public IInsertOrUpdate SetSource(IEnumerable source, Expression> tempPrimarys = null)
{
if (source == null || source.Any() == false) return this;