Skip to content

Commit

Permalink
- 补充 提交 #1936
Browse files Browse the repository at this point in the history
  • Loading branch information
2881099 committed Nov 30, 2024
1 parent 868e70e commit b9048c5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 3 additions & 3 deletions FreeSql/Internal/CommonProvider/InsertProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -631,7 +631,7 @@ string ToSqlValuesOrSelectUnionAllExtension103(bool isValues, Action<object, int
foreach (var item in atarr)
{
_source = item.ToList();
sb.Append(ToSqlValuesOrSelectUnionAllExtension103(isValues, onrowPre, onrow, true)).Append("\r\n\r\n;\r\n\r\n");
sb.Append(ToSqlValuesOrSelectUnionAllExtension103(isValues, onrowPre, onrow, true, ignoreColumn)).Append("\r\n\r\n;\r\n\r\n");
}
_source = oldSource;
if (sb.Length > 0) sb.Remove(sb.Length - 9, 9);
Expand All @@ -644,7 +644,7 @@ string ToSqlValuesOrSelectUnionAllExtension103(bool isValues, Action<object, int
foreach (var col in _table.Columns.Values)
{
//增加忽略插入的列
if (ignoreColumn != null && ignoreColumn.Contains(col.CsName)) continue;
if (ignoreColumn?.Contains(col.CsName) == true) continue;
if (col.Attribute.IsIdentity && _insertIdentity == false && string.IsNullOrEmpty(col.DbInsertValue)) continue;
if (col.Attribute.IsIdentity == false && _ignore.ContainsKey(col.Attribute.Name)) continue;

Expand All @@ -666,7 +666,7 @@ string ToSqlValuesOrSelectUnionAllExtension103(bool isValues, Action<object, int
foreach (var col in _table.Columns.Values)
{
//增加忽略插入的列
if (ignoreColumn != null && ignoreColumn.Contains(col.CsName)) continue;
if (ignoreColumn?.Contains(col.CsName) == true) continue;
if (col.Attribute.IsIdentity && _insertIdentity == false && string.IsNullOrEmpty(col.DbInsertValue)) continue;
if (col.Attribute.IsIdentity == false && _ignore.ContainsKey(col.Attribute.Name)) continue;

Expand Down
4 changes: 3 additions & 1 deletion FreeSql/Internal/UtilsExpressionTree.cs
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,9 @@ public static ColumnInfo ColumnAttributeToInfo(TableInfo trytb, object entityDef
if (common.CodeFirst.IsSyncStructureToLower) colattr.Name = colattr.Name.ToLower();
if (common.CodeFirst.IsSyncStructureToUpper) colattr.Name = colattr.Name.ToUpper();

if ((colattr.IsNullable != true || colattr.IsIdentity == true || colattr.IsPrimary == true) && colattr.DbType.Contains("NOT NULL") == false && common._orm.Ado.DataType != DataType.ClickHouse && common._orm.Ado.DataType != DataType.TDengine)
if ((colattr.IsNullable != true || colattr.IsIdentity == true || colattr.IsPrimary == true) && colattr.DbType.Contains("NOT NULL") == false &&
common._orm.Ado.DataType != DataType.ClickHouse &&
common._orm.Ado.DataType != DataType.TDengine)
{
colattr.IsNullable = false;
colattr.DbType = Regex.Replace(colattr.DbType, @"\bNULL\b", "").Trim() + " NOT NULL";
Expand Down

0 comments on commit b9048c5

Please sign in to comment.