This commit is contained in:
2020-05-10 23:54:16 +00:00
parent f3f9b0ace5
commit 88f1022289
3 changed files with 14 additions and 7 deletions

View File

@@ -686,6 +686,7 @@ namespace AyaNova.Biz
//npgsql driver will assume it's a string and put quotes around it triggering an error that a string can't be compared to an int //npgsql driver will assume it's a string and put quotes around it triggering an error that a string can't be compared to an int
AyContext ct = ServiceProviderProvider.DBContext; AyContext ct = ServiceProviderProvider.DBContext;
await ct.Database.ExecuteSqlInterpolatedAsync($"delete from asearchkey where objectid={objectID} and objecttype={(int)objectType}"); await ct.Database.ExecuteSqlInterpolatedAsync($"delete from asearchkey where objectid={objectID} and objecttype={(int)objectType}");
//nothing to save here, it's a direct command already executed
} }

View File

@@ -53,6 +53,7 @@ namespace AyaNova.Biz
//this allows for concurrency issues //this allows for concurrency issues
//I considered a circuit breaker / timeout here, but theoretically it should not be an issue //I considered a circuit breaker / timeout here, but theoretically it should not be an issue
//at some point it should not be a concurrency issue anymore //at some point it should not be a concurrency issue anymore
//And this is not critical functionality requiring a transaction and locking
do do
{ {
//START: Get tag word and concurrency token and count //START: Get tag word and concurrency token and count

View File

@@ -185,8 +185,6 @@ namespace AyaNova.Biz
// //
internal async Task<bool> DeleteAsync(long id) internal async Task<bool> DeleteAsync(long id)
{ {
using (var transaction = await ct.Database.BeginTransactionAsync()) using (var transaction = await ct.Database.BeginTransactionAsync())
{ {
try try
@@ -207,11 +205,18 @@ namespace AyaNova.Biz
ct.WorkOrder.Remove(dbObject); ct.WorkOrder.Remove(dbObject);
await ct.SaveChangesAsync(); await ct.SaveChangesAsync();
//Log event
await EventLogProcessor.DeleteObjectLogAsync(UserId, BizType, dbObject.Id, dbObject.Serial.ToString(), ct); await EventLogProcessor.DeleteObjectLogAsync(UserId, BizType, dbObject.Id, dbObject.Serial.ToString(), ct);
await Search.ProcessDeletedObjectKeywordsAsync(dbObject.Id, BizType); await Search.ProcessDeletedObjectKeywordsAsync(dbObject.Id, BizType);
await TagUtil.ProcessDeleteTagsInRepositoryAsync(ct, dbObject.Tags); await TagUtil.ProcessDeleteTagsInRepositoryAsync(ct, dbObject.Tags);
#if (DEBUG)
if (dbObject.Wiki == "INTEGRATION_DELETE_TEST_FAIL_BEFORE_COMMIT")
{
throw new System.Exception("WorkorderBiz::Delete - Test exception");
}
#endif
//all good do the commit //all good do the commit
await transaction.CommitAsync(); await transaction.CommitAsync();
} }