- 修复 WithMemory 对 InsertValueSql 属性无效的问题;

This commit is contained in:
2881099
2024-02-06 03:56:47 +08:00
parent 49c89961c3
commit 91362ad07a
5 changed files with 118 additions and 103 deletions

View File

@ -264,7 +264,7 @@ namespace FreeSql.Internal.CommonProvider
return this;
}
public void WriteSourceSelectUnionAll(List<T1> source, StringBuilder sb, List<DbParameter> dbParams)
public void WriteSourceSelectUnionAll(List<T1> source, StringBuilder sb, List<DbParameter> dbParams, bool disableInsertValueSql = false)
{
if (_sourceSql != null)
{
@ -287,7 +287,7 @@ namespace FreeSql.Internal.CommonProvider
foreach (var col in _table.Columns.Values)
{
if (colidx2 > 0) sb.Append(", ");
if (string.IsNullOrEmpty(col.DbInsertValue) == false)
if (disableInsertValueSql == false && string.IsNullOrEmpty(col.DbInsertValue) == false)
sb.Append(col.DbInsertValue);
else
{

View File

@ -529,7 +529,7 @@ namespace FreeSql.Internal.CommonProvider
if (list.Any() != true) throw new Exception(CoreStrings.Cannot_Be_NULL_Name(nameof(source)));
var sb = new StringBuilder();
(_orm.InsertOrUpdate<object>().AsType(_tables[0].Table.Type) as InsertOrUpdateProvider<object>)
.WriteSourceSelectUnionAll(list, sb, _params);
.WriteSourceSelectUnionAll(list, sb, _params, true);
try { return WithSql(sb.ToString()); }
finally { sb.Clear(); }