Browse Source

Merge remote-tracking branch 'origin/nick' into frank

Frank van den Bos 2 years ago
parent
commit
99de84cd23
1 changed files with 8 additions and 3 deletions
  1. 8 3
      InABox.Database/Stores/Store.cs

+ 8 - 3
InABox.Database/Stores/Store.cs

@@ -2,6 +2,7 @@
 using System.Reflection;
 using System.Text.RegularExpressions;
 using InABox.Core;
+using NPOI.POIFS.FileSystem;
 
 namespace InABox.Database
 {
@@ -502,9 +503,7 @@ namespace InABox.Database
 
         protected virtual void BeforeSave(T entity)
         {
-            // Process any AutoIncrement Fields before we apply the Unique Code test
-            // Thus, if we have a unique autoincrement, it will be populated prior to validation
-            CheckAutoIncrement(entity);
+
 
             // Check for (a) blank code fields and (b) duplicate codes
             // There may be more than one code on an entity (why would you do this?)
@@ -570,6 +569,9 @@ namespace InABox.Database
             var changes = entity.ChangedValues();
 
             //UpdateInternalLinks(entity);
+            // Process any AutoIncrement Fields before we apply the Unique Code test
+            // Thus, if we have a unique autoincrement, it will be populated prior to validation
+            CheckAutoIncrement(entity);
 
             BeforeSave(entity);
 
@@ -674,6 +676,9 @@ namespace InABox.Database
 
             //try
             //{
+            // Process any AutoIncrement Fields before we apply the Unique Code test
+            // Thus, if we have a unique autoincrement, it will be populated prior to validation
+            CheckAutoIncrement(entities.ToArray());
 
             var changes = new Dictionary<T, string>();
             foreach (var entity in entities)