瀏覽代碼

Moved audit trail for changed values after the Store BeforeSave()

Kenric Nugteren 1 年之前
父節點
當前提交
270af12d41
共有 2 個文件被更改,包括 4 次插入30 次删除
  1. 1 0
      InABox.Core/EntityLink.cs
  2. 3 30
      InABox.Database/Stores/Store.cs

+ 1 - 0
InABox.Core/EntityLink.cs

@@ -61,6 +61,7 @@ namespace InABox.Core
         public abstract Guid ID { get; set; }
         
         [NullEditor]
+        [Obsolete]
         public Guid Deleted { get; set; }
 
         public virtual bool Synchronise(object Entity)

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

@@ -563,31 +563,15 @@ namespace InABox.Database
 
             entity = RunScript(ScriptType.BeforeSave, new[] { entity }).First();
 
-            //OpenSession("Save", true);
-
-            //try
-            //{
-
-            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);
 
-            //OpenSession("Save", true);
-            try
-            {
-                OnSave(entity, ref auditnote);
-            }
-            catch (Exception e)
-            {
-                //CloseSession("Save", true);
-                throw e;
-            }
-            //CloseSession("Save", true);
+            var changes = entity.ChangedValues();
+            
+            OnSave(entity, ref auditnote);
 
             if (DbFactory.IsSupported<AuditTrail>())
             {
@@ -601,18 +585,7 @@ namespace InABox.Database
 
             AfterSave(entity);
 
-            //UpdateExternalLinks(entity, false);
-
             entity = RunScript(ScriptType.AfterSave, new[] { entity }).First();
-            //entity.CommitChanges();
-
-            //CloseSession("Save", false);
-            //}
-            //catch (Exception e)
-            //{
-            //	//CloseSession("Save", false);
-            //    throw new Exception(e.Message + "\n\n" + e.StackTrace + "\n");
-            //}
         }
 
         protected void AuditTrail(IEnumerable<Entity> entities, IEnumerable<string> notes)