Просмотр исходного кода

!482 种子数据忽略更新,防止数据被覆盖
Merge pull request !482 from skywolf627/N/A

zuohuaijun 3 лет назад
Родитель
Сommit
6a29e786eb
1 измененных файлов с 2 добавлено и 1 удалено
  1. 2 1
      Admin.NET/Admin.NET.Core/SqlSugar/SqlSugarSetup.cs

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

@@ -220,7 +220,8 @@ public static class SqlSugarSetup
             {
                 var storage = db2.CopyNew().Storageable(seedDataTable).WhereColumns(SqlSugarConst.PrimaryKey).ToStorage();
                 storage.AsInsertable.ExecuteCommand();
-                storage.AsUpdateable.ExecuteCommand();
+                var ignoreUpdate = hasDataMethod.GetCustomAttribute<IgnoreUpdateAttribute>();
+                if (ignoreUpdate == null) storage.AsUpdateable.ExecuteCommand();
             }
             else // 没有主键或者不是预定义的主键(有重复的可能)
             {