Browse Source

!479 解决pgsql中,业务模块中添加框架的种子数据时候,类映射了多个类型的问题bug(本bug是sqlsugar作者提供的解决方案)
Merge pull request !479 from MrXiaoZ/next

zuohuaijun 3 năm trước cách đây
mục cha
commit
8c299738cf
1 tập tin đã thay đổi với 3 bổ sung2 xóa
  1. 3 2
      Admin.NET/Admin.NET.Core/SqlSugar/SqlSugarSetup.cs

+ 3 - 2
Admin.NET/Admin.NET.Core/SqlSugar/SqlSugarSetup.cs

@@ -218,13 +218,14 @@ public static class SqlSugarSetup
             seedDataTable.TableName = db2.EntityMaintenance.GetEntityInfo(entityType).DbTableName;
             if (seedDataTable.Columns.Contains(SqlSugarConst.PrimaryKey))
             {
-                var storage = db2.Storageable(seedDataTable).WhereColumns(SqlSugarConst.PrimaryKey).ToStorage();
+                //解决pgsql中,业务添加框架的种子数据时候,类映射了多个类型的问题bug(本bug是sqlsugar作者提供的解决方案)
+                var storage = db2.CopyNew().Storageable(seedDataTable).WhereColumns(SqlSugarConst.PrimaryKey).ToStorage();
                 storage.AsInsertable.ExecuteCommand();
                 storage.AsUpdateable.ExecuteCommand();
             }
             else // 没有主键或者不是预定义的主键(有重复的可能)
             {
-                var storage = db2.Storageable(seedDataTable).ToStorage();
+                var storage = db2.CopyNew().Storageable(seedDataTable).ToStorage();
                 storage.AsInsertable.ExecuteCommand();
             }
         }