public async Task <IActionResult> AddOrderLine(AddOrderLineRequest request)
        {
            var orderId = Guid.Parse("33d4201c-4a8e-40a2-ae1d-50bc64097085");

            var order = await _ordersContext.Orders.FindAsync(orderId);

            Thread.Sleep(3000);

            order.AddOrderLine(request.ProductCode);

            await _ordersContext.SaveChangesAsync();

            return(Ok());
        }
        public async Task <IActionResult> AddOrderLine(AddOrderLineRequest request)
        {
            var orderId = Guid.Parse("33d4201c-4a8e-40a2-ae1d-50bc64097085");

            await using (var tran = await _ordersContext.Database.BeginTransactionAsync())
            {
                await _ordersContext.Database
                .ExecuteSqlRawAsync($"UPDATE orders.Orders WITH (XLOCK) SET Id = Id  WHERE Id = '{orderId}'");

                var order = await _ordersContext.Orders.FindAsync(orderId);

                Thread.Sleep(3000);

                order.AddOrderLine(request.ProductCode);

                await _ordersContext.SaveChangesAsync();
            }

            return(Ok());
        }
        public async Task <IActionResult> AddOrderLine(AddOrderLineRequest request)
        {
            var orderId = Guid.Parse("33d4201c-4a8e-40a2-ae1d-50bc64097085");

            var order = await _ordersContext.Orders.FindAsync(orderId);

            Thread.Sleep(3000);

            order.AddOrderLine(request.ProductCode);

            var domainEvents = DomainEventsHelper.GetAllDomainEvents(order);

            if (domainEvents.Any())
            {
                order.IncreaseVersion();
            }

            await _ordersContext.SaveChangesAsync();

            return(Ok());
        }