From ad7b33234fcdfa044030c4899be26f9d0a76046e Mon Sep 17 00:00:00 2001 From: Miguel Veloso Date: Thu, 21 Feb 2019 15:56:15 +0000 Subject: [PATCH] Add log traces for commands --- .../Commands/CreateOrderCommandHandler.cs | 14 +++++--- ...tingValidationOrderStatusCommandHandler.cs | 7 +++- .../SetPaidOrderStatusCommandHandler.cs | 7 +++- ...StockConfirmedOrderStatusCommandHandler.cs | 7 +++- ...tStockRejectedOrderStatusCommandHandler.cs | 7 +++- .../Commands/ShipOrderCommandHandler.cs | 11 +++++-- ...ePeriodConfirmedIntegrationEventHandler.cs | 9 +++++ ...derPaymentFailedIntegrationEventHandler.cs | 9 +++++ ...rPaymentSuccededIntegrationEventHandler.cs | 9 +++++ ...erStockConfirmedIntegrationEventHandler.cs | 9 +++++ ...derStockRejectedIntegrationEventHandler.cs | 9 +++++ ...CheckoutAcceptedIntegrationEventHandler.cs | 8 ++++- .../Controllers/OrdersController.cs | 33 ++++++++++++++++++- .../Ordering/Ordering.API/Ordering.API.csproj | 2 ++ .../OrderingContext.cs | 4 ++- 15 files changed, 130 insertions(+), 15 deletions(-) diff --git a/src/Services/Ordering/Ordering.API/Application/Commands/CreateOrderCommandHandler.cs b/src/Services/Ordering/Ordering.API/Application/Commands/CreateOrderCommandHandler.cs index 45400f57f..00a088c09 100644 --- a/src/Services/Ordering/Ordering.API/Application/Commands/CreateOrderCommandHandler.cs +++ b/src/Services/Ordering/Ordering.API/Application/Commands/CreateOrderCommandHandler.cs @@ -24,7 +24,7 @@ // Using DI to inject infrastructure persistence Repositories public CreateOrderCommandHandler(IMediator mediator, IOrderingIntegrationEventService orderingIntegrationEventService, - IOrderRepository orderRepository, + IOrderRepository orderRepository, IIdentityService identityService, ILogger logger) { @@ -40,14 +40,14 @@ // Add Integration event to clean the basket var orderStartedIntegrationEvent = new OrderStartedIntegrationEvent(message.UserId); await _orderingIntegrationEventService.AddAndSaveEventAsync(orderStartedIntegrationEvent); - + // Add/Update the Buyer AggregateRoot // DDD patterns comment: Add child entities and value-objects through the Order Aggregate-Root // methods and constructor so validations, invariants and business logic // make sure that consistency is preserved across the whole aggregate var address = new Address(message.Street, message.City, message.State, message.Country, message.ZipCode); var order = new Order(message.UserId, message.UserName, address, message.CardTypeId, message.CardNumber, message.CardSecurityNumber, message.CardHolderName, message.CardExpiration); - + foreach (var item in message.OrderItems) { order.AddOrderItem(item.ProductId, item.ProductName, item.UnitPrice, item.Discount, item.PictureUrl, item.Units); @@ -55,7 +55,7 @@ _logger.LogInformation("----- Creating Order - Order: {@Order}", order); - _orderRepository.Add(order); + _orderRepository.Add(order); return await _orderRepository.UnitOfWork .SaveEntitiesAsync(); @@ -66,7 +66,11 @@ // Use for Idempotency in Command process public class CreateOrderIdentifiedCommandHandler : IdentifiedCommandHandler { - public CreateOrderIdentifiedCommandHandler(IMediator mediator, IRequestManager requestManager) : base(mediator, requestManager) + public CreateOrderIdentifiedCommandHandler( + IMediator mediator, + IRequestManager requestManager, + ILogger> logger) + : base(mediator, requestManager, logger) { } diff --git a/src/Services/Ordering/Ordering.API/Application/Commands/SetAwaitingValidationOrderStatusCommandHandler.cs b/src/Services/Ordering/Ordering.API/Application/Commands/SetAwaitingValidationOrderStatusCommandHandler.cs index cee307ca2..c40ddb37f 100644 --- a/src/Services/Ordering/Ordering.API/Application/Commands/SetAwaitingValidationOrderStatusCommandHandler.cs +++ b/src/Services/Ordering/Ordering.API/Application/Commands/SetAwaitingValidationOrderStatusCommandHandler.cs @@ -2,6 +2,7 @@ using Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands; using Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.OrderAggregate; using Microsoft.eShopOnContainers.Services.Ordering.Infrastructure.Idempotency; +using Microsoft.Extensions.Logging; using System.Threading; using System.Threading.Tasks; @@ -40,7 +41,11 @@ namespace Ordering.API.Application.Commands // Use for Idempotency in Command process public class SetAwaitingValidationIdentifiedOrderStatusCommandHandler : IdentifiedCommandHandler { - public SetAwaitingValidationIdentifiedOrderStatusCommandHandler(IMediator mediator, IRequestManager requestManager) : base(mediator, requestManager) + public SetAwaitingValidationIdentifiedOrderStatusCommandHandler( + IMediator mediator, + IRequestManager requestManager, + ILogger> logger) + : base(mediator, requestManager, logger) { } diff --git a/src/Services/Ordering/Ordering.API/Application/Commands/SetPaidOrderStatusCommandHandler.cs b/src/Services/Ordering/Ordering.API/Application/Commands/SetPaidOrderStatusCommandHandler.cs index 211e568cb..8282bf6ab 100644 --- a/src/Services/Ordering/Ordering.API/Application/Commands/SetPaidOrderStatusCommandHandler.cs +++ b/src/Services/Ordering/Ordering.API/Application/Commands/SetPaidOrderStatusCommandHandler.cs @@ -2,6 +2,7 @@ using Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands; using Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.OrderAggregate; using Microsoft.eShopOnContainers.Services.Ordering.Infrastructure.Idempotency; +using Microsoft.Extensions.Logging; using System.Threading; using System.Threading.Tasks; @@ -43,7 +44,11 @@ namespace Ordering.API.Application.Commands // Use for Idempotency in Command process public class SetPaidIdentifiedOrderStatusCommandHandler : IdentifiedCommandHandler { - public SetPaidIdentifiedOrderStatusCommandHandler(IMediator mediator, IRequestManager requestManager) : base(mediator, requestManager) + public SetPaidIdentifiedOrderStatusCommandHandler( + IMediator mediator, + IRequestManager requestManager, + ILogger> logger) + : base(mediator, requestManager, logger) { } diff --git a/src/Services/Ordering/Ordering.API/Application/Commands/SetStockConfirmedOrderStatusCommandHandler.cs b/src/Services/Ordering/Ordering.API/Application/Commands/SetStockConfirmedOrderStatusCommandHandler.cs index 4e1bc6185..e9c3eb75c 100644 --- a/src/Services/Ordering/Ordering.API/Application/Commands/SetStockConfirmedOrderStatusCommandHandler.cs +++ b/src/Services/Ordering/Ordering.API/Application/Commands/SetStockConfirmedOrderStatusCommandHandler.cs @@ -2,6 +2,7 @@ using Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands; using Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.OrderAggregate; using Microsoft.eShopOnContainers.Services.Ordering.Infrastructure.Idempotency; +using Microsoft.Extensions.Logging; using System.Threading; using System.Threading.Tasks; @@ -43,7 +44,11 @@ namespace Ordering.API.Application.Commands // Use for Idempotency in Command process public class SetStockConfirmedOrderStatusIdenfifiedCommandHandler : IdentifiedCommandHandler { - public SetStockConfirmedOrderStatusIdenfifiedCommandHandler(IMediator mediator, IRequestManager requestManager) : base(mediator, requestManager) + public SetStockConfirmedOrderStatusIdenfifiedCommandHandler( + IMediator mediator, + IRequestManager requestManager, + ILogger> logger) + : base(mediator, requestManager, logger) { } diff --git a/src/Services/Ordering/Ordering.API/Application/Commands/SetStockRejectedOrderStatusCommandHandler.cs b/src/Services/Ordering/Ordering.API/Application/Commands/SetStockRejectedOrderStatusCommandHandler.cs index 2b7a72526..2e6c794d2 100644 --- a/src/Services/Ordering/Ordering.API/Application/Commands/SetStockRejectedOrderStatusCommandHandler.cs +++ b/src/Services/Ordering/Ordering.API/Application/Commands/SetStockRejectedOrderStatusCommandHandler.cs @@ -2,6 +2,7 @@ using Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands; using Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.OrderAggregate; using Microsoft.eShopOnContainers.Services.Ordering.Infrastructure.Idempotency; +using Microsoft.Extensions.Logging; using System.Threading; using System.Threading.Tasks; @@ -44,7 +45,11 @@ namespace Ordering.API.Application.Commands // Use for Idempotency in Command process public class SetStockRejectedOrderStatusIdenfifiedCommandHandler : IdentifiedCommandHandler { - public SetStockRejectedOrderStatusIdenfifiedCommandHandler(IMediator mediator, IRequestManager requestManager) : base(mediator, requestManager) + public SetStockRejectedOrderStatusIdenfifiedCommandHandler( + IMediator mediator, + IRequestManager requestManager, + ILogger> logger) + : base(mediator, requestManager, logger) { } diff --git a/src/Services/Ordering/Ordering.API/Application/Commands/ShipOrderCommandHandler.cs b/src/Services/Ordering/Ordering.API/Application/Commands/ShipOrderCommandHandler.cs index b4a6ac26d..fcac86ef9 100644 --- a/src/Services/Ordering/Ordering.API/Application/Commands/ShipOrderCommandHandler.cs +++ b/src/Services/Ordering/Ordering.API/Application/Commands/ShipOrderCommandHandler.cs @@ -2,6 +2,7 @@ using Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands; using Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.OrderAggregate; using Microsoft.eShopOnContainers.Services.Ordering.Infrastructure.Idempotency; +using Microsoft.Extensions.Logging; using System.Threading; using System.Threading.Tasks; @@ -9,7 +10,7 @@ namespace Ordering.API.Application.Commands { // Regular CommandHandler public class ShipOrderCommandHandler : IRequestHandler - { + { private readonly IOrderRepository _orderRepository; public ShipOrderCommandHandler(IOrderRepository orderRepository) @@ -26,7 +27,7 @@ namespace Ordering.API.Application.Commands public async Task Handle(ShipOrderCommand command, CancellationToken cancellationToken) { var orderToUpdate = await _orderRepository.GetAsync(command.OrderNumber); - if(orderToUpdate == null) + if (orderToUpdate == null) { return false; } @@ -40,7 +41,11 @@ namespace Ordering.API.Application.Commands // Use for Idempotency in Command process public class ShipOrderIdentifiedCommandHandler : IdentifiedCommandHandler { - public ShipOrderIdentifiedCommandHandler(IMediator mediator, IRequestManager requestManager) : base(mediator, requestManager) + public ShipOrderIdentifiedCommandHandler( + IMediator mediator, + IRequestManager requestManager, + ILogger> logger) + : base(mediator, requestManager, logger) { } diff --git a/src/Services/Ordering/Ordering.API/Application/IntegrationEvents/EventHandling/GracePeriodConfirmedIntegrationEventHandler.cs b/src/Services/Ordering/Ordering.API/Application/IntegrationEvents/EventHandling/GracePeriodConfirmedIntegrationEventHandler.cs index 275f177cc..621915f40 100644 --- a/src/Services/Ordering/Ordering.API/Application/IntegrationEvents/EventHandling/GracePeriodConfirmedIntegrationEventHandler.cs +++ b/src/Services/Ordering/Ordering.API/Application/IntegrationEvents/EventHandling/GracePeriodConfirmedIntegrationEventHandler.cs @@ -3,6 +3,7 @@ using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions; using Microsoft.eShopOnContainers.Services.Ordering.API; using Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.OrderAggregate; using Microsoft.Extensions.Logging; +using Ordering.API.Application.Behaviors; using Ordering.API.Application.Commands; using Ordering.API.Application.IntegrationEvents.Events; using Serilog.Context; @@ -38,6 +39,14 @@ namespace Ordering.API.Application.IntegrationEvents.EventHandling _logger.LogInformation("----- Handling integration event: {IntegrationEventId} at {AppShortName} - ({@IntegrationEvent})", @event.Id, Program.AppShortName, @event); var command = new SetAwaitingValidationOrderStatusCommand(@event.OrderId); + + _logger.LogInformation( + "----- Sending command: {CommandName} - {IdProperty}: {CommandId} ({@Command})", + command.GetGenericTypeName(), + nameof(command.OrderNumber), + command.OrderNumber, + command); + await _mediator.Send(command); } } diff --git a/src/Services/Ordering/Ordering.API/Application/IntegrationEvents/EventHandling/OrderPaymentFailedIntegrationEventHandler.cs b/src/Services/Ordering/Ordering.API/Application/IntegrationEvents/EventHandling/OrderPaymentFailedIntegrationEventHandler.cs index 198ad790d..24d34faec 100644 --- a/src/Services/Ordering/Ordering.API/Application/IntegrationEvents/EventHandling/OrderPaymentFailedIntegrationEventHandler.cs +++ b/src/Services/Ordering/Ordering.API/Application/IntegrationEvents/EventHandling/OrderPaymentFailedIntegrationEventHandler.cs @@ -5,6 +5,7 @@ using Microsoft.eShopOnContainers.Services.Ordering.API; using Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.OrderAggregate; using Microsoft.Extensions.Logging; + using Ordering.API.Application.Behaviors; using Ordering.API.Application.Commands; using Ordering.API.Application.IntegrationEvents.Events; using Serilog.Context; @@ -32,6 +33,14 @@ _logger.LogInformation("----- Handling integration event: {IntegrationEventId} at {AppShortName} - ({@IntegrationEvent})", @event.Id, Program.AppShortName, @event); var command = new CancelOrderCommand(@event.OrderId); + + _logger.LogInformation( + "----- Sending command: {CommandName} - {IdProperty}: {CommandId} ({@Command})", + command.GetGenericTypeName(), + nameof(command.OrderNumber), + command.OrderNumber, + command); + await _mediator.Send(command); } } diff --git a/src/Services/Ordering/Ordering.API/Application/IntegrationEvents/EventHandling/OrderPaymentSuccededIntegrationEventHandler.cs b/src/Services/Ordering/Ordering.API/Application/IntegrationEvents/EventHandling/OrderPaymentSuccededIntegrationEventHandler.cs index 7eb32cd06..c70a99c3f 100644 --- a/src/Services/Ordering/Ordering.API/Application/IntegrationEvents/EventHandling/OrderPaymentSuccededIntegrationEventHandler.cs +++ b/src/Services/Ordering/Ordering.API/Application/IntegrationEvents/EventHandling/OrderPaymentSuccededIntegrationEventHandler.cs @@ -5,6 +5,7 @@ using Microsoft.eShopOnContainers.Services.Ordering.API; using Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.OrderAggregate; using Microsoft.Extensions.Logging; + using Ordering.API.Application.Behaviors; using Ordering.API.Application.Commands; using Ordering.API.Application.IntegrationEvents.Events; using Serilog.Context; @@ -32,6 +33,14 @@ _logger.LogInformation("----- Handling integration event: {IntegrationEventId} at {AppShortName} - ({@IntegrationEvent})", @event.Id, Program.AppShortName, @event); var command = new SetPaidOrderStatusCommand(@event.OrderId); + + _logger.LogInformation( + "----- Sending command: {CommandName} - {IdProperty}: {CommandId} ({@Command})", + command.GetGenericTypeName(), + nameof(command.OrderNumber), + command.OrderNumber, + command); + await _mediator.Send(command); } } diff --git a/src/Services/Ordering/Ordering.API/Application/IntegrationEvents/EventHandling/OrderStockConfirmedIntegrationEventHandler.cs b/src/Services/Ordering/Ordering.API/Application/IntegrationEvents/EventHandling/OrderStockConfirmedIntegrationEventHandler.cs index af1ec605a..00624397f 100644 --- a/src/Services/Ordering/Ordering.API/Application/IntegrationEvents/EventHandling/OrderStockConfirmedIntegrationEventHandler.cs +++ b/src/Services/Ordering/Ordering.API/Application/IntegrationEvents/EventHandling/OrderStockConfirmedIntegrationEventHandler.cs @@ -10,6 +10,7 @@ using Microsoft.Extensions.Logging; using Serilog.Context; using Microsoft.eShopOnContainers.Services.Ordering.API; + using Ordering.API.Application.Behaviors; public class OrderStockConfirmedIntegrationEventHandler : IIntegrationEventHandler @@ -32,6 +33,14 @@ _logger.LogInformation("----- Handling integration event: {IntegrationEventId} at {AppShortName} - ({@IntegrationEvent})", @event.Id, Program.AppShortName, @event); var command = new SetStockConfirmedOrderStatusCommand(@event.OrderId); + + _logger.LogInformation( + "----- Sending command: {CommandName} - {IdProperty}: {CommandId} ({@Command})", + command.GetGenericTypeName(), + nameof(command.OrderNumber), + command.OrderNumber, + command); + await _mediator.Send(command); } } diff --git a/src/Services/Ordering/Ordering.API/Application/IntegrationEvents/EventHandling/OrderStockRejectedIntegrationEventHandler.cs b/src/Services/Ordering/Ordering.API/Application/IntegrationEvents/EventHandling/OrderStockRejectedIntegrationEventHandler.cs index 35202a257..e17d02f96 100644 --- a/src/Services/Ordering/Ordering.API/Application/IntegrationEvents/EventHandling/OrderStockRejectedIntegrationEventHandler.cs +++ b/src/Services/Ordering/Ordering.API/Application/IntegrationEvents/EventHandling/OrderStockRejectedIntegrationEventHandler.cs @@ -10,6 +10,7 @@ using Microsoft.Extensions.Logging; using Serilog.Context; using Microsoft.eShopOnContainers.Services.Ordering.API; + using Ordering.API.Application.Behaviors; public class OrderStockRejectedIntegrationEventHandler : IIntegrationEventHandler { @@ -36,6 +37,14 @@ .ToList(); var command = new SetStockRejectedOrderStatusCommand(@event.OrderId, orderStockRejectedItems); + + _logger.LogInformation( + "----- Sending command: {CommandName} - {IdProperty}: {CommandId} ({@Command})", + command.GetGenericTypeName(), + nameof(command.OrderNumber), + command.OrderNumber, + command); + await _mediator.Send(command); } } diff --git a/src/Services/Ordering/Ordering.API/Application/IntegrationEvents/EventHandling/UserCheckoutAcceptedIntegrationEventHandler.cs b/src/Services/Ordering/Ordering.API/Application/IntegrationEvents/EventHandling/UserCheckoutAcceptedIntegrationEventHandler.cs index a7fa23bcb..50d6113be 100644 --- a/src/Services/Ordering/Ordering.API/Application/IntegrationEvents/EventHandling/UserCheckoutAcceptedIntegrationEventHandler.cs +++ b/src/Services/Ordering/Ordering.API/Application/IntegrationEvents/EventHandling/UserCheckoutAcceptedIntegrationEventHandler.cs @@ -7,6 +7,7 @@ using Microsoft.Extensions.Logging; using Ordering.API.Application.IntegrationEvents.Events; using Serilog.Context; using Microsoft.eShopOnContainers.Services.Ordering.API; +using Ordering.API.Application.Behaviors; namespace Ordering.API.Application.IntegrationEvents.EventHandling { @@ -51,7 +52,12 @@ namespace Ordering.API.Application.IntegrationEvents.EventHandling var requestCreateOrder = new IdentifiedCommand(createOrderCommand, @event.RequestId); - _logger.LogInformation("----- IdentifiedCreateOrderCommand: {@IdentifiedCreateOrderCommand}", requestCreateOrder); + _logger.LogInformation( + "----- Sending command: {CommandName} - {IdProperty}: {CommandId} ({@Command})", + requestCreateOrder.GetGenericTypeName(), + nameof(requestCreateOrder.Id), + requestCreateOrder.Id, + requestCreateOrder); result = await _mediator.Send(requestCreateOrder); diff --git a/src/Services/Ordering/Ordering.API/Controllers/OrdersController.cs b/src/Services/Ordering/Ordering.API/Controllers/OrdersController.cs index e2c711b69..4a4cd8352 100644 --- a/src/Services/Ordering/Ordering.API/Controllers/OrdersController.cs +++ b/src/Services/Ordering/Ordering.API/Controllers/OrdersController.cs @@ -4,6 +4,8 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands; using Microsoft.eShopOnContainers.Services.Ordering.API.Application.Queries; using Microsoft.eShopOnContainers.Services.Ordering.API.Infrastructure.Services; +using Microsoft.Extensions.Logging; +using Ordering.API.Application.Behaviors; using Ordering.API.Application.Commands; using System; using System.Collections.Generic; @@ -20,12 +22,18 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.API.Controllers private readonly IMediator _mediator; private readonly IOrderQueries _orderQueries; private readonly IIdentityService _identityService; + private readonly ILogger _logger; - public OrdersController(IMediator mediator, IOrderQueries orderQueries, IIdentityService identityService) + public OrdersController( + IMediator mediator, + IOrderQueries orderQueries, + IIdentityService identityService, + ILogger logger) { _mediator = mediator ?? throw new ArgumentNullException(nameof(mediator)); _orderQueries = orderQueries ?? throw new ArgumentNullException(nameof(orderQueries)); _identityService = identityService ?? throw new ArgumentNullException(nameof(identityService)); + _logger = logger ?? throw new ArgumentNullException(nameof(logger)); } [Route("cancel")] @@ -39,6 +47,14 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.API.Controllers if (Guid.TryParse(requestId, out Guid guid) && guid != Guid.Empty) { var requestCancelOrder = new IdentifiedCommand(command, guid); + + _logger.LogInformation( + "----- Sending command: {CommandName} - {IdProperty}: {CommandId} ({@Command})", + requestCancelOrder.GetGenericTypeName(), + nameof(requestCancelOrder.Command.OrderNumber), + requestCancelOrder.Command.OrderNumber, + requestCancelOrder); + commandResult = await _mediator.Send(requestCancelOrder); } @@ -61,6 +77,14 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.API.Controllers if (Guid.TryParse(requestId, out Guid guid) && guid != Guid.Empty) { var requestShipOrder = new IdentifiedCommand(command, guid); + + _logger.LogInformation( + "----- Sending command: {CommandName} - {IdProperty}: {CommandId} ({@Command})", + requestShipOrder.GetGenericTypeName(), + nameof(requestShipOrder.Command.OrderNumber), + requestShipOrder.Command.OrderNumber, + requestShipOrder); + commandResult = await _mediator.Send(requestShipOrder); } @@ -114,6 +138,13 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.API.Controllers [HttpPost] public async Task> CreateOrderDraftFromBasketDataAsync([FromBody] CreateOrderDraftCommand createOrderDraftCommand) { + _logger.LogInformation( + "----- Sending command: {CommandName} - {IdProperty}: {CommandId} ({@Command})", + createOrderDraftCommand.GetGenericTypeName(), + nameof(createOrderDraftCommand.BuyerId), + createOrderDraftCommand.BuyerId, + createOrderDraftCommand); + return await _mediator.Send(createOrderDraftCommand); } } diff --git a/src/Services/Ordering/Ordering.API/Ordering.API.csproj b/src/Services/Ordering/Ordering.API/Ordering.API.csproj index baa14b01d..d51d3697e 100644 --- a/src/Services/Ordering/Ordering.API/Ordering.API.csproj +++ b/src/Services/Ordering/Ordering.API/Ordering.API.csproj @@ -5,6 +5,8 @@ aspnet-Ordering.API-20161122013547 $(AssetTargetFallback);portable-net45+win8+wp8+wpa81; ..\..\..\..\docker-compose.dcproj + true + latest diff --git a/src/Services/Ordering/Ordering.Infrastructure/OrderingContext.cs b/src/Services/Ordering/Ordering.Infrastructure/OrderingContext.cs index ac9ec608f..766cecd91 100644 --- a/src/Services/Ordering/Ordering.Infrastructure/OrderingContext.cs +++ b/src/Services/Ordering/Ordering.Infrastructure/OrderingContext.cs @@ -67,9 +67,11 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.Infrastructure return true; } - public async Task BeginTransactionAsync() + public async Task BeginTransactionAsync() { _currentTransaction = _currentTransaction ?? await Database.BeginTransactionAsync(IsolationLevel.ReadCommitted); + + return _currentTransaction; } public async Task CommitTransactionAsync()