diff --git a/devdocs/todo.txt b/devdocs/todo.txt index c272c067..62712d1d 100644 --- a/devdocs/todo.txt +++ b/devdocs/todo.txt @@ -38,7 +38,6 @@ TEST CHANGES TODO: REFACTOR GetNoLogAsync function is used in many places redundantly when the logging version could do the same thing but not log it with an optional bool switch so refactor that shit TODO: REFACTOR biz objects have two creates, an async and sync one, WTF is that about? See if can make it just one async version. - DO CLIENT STUFF NOW COME BACK TO THIS STUFF LATER TODO: the license being logged breaks the format of the log file because it has line breaks etc, so instead, maybe log out as a single line (remove breaks) diff --git a/server/AyaNova/Controllers/AttachmentController.cs b/server/AyaNova/Controllers/AttachmentController.cs index 989a7135..6cc84d3c 100644 --- a/server/AyaNova/Controllers/AttachmentController.cs +++ b/server/AyaNova/Controllers/AttachmentController.cs @@ -233,7 +233,7 @@ namespace AyaNova.Api.Controllers }); //EVENT LOG - EventLogProcessor.LogEventToDatabase(new Event(UserId, attachToObject.ObjectId, attachToObject.ObjectType, AyaEvent.AttachmentCreate, v.DisplayFileName), ct); + EventLogProcessor.LogEventToDatabaseAndSaveEntireContext(new Event(UserId, attachToObject.ObjectId, attachToObject.ObjectType, AyaEvent.AttachmentCreate, v.DisplayFileName), ct); //SEARCH INDEXING // Search.ProcessNewObjectKeywords( UserLocaleIdFromContext.Id(HttpContext.Items), v.Id, AyaType.FileAttachment, v.DisplayFileName, v.DisplayFileName, v.Notes, v.StoredFileName); @@ -306,7 +306,7 @@ namespace AyaNova.Api.Controllers FileUtil.deleteFileAttachment(dbObj, ct); //Event log process delete - EventLogProcessor.LogEventToDatabase(new Event(UserId, dbObj.AttachToObjectId, dbObj.AttachToObjectType, AyaEvent.AttachmentDelete, dbObj.DisplayFileName), ct); + EventLogProcessor.LogEventToDatabaseAndSaveEntireContext(new Event(UserId, dbObj.AttachToObjectId, dbObj.AttachToObjectType, AyaEvent.AttachmentDelete, dbObj.DisplayFileName), ct); //Delete search index Search.ProcessDeletedObjectKeywords(dbObj.Id, AyaType.FileAttachment); @@ -388,7 +388,7 @@ namespace AyaNova.Api.Controllers } //Log - EventLogProcessor.LogEventToDatabase(new Event(UserId, dbObj.AttachToObjectId, dbObj.AttachToObjectType, AyaEvent.AttachmentDownload, dbObj.DisplayFileName), ct); + EventLogProcessor.LogEventToDatabaseAndSaveEntireContext(new Event(UserId, dbObj.AttachToObjectId, dbObj.AttachToObjectType, AyaEvent.AttachmentDownload, dbObj.DisplayFileName), ct); return PhysicalFile(filePath, mimetype, dbObj.DisplayFileName); diff --git a/server/AyaNova/Controllers/LicenseController.cs b/server/AyaNova/Controllers/LicenseController.cs index 1afe5f96..7115a491 100644 --- a/server/AyaNova/Controllers/LicenseController.cs +++ b/server/AyaNova/Controllers/LicenseController.cs @@ -128,7 +128,7 @@ namespace AyaNova.Api.Controllers } var ret = AyaNova.Core.License.LicenseInfoAsJson; //Log - EventLogProcessor.LogEventToDatabase(new Event(UserIdFromContext.Id(HttpContext.Items), 0, AyaType.License, AyaEvent.LicenseFetch), ct); + EventLogProcessor.LogEventToDatabaseAndSaveEntireContext(new Event(UserIdFromContext.Id(HttpContext.Items), 0, AyaType.License, AyaEvent.LicenseFetch), ct); return Ok(ApiOkResponse.Response(ret, true)); } @@ -180,7 +180,7 @@ namespace AyaNova.Api.Controllers var ret = Core.License.RequestTrial(requestData.EmailAddress, requestData.RegisteredTo, log); //Log - EventLogProcessor.LogEventToDatabase(new Event(UserIdFromContext.Id(HttpContext.Items), 0, AyaType.License, AyaEvent.LicenseTrialRequest), ct); + EventLogProcessor.LogEventToDatabaseAndSaveEntireContext(new Event(UserIdFromContext.Id(HttpContext.Items), 0, AyaType.License, AyaEvent.LicenseTrialRequest), ct); return Ok(ApiOkResponse.Response(ret, true)); } diff --git a/server/AyaNova/Controllers/MetricsController.cs b/server/AyaNova/Controllers/MetricsController.cs index aee2bfd9..3efa733b 100644 --- a/server/AyaNova/Controllers/MetricsController.cs +++ b/server/AyaNova/Controllers/MetricsController.cs @@ -69,7 +69,7 @@ namespace AyaNova.Api.Controllers string sResult = await GetTheMetrics("plain"); //Log - EventLogProcessor.LogEventToDatabase(new Event(UserIdFromContext.Id(HttpContext.Items), 0, AyaType.Metrics, AyaEvent.Retrieved), ct); + EventLogProcessor.LogEventToDatabaseAndSaveEntireContext(new Event(UserIdFromContext.Id(HttpContext.Items), 0, AyaType.Metrics, AyaEvent.Retrieved), ct); return Content(sResult); } @@ -100,7 +100,7 @@ namespace AyaNova.Api.Controllers JObject json = JObject.Parse(sResult); //Log - EventLogProcessor.LogEventToDatabase(new Event(UserIdFromContext.Id(HttpContext.Items), 0, AyaType.Metrics, AyaEvent.Retrieved), ct); + EventLogProcessor.LogEventToDatabaseAndSaveEntireContext(new Event(UserIdFromContext.Id(HttpContext.Items), 0, AyaType.Metrics, AyaEvent.Retrieved), ct); return Ok(ApiOkResponse.Response(json, true)); } diff --git a/server/AyaNova/Controllers/ServerStateController.cs b/server/AyaNova/Controllers/ServerStateController.cs index fcebc552..5a133910 100644 --- a/server/AyaNova/Controllers/ServerStateController.cs +++ b/server/AyaNova/Controllers/ServerStateController.cs @@ -96,7 +96,7 @@ namespace AyaNova.Api.Controllers serverState.SetState(desiredState, state.Reason); //Log - EventLogProcessor.LogEventToDatabase(new Event(UserIdFromContext.Id(HttpContext.Items), 0, AyaType.ServerState, AyaEvent.ServerStateChange, $"{state.ServerState}-{state.Reason}"), ct); + EventLogProcessor.LogEventToDatabaseAndSaveEntireContext(new Event(UserIdFromContext.Id(HttpContext.Items), 0, AyaType.ServerState, AyaEvent.ServerStateChange, $"{state.ServerState}-{state.Reason}"), ct); return NoContent(); } diff --git a/server/AyaNova/Controllers/TrialController.cs b/server/AyaNova/Controllers/TrialController.cs index 529cd424..f2968534 100644 --- a/server/AyaNova/Controllers/TrialController.cs +++ b/server/AyaNova/Controllers/TrialController.cs @@ -104,7 +104,7 @@ namespace AyaNova.Api.Controllers JobsBiz.AddJob(j, ct); //Log - EventLogProcessor.LogEventToDatabase(new Event(UserIdFromContext.Id(HttpContext.Items), 0, AyaType.TrialSeeder, AyaEvent.Created, size), ct); + EventLogProcessor.LogEventToDatabaseAndSaveEntireContext(new Event(UserIdFromContext.Id(HttpContext.Items), 0, AyaType.TrialSeeder, AyaEvent.Created, size), ct); return Accepted(new { JobId = j.GId });//202 accepted } diff --git a/server/AyaNova/DataList/AyaDataList.cs b/server/AyaNova/DataList/AyaDataList.cs index 8e0ccc88..eddb8997 100644 --- a/server/AyaNova/DataList/AyaDataList.cs +++ b/server/AyaNova/DataList/AyaDataList.cs @@ -77,6 +77,44 @@ namespace AyaNova.DataList return sb.ToString(); } + + //make sure the template parses and all the fields specified are really existant + //this is more for dev errors or api users becuase the client shouldn't generate bad templates + public bool ValidateTemplate(string template) + { + try + { + //parse the template + var jtemplate = JObject.Parse(template); + var fullFields = ((JArray)jtemplate["full"]).ToObject(); + var miniFields = ((JArray)jtemplate["mini"]).ToObject(); + + foreach (string s in fullFields) + { + AyaDataListFieldDefinition o = FieldDefinitions.FirstOrDefault(x => x.FieldKey == s); + if (o == null) + { + return false; + } + } + + foreach (string s in miniFields) + { + AyaDataListFieldDefinition o = FieldDefinitions.FirstOrDefault(x => x.FieldKey == s); + if (o == null) + { + return false; + } + } + } + catch + { + return false; + } + + return true; + } + }//eoc }//eons \ No newline at end of file diff --git a/server/AyaNova/DataList/DataListFetcher.cs b/server/AyaNova/DataList/DataListFetcher.cs index 9fa459c8..287fc0fa 100644 --- a/server/AyaNova/DataList/DataListFetcher.cs +++ b/server/AyaNova/DataList/DataListFetcher.cs @@ -32,19 +32,19 @@ namespace AyaNova.DataList } //FETCH DATALISTTEMPLATE HERE OR USE DEFAULT IF FAULTY OR NOT FOUND - //start with default - string JSONDataListTemplate=DataList.DefaultDataListDisplayTemplate; + string JSONDataListTemplate = DataList.DefaultDataListDisplayTemplate; var CustomDataListTemplate = await ct.DataListTemplate.FirstOrDefaultAsync(x => x.DataListKey == listOptions.DataListKey); - //Null is expected unless user has created a new one - if(CustomDataListTemplate!=null){ - //todo: validate the template first here need a new method to do that - //Assuming it's valid then use it - JSONDataListTemplate = CustomDataListTemplate.Template; + //Null is expected unless user has created a custom one + if (CustomDataListTemplate != null) + { + //Make sure it's valid, if not then don't use it + if (DataList.ValidateTemplate(CustomDataListTemplate.Template)) + JSONDataListTemplate = CustomDataListTemplate.Template; } - - + + //PARSE THE TEMPLATE INTO A STRING ARRAY //SO WE KNOW WHICH FIELDS TO RETURN FROM QUERY diff --git a/server/AyaNova/DataList/IAyaDataList.cs b/server/AyaNova/DataList/IAyaDataList.cs index 61b3b898..86f1d140 100644 --- a/server/AyaNova/DataList/IAyaDataList.cs +++ b/server/AyaNova/DataList/IAyaDataList.cs @@ -25,6 +25,8 @@ namespace AyaNova.DataList string GenerateMINIListColumnsJSON(); string GenerateListColumnsJSONFromTemplate(string template); + bool ValidateTemplate(string template); + } diff --git a/server/AyaNova/biz/DataListFilterBiz.cs b/server/AyaNova/biz/DataListFilterBiz.cs index 3be8938e..c85edf1a 100644 --- a/server/AyaNova/biz/DataListFilterBiz.cs +++ b/server/AyaNova/biz/DataListFilterBiz.cs @@ -71,7 +71,7 @@ namespace AyaNova.Biz //Handle child and associated items: //EVENT LOG - EventLogProcessor.LogEventToDatabase(new Event(UserId, outObj.Id, BizType, AyaEvent.Created), ct); + EventLogProcessor.LogEventToDatabaseAndSaveEntireContext(new Event(UserId, outObj.Id, BizType, AyaEvent.Created), ct); //SEARCH INDEXING // Search.ProcessNewObjectKeywords(UserLocaleId, outObj.Id, BizType, outObj.Name, outObj.Name); @@ -101,7 +101,7 @@ namespace AyaNova.Biz //Handle child and associated items: //EVENT LOG - EventLogProcessor.LogEventToDatabase(new Event(UserId, outObj.Id, BizType, AyaEvent.Created), TempContext); + EventLogProcessor.LogEventToDatabaseAndSaveEntireContext(new Event(UserId, outObj.Id, BizType, AyaEvent.Created), TempContext); //SEARCH INDEXING // Search.ProcessNewObjectKeywords(UserLocaleId, outObj.Id, BizType, outObj.Name, outObj.Name); @@ -122,7 +122,7 @@ namespace AyaNova.Biz if (ret != null) { //Log - EventLogProcessor.LogEventToDatabase(new Event(UserId, fetchId, BizType, AyaEvent.Retrieved), ct); + EventLogProcessor.LogEventToDatabaseAndSaveEntireContext(new Event(UserId, fetchId, BizType, AyaEvent.Retrieved), ct); } return ret; } @@ -173,7 +173,7 @@ namespace AyaNova.Biz return false; //Log modification - EventLogProcessor.LogEventToDatabase(new Event(UserId, dbObj.Id, BizType, AyaEvent.Modified), ct); + EventLogProcessor.LogEventToDatabaseAndSaveEntireContext(new Event(UserId, dbObj.Id, BizType, AyaEvent.Modified), ct); //Update keywords // Search.ProcessUpdatedObjectKeywords(UserLocaleId, dbObj.Id, BizType, dbObj.Name, dbObj.Name); diff --git a/server/AyaNova/biz/DataListTemplateBiz.cs b/server/AyaNova/biz/DataListTemplateBiz.cs index 1e7b7128..74b76572 100644 --- a/server/AyaNova/biz/DataListTemplateBiz.cs +++ b/server/AyaNova/biz/DataListTemplateBiz.cs @@ -1,6 +1,5 @@ using System.Linq; using System.Threading.Tasks; -using System.Collections.Generic; using Microsoft.EntityFrameworkCore; using Newtonsoft.Json.Linq; using AyaNova.Util; @@ -57,7 +56,7 @@ namespace AyaNova.Biz if (log) { //Log - EventLogProcessor.LogEventToDatabase(new Event(UserId, ret.Id, BizType, AyaEvent.Retrieved), ct); + EventLogProcessor.LogEventToDatabaseAndSaveEntireContext(new Event(UserId, ret.Id, BizType, AyaEvent.Retrieved), ct); } return ret; } @@ -83,7 +82,7 @@ namespace AyaNova.Biz return false; //Log modification - EventLogProcessor.LogEventToDatabase(new Event(UserId, dbObj.Id, BizType, AyaEvent.Modified), ct); + EventLogProcessor.LogEventToDatabaseAndSaveEntireContext(new Event(UserId, dbObj.Id, BizType, AyaEvent.Modified), ct); return true; } @@ -106,7 +105,7 @@ namespace AyaNova.Biz //Delete sibling objects //Event log process delete - EventLogProcessor.DeleteObject(UserId, BizType, dbObj.Id, dbObj.Name, ct); + EventLogProcessor.DeleteObject(UserId, BizType, dbObj.Id, dbObj.DataListKey, ct); ct.SaveChanges(); //Delete search index diff --git a/server/AyaNova/biz/EventLogProcessor.cs b/server/AyaNova/biz/EventLogProcessor.cs index 71c9f9c6..c30b4cf7 100644 --- a/server/AyaNova/biz/EventLogProcessor.cs +++ b/server/AyaNova/biz/EventLogProcessor.cs @@ -13,7 +13,7 @@ namespace AyaNova.Biz { internal static class EventLogProcessor { - + /// /// Add an entry to the log /// @@ -21,13 +21,13 @@ namespace AyaNova.Biz /// /// /// - internal static void LogEventToDatabase(Event newEvent, AyContext ct) + internal static void LogEventToDatabaseAndSaveEntireContext(Event newEvent, AyContext ct) { - ct.Event.Add(newEvent); - ct.SaveChanges(); + ct.Event.Add(newEvent); + ct.SaveChanges(); } - + /// /// Handle delete @@ -41,7 +41,7 @@ namespace AyaNova.Biz internal static void DeleteObject(long userId, AyaType ayType, long ayId, string textra, AyContext ct) { ct.Database.ExecuteSqlInterpolated($"delete from aevent where aytype = {ayType} and ayid={ayId}"); - ct.Event.Add(new Event(userId, ayId, ayType, AyaEvent.Deleted, textra)); + ct.Event.Add(new Event(userId, ayId, ayType, AyaEvent.Deleted, textra)); } /// diff --git a/server/AyaNova/biz/FormCustomBiz.cs b/server/AyaNova/biz/FormCustomBiz.cs index 4fba77fa..2f3c8945 100644 --- a/server/AyaNova/biz/FormCustomBiz.cs +++ b/server/AyaNova/biz/FormCustomBiz.cs @@ -71,7 +71,7 @@ namespace AyaNova.Biz //Handle child and associated items: //EVENT LOG - EventLogProcessor.LogEventToDatabase(new Event(UserId, outObj.Id, BizType, AyaEvent.Created), ct); + EventLogProcessor.LogEventToDatabaseAndSaveEntireContext(new Event(UserId, outObj.Id, BizType, AyaEvent.Created), ct); //SEARCH INDEXING // Search.ProcessNewObjectKeywords(UserLocaleId, outObj.Id, BizType, outObj.Name, outObj.Name); @@ -141,7 +141,7 @@ namespace AyaNova.Biz dbObj.Template = JsonUtil.CompactJson(dbObj.Template); //Log modification - EventLogProcessor.LogEventToDatabase(new Event(UserId, dbObj.Id, BizType, AyaEvent.Modified), ct); + EventLogProcessor.LogEventToDatabaseAndSaveEntireContext(new Event(UserId, dbObj.Id, BizType, AyaEvent.Modified), ct); //Update keywords // Search.ProcessUpdatedObjectKeywords(UserLocaleId, dbObj.Id, BizType, dbObj.Name, dbObj.Name); diff --git a/server/AyaNova/biz/ImportAyaNova7Biz.cs b/server/AyaNova/biz/ImportAyaNova7Biz.cs index 5ae6e5a9..5113cc70 100644 --- a/server/AyaNova/biz/ImportAyaNova7Biz.cs +++ b/server/AyaNova/biz/ImportAyaNova7Biz.cs @@ -349,9 +349,9 @@ namespace AyaNova.Biz //handle EventLog entries for users now that we have the user's created //Created - EventLogProcessor.LogEventToDatabase(new Event(Creator, RavenId, ayaType, AyaEvent.Created, Created), ct); + EventLogProcessor.LogEventToDatabaseAndSaveEntireContext(new Event(Creator, RavenId, ayaType, AyaEvent.Created, Created), ct); //MODIFIED - EventLogProcessor.LogEventToDatabase(new Event(Modifier, RavenId, ayaType, AyaEvent.Modified, Modified), ct); + EventLogProcessor.LogEventToDatabaseAndSaveEntireContext(new Event(Modifier, RavenId, ayaType, AyaEvent.Modified, Modified), ct); } diff --git a/server/AyaNova/biz/LocaleBiz.cs b/server/AyaNova/biz/LocaleBiz.cs index d7a5e6ab..1a2f36f8 100644 --- a/server/AyaNova/biz/LocaleBiz.cs +++ b/server/AyaNova/biz/LocaleBiz.cs @@ -77,7 +77,7 @@ namespace AyaNova.Biz ct.Locale.Add(NewLocale); await ct.SaveChangesAsync(); //Log - EventLogProcessor.LogEventToDatabase(new Event(UserId, NewLocale.Id, AyaType.Locale, AyaEvent.Created), ct); + EventLogProcessor.LogEventToDatabaseAndSaveEntireContext(new Event(UserId, NewLocale.Id, AyaType.Locale, AyaEvent.Created), ct); return NewLocale; } @@ -242,7 +242,7 @@ namespace AyaNova.Biz ct.SaveChanges(); //Log - EventLogProcessor.LogEventToDatabase(new Event(UserId, dbParent.Id, AyaType.Locale, AyaEvent.Modified), ct); + EventLogProcessor.LogEventToDatabaseAndSaveEntireContext(new Event(UserId, dbParent.Id, AyaType.Locale, AyaEvent.Modified), ct); return true; } @@ -269,7 +269,7 @@ namespace AyaNova.Biz ct.SaveChanges(); //Log - EventLogProcessor.LogEventToDatabase(new Event(UserId, dbObj.Id, AyaType.Locale, AyaEvent.Modified), ct); + EventLogProcessor.LogEventToDatabaseAndSaveEntireContext(new Event(UserId, dbObj.Id, AyaType.Locale, AyaEvent.Modified), ct); return true; } @@ -611,7 +611,7 @@ namespace AyaNova.Biz ct.SaveChanges(); //Log now that we have the Id, note that there is no source created / modified for this so just attributing to current userId - EventLogProcessor.LogEventToDatabase(new Event(UserId, l.Id, AyaType.Locale, AyaEvent.Created), ct); + EventLogProcessor.LogEventToDatabaseAndSaveEntireContext(new Event(UserId, l.Id, AyaType.Locale, AyaEvent.Created), ct); } break; diff --git a/server/AyaNova/biz/UserBiz.cs b/server/AyaNova/biz/UserBiz.cs index 9c89f050..23dac8b4 100644 --- a/server/AyaNova/biz/UserBiz.cs +++ b/server/AyaNova/biz/UserBiz.cs @@ -80,7 +80,7 @@ namespace AyaNova.Biz //Handle child and associated items //Log event - EventLogProcessor.LogEventToDatabase(new Event(UserId, inObj.Id, BizType, AyaEvent.Created), ct); + EventLogProcessor.LogEventToDatabaseAndSaveEntireContext(new Event(UserId, inObj.Id, BizType, AyaEvent.Created), ct); //SEARCH INDEXING SearchIndex(inObj, true); @@ -122,7 +122,7 @@ namespace AyaNova.Biz //Handle child and associated items //Log event - EventLogProcessor.LogEventToDatabase(new Event(UserId, inObj.Id, BizType, AyaEvent.Created), TempContext); + EventLogProcessor.LogEventToDatabaseAndSaveEntireContext(new Event(UserId, inObj.Id, BizType, AyaEvent.Created), TempContext); //SEARCH INDEXING SearchIndex(inObj, true); @@ -146,7 +146,7 @@ namespace AyaNova.Biz if (ret != null) { //Log - EventLogProcessor.LogEventToDatabase(new Event(UserId, fetchId, BizType, AyaEvent.Retrieved), ct); + EventLogProcessor.LogEventToDatabaseAndSaveEntireContext(new Event(UserId, fetchId, BizType, AyaEvent.Retrieved), ct); } return ret; } @@ -301,7 +301,7 @@ namespace AyaNova.Biz //Log modification - EventLogProcessor.LogEventToDatabase(new Event(UserId, dbObj.Id, BizType, AyaEvent.Modified), ct); + EventLogProcessor.LogEventToDatabaseAndSaveEntireContext(new Event(UserId, dbObj.Id, BizType, AyaEvent.Modified), ct); SearchIndex(dbObj, false); @@ -338,7 +338,7 @@ namespace AyaNova.Biz return false; //Log modification - EventLogProcessor.LogEventToDatabase(new Event(UserId, dbObj.Id, BizType, AyaEvent.Modified), ct); + EventLogProcessor.LogEventToDatabaseAndSaveEntireContext(new Event(UserId, dbObj.Id, BizType, AyaEvent.Modified), ct); SearchIndex(dbObj, false); TagUtil.ProcessUpdateTagsInRepository(ct, dbObj.Tags, SnapshotOfOriginalDBObj.Tags); diff --git a/server/AyaNova/biz/UserOptionsBiz.cs b/server/AyaNova/biz/UserOptionsBiz.cs index a8c83ec8..f85d7885 100644 --- a/server/AyaNova/biz/UserOptionsBiz.cs +++ b/server/AyaNova/biz/UserOptionsBiz.cs @@ -59,7 +59,7 @@ namespace AyaNova.Biz ct.SaveChanges(); //Log - EventLogProcessor.LogEventToDatabase(new Event(UserId, dbObj.Id, AyaType.UserOptions, AyaEvent.Modified), ct); + EventLogProcessor.LogEventToDatabaseAndSaveEntireContext(new Event(UserId, dbObj.Id, AyaType.UserOptions, AyaEvent.Modified), ct); return true; } @@ -79,7 +79,7 @@ namespace AyaNova.Biz ct.SaveChanges(); //Log - EventLogProcessor.LogEventToDatabase(new Event(UserId, dbObj.Id, AyaType.UserOptions, AyaEvent.Modified), ct); + EventLogProcessor.LogEventToDatabaseAndSaveEntireContext(new Event(UserId, dbObj.Id, AyaType.UserOptions, AyaEvent.Modified), ct); return true; } diff --git a/server/AyaNova/biz/WidgetBiz.cs b/server/AyaNova/biz/WidgetBiz.cs index ab62a401..f9e51d50 100644 --- a/server/AyaNova/biz/WidgetBiz.cs +++ b/server/AyaNova/biz/WidgetBiz.cs @@ -64,7 +64,7 @@ namespace AyaNova.Biz if (ret != null) { //Log - EventLogProcessor.LogEventToDatabase(new Event(UserId, fetchId, BizType, AyaEvent.Retrieved), ct); + EventLogProcessor.LogEventToDatabaseAndSaveEntireContext(new Event(UserId, fetchId, BizType, AyaEvent.Retrieved), ct); } return ret; } @@ -95,7 +95,7 @@ namespace AyaNova.Biz await ct.SaveChangesAsync(); //Handle child and associated items: - EventLogProcessor.LogEventToDatabase(new Event(UserId, outObj.Id, BizType, AyaEvent.Created), ct); + EventLogProcessor.LogEventToDatabaseAndSaveEntireContext(new Event(UserId, outObj.Id, BizType, AyaEvent.Created), ct); SearchIndex(outObj, true); TagUtil.ProcessUpdateTagsInRepository(ct, outObj.Tags, null); return outObj; @@ -123,7 +123,7 @@ namespace AyaNova.Biz TempContext.SaveChanges(); //Handle child and associated items: - EventLogProcessor.LogEventToDatabase(new Event(UserId, outObj.Id, BizType, AyaEvent.Created), TempContext); + EventLogProcessor.LogEventToDatabaseAndSaveEntireContext(new Event(UserId, outObj.Id, BizType, AyaEvent.Created), TempContext); SearchIndex(outObj, true); TagUtil.ProcessUpdateTagsInRepository(TempContext, outObj.Tags, null); @@ -152,7 +152,7 @@ namespace AyaNova.Biz await ct.SaveChangesAsync(); //Handle child and associated items: - EventLogProcessor.LogEventToDatabase(new Event(UserId, outObj.Id, BizType, AyaEvent.Created), ct); + EventLogProcessor.LogEventToDatabaseAndSaveEntireContext(new Event(UserId, outObj.Id, BizType, AyaEvent.Created), ct); SearchIndex(outObj, true); TagUtil.ProcessUpdateTagsInRepository(ct, outObj.Tags, null); return outObj; @@ -187,7 +187,7 @@ namespace AyaNova.Biz return false; //Associated items - EventLogProcessor.LogEventToDatabase(new Event(UserId, dbObj.Id, BizType, AyaEvent.Modified), ct); + EventLogProcessor.LogEventToDatabaseAndSaveEntireContext(new Event(UserId, dbObj.Id, BizType, AyaEvent.Modified), ct); SearchIndex(dbObj, false); TagUtil.ProcessUpdateTagsInRepository(ct, dbObj.Tags, SnapshotOfOriginalDBObj.Tags); @@ -217,7 +217,7 @@ namespace AyaNova.Biz return false; //Associated items - EventLogProcessor.LogEventToDatabase(new Event(UserId, dbObj.Id, BizType, AyaEvent.Modified), ct); + EventLogProcessor.LogEventToDatabaseAndSaveEntireContext(new Event(UserId, dbObj.Id, BizType, AyaEvent.Modified), ct); SearchIndex(dbObj, false); TagUtil.ProcessUpdateTagsInRepository(ct, dbObj.Tags, SnapshotOfOriginalDBObj.Tags);