diff --git a/src/Services/Ordering/Ordering.API/Application/Commands/CancelOrderCommandHandler.cs b/src/Services/Ordering/Ordering.API/Application/Commands/CancelOrderCommandHandler.cs
index a4c4facb8..f8ca93162 100644
--- a/src/Services/Ordering/Ordering.API/Application/Commands/CancelOrderCommandHandler.cs
+++ b/src/Services/Ordering/Ordering.API/Application/Commands/CancelOrderCommandHandler.cs
@@ -22,6 +22,7 @@ namespace Ordering.API.Application.Commands
/// customer executes cancel order from app
///
///
+ ///
///
public async Task Handle(CancelOrderCommand command, CancellationToken cancellationToken)
{
@@ -32,7 +33,7 @@ namespace Ordering.API.Application.Commands
}
orderToUpdate.SetCancelledStatus();
- return await _orderRepository.UnitOfWork.SaveEntitiesAsync();
+ return await _orderRepository.UnitOfWork.SaveEntitiesAsync(cancellationToken);
}
}
@@ -46,7 +47,7 @@ namespace Ordering.API.Application.Commands
protected override bool CreateResultForDuplicateRequest()
{
- return true; // Ignore duplicate requests for processing order.
+ return true; // Ignore duplicate requests for processing order.
}
}
}
diff --git a/src/Services/Ordering/Ordering.API/Application/Commands/IdentifiedCommandHandler.cs b/src/Services/Ordering/Ordering.API/Application/Commands/IdentifiedCommandHandler.cs
index f00ea44c8..312a775b4 100644
--- a/src/Services/Ordering/Ordering.API/Application/Commands/IdentifiedCommandHandler.cs
+++ b/src/Services/Ordering/Ordering.API/Application/Commands/IdentifiedCommandHandler.cs
@@ -37,6 +37,7 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands
/// just enqueues the original inner command.
///
/// IdentifiedCommand which contains both original command & request ID
+ ///
/// Return value of inner command or default value if request same ID was found
public async Task Handle(IdentifiedCommand message, CancellationToken cancellationToken)
{
@@ -48,16 +49,16 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands
else
{
await _requestManager.CreateRequestForCommandAsync(message.Id);
- try
- {
- // Send the embeded business command to mediator so it runs its related CommandHandler
- var result = await _mediator.Send(message.Command);
- return result;
- }
- catch
- {
- return default(R);
- }
+ try
+ {
+ // Send the embeded business command to mediator so it runs its related CommandHandler
+ var result = await _mediator.Send(message.Command, cancellationToken);
+ return result;
+ }
+ catch
+ {
+ return default(R);
+ }
}
}
}
diff --git a/src/Services/Ordering/Ordering.API/Application/Commands/ShipOrderCommandHandler.cs b/src/Services/Ordering/Ordering.API/Application/Commands/ShipOrderCommandHandler.cs
index b4a6ac26d..ae0086ce7 100644
--- a/src/Services/Ordering/Ordering.API/Application/Commands/ShipOrderCommandHandler.cs
+++ b/src/Services/Ordering/Ordering.API/Application/Commands/ShipOrderCommandHandler.cs
@@ -22,6 +22,7 @@ namespace Ordering.API.Application.Commands
/// administrator executes ship order from app
///
///
+ ///
///
public async Task Handle(ShipOrderCommand command, CancellationToken cancellationToken)
{
@@ -32,7 +33,7 @@ namespace Ordering.API.Application.Commands
}
orderToUpdate.SetShippedStatus();
- return await _orderRepository.UnitOfWork.SaveEntitiesAsync();
+ return await _orderRepository.UnitOfWork.SaveEntitiesAsync(cancellationToken);
}
}
@@ -46,7 +47,7 @@ namespace Ordering.API.Application.Commands
protected override bool CreateResultForDuplicateRequest()
{
- return true; // Ignore duplicate requests for processing order.
+ return true; // Ignore duplicate requests for processing order.
}
}
}
diff --git a/src/Services/Ordering/Ordering.Infrastructure/OrderingContext.cs b/src/Services/Ordering/Ordering.Infrastructure/OrderingContext.cs
index a2cfb96a5..dabf7d433 100644
--- a/src/Services/Ordering/Ordering.Infrastructure/OrderingContext.cs
+++ b/src/Services/Ordering/Ordering.Infrastructure/OrderingContext.cs
@@ -30,7 +30,6 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.Infrastructure
{
_mediator = mediator ?? throw new ArgumentNullException(nameof(mediator));
-
System.Diagnostics.Debug.WriteLine("OrderingContext::ctor ->" + this.GetHashCode());
}
@@ -57,7 +56,7 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.Infrastructure
// After executing this line all the changes (from the Command Handler and Domain Event Handlers)
// performed throught the DbContext will be commited
- var result = await base.SaveChangesAsync();
+ var result = await base.SaveChangesAsync(cancellationToken);
return true;
}
@@ -70,7 +69,7 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.Infrastructure
var optionsBuilder = new DbContextOptionsBuilder()
.UseSqlServer("Server=.;Initial Catalog=Microsoft.eShopOnContainers.Services.OrderingDb;Integrated Security=true");
- return new OrderingContext(optionsBuilder.Options,new NoMediator());
+ return new OrderingContext(optionsBuilder.Options, new NoMediator());
}
class NoMediator : IMediator