This commit is contained in:
@@ -156,13 +156,13 @@ namespace AyaNova.Biz
|
|||||||
internal static async Task DeleteJobsForObjectAsync(AyaTypeId ayObj, AyContext ct)
|
internal static async Task DeleteJobsForObjectAsync(AyaTypeId ayObj, AyContext ct)
|
||||||
{
|
{
|
||||||
//Get a list of all jobid's for the object passed in
|
//Get a list of all jobid's for the object passed in
|
||||||
List<OpsJob> jobsForObject = GetJobsForObjectAsync(ayObj, ct).Result;
|
List<OpsJob> jobsForObject = await GetJobsForObjectAsync(ayObj, ct);
|
||||||
|
|
||||||
//short circuit
|
//short circuit
|
||||||
if (jobsForObject.Count == 0)
|
if (jobsForObject.Count == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
using (var transaction = ct.Database.BeginTransaction())
|
using (var transaction = await ct.Database.BeginTransactionAsync())
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -173,7 +173,7 @@ namespace AyaNova.Biz
|
|||||||
|
|
||||||
// Commit transaction if all commands succeed, transaction will auto-rollback
|
// Commit transaction if all commands succeed, transaction will auto-rollback
|
||||||
// when disposed if either commands fails
|
// when disposed if either commands fails
|
||||||
transaction.Commit();
|
await transaction.CommitAsync();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@@ -192,14 +192,14 @@ namespace AyaNova.Biz
|
|||||||
/// <param name="ct"></param>
|
/// <param name="ct"></param>
|
||||||
internal static async Task DeleteJobAndLogAsync(Guid jobId, AyContext ct)
|
internal static async Task DeleteJobAndLogAsync(Guid jobId, AyContext ct)
|
||||||
{
|
{
|
||||||
using (var transaction = ct.Database.BeginTransaction())
|
using (var transaction = await ct.Database.BeginTransactionAsync())
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
await RemoveJobAndLogsAsync(ct, jobId);
|
await RemoveJobAndLogsAsync(ct, jobId);
|
||||||
// Commit transaction if all commands succeed, transaction will auto-rollback
|
// Commit transaction if all commands succeed, transaction will auto-rollback
|
||||||
// when disposed if either commands fails
|
// when disposed if either commands fails
|
||||||
transaction.Commit();
|
await transaction.CommitAsync();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user