This commit is contained in:
2020-01-24 15:44:20 +00:00
parent 9993835482
commit 0d01532e35
5 changed files with 12 additions and 20 deletions

View File

@@ -458,7 +458,7 @@ namespace AyaNova.Biz
/// <summary>
/// Process the keywords into the dictionary
/// NOTE: NAME parameter is in ADDITION to the NAME also being on of the strings passed in text parameter
/// NOTE: NAME parameter is in ADDITION to the NAME also being one of the strings passed in text parameter
/// </summary>
private static void ProcessKeywords(SearchIndexProcessObjectParameters p, bool newRecord)//long localeId, long objectID, AyaType objectType, string name, params string[] text)
{

View File

@@ -67,7 +67,7 @@ namespace AyaNova.Biz
//route linked version for external api access
internal async Task<Widget> CreateAsync(Widget inObj)
internal Widget Create(Widget inObj)
{
Validate(inObj, null);
if (HasErrors)
@@ -83,22 +83,14 @@ namespace AyaNova.Biz
outObj.Tags = TagUtil.NormalizeTags(outObj.Tags);
outObj.CustomFields = JsonUtil.CompactJson(outObj.CustomFields);
//Save to db
var TheContext = ct;
if (TheContext == null)
TheContext = ServiceProviderProvider.DBContext;
//TEST SPEED IMPROVEMENTS
//ORIGINALLY
// await TheContext.Widget.AddAsync(outObj);
// await TheContext.SaveChangesAsync();
//Save to db
//add syncronously and don't save but let the log save
//THIS SAVED 1 SECOND OUT OF 22 for seeding 500 widgets
TheContext.Widget.Add(outObj);
ct.Widget.Add(outObj);
//Handle child and associated items:
EventLogProcessor.LogEventToDatabaseAndSaveEntireContext(new Event(UserId, outObj.Id, BizType, AyaEvent.Created), TheContext);
EventLogProcessor.LogEventToDatabaseAndSaveEntireContext(new Event(UserId, outObj.Id, BizType, AyaEvent.Created), ct);
//This takes 16 seconds out of 22 when seeding 500 widgets
@@ -106,7 +98,7 @@ namespace AyaNova.Biz
//This takes 2 seconds out of 22 when seeding 500 widgets
TagUtil.ProcessUpdateTagsInRepository(TheContext, outObj.Tags, null);
TagUtil.ProcessUpdateTagsInRepository(ct, outObj.Tags, null);
return outObj;
}