diff --git a/src/ApiGateways/Web.Bff.Shopping/aggregator/Services/OrderApiClient.cs b/src/ApiGateways/Web.Bff.Shopping/aggregator/Services/OrderApiClient.cs index 73c78f965..53fb65bb8 100644 --- a/src/ApiGateways/Web.Bff.Shopping/aggregator/Services/OrderApiClient.cs +++ b/src/ApiGateways/Web.Bff.Shopping/aggregator/Services/OrderApiClient.cs @@ -15,7 +15,7 @@ public class OrderApiClient : IOrderApiClient public async Task GetOrderDraftFromBasketAsync(BasketData basket) { - var url = _urls.Orders + UrlsConfig.OrdersOperations.GetOrderDraft(); + var url = $"{_urls.Orders}{UrlsConfig.OrdersOperations.GetOrderDraft()}"; var content = new StringContent(JsonSerializer.Serialize(basket), System.Text.Encoding.UTF8, "application/json"); var response = await _apiClient.PostAsync(url, content); diff --git a/src/BuildingBlocks/EventBus/EventBus/InMemoryEventBusSubscriptionsManager.cs b/src/BuildingBlocks/EventBus/EventBus/InMemoryEventBusSubscriptionsManager.cs index aac205f80..5de35b292 100644 --- a/src/BuildingBlocks/EventBus/EventBus/InMemoryEventBusSubscriptionsManager.cs +++ b/src/BuildingBlocks/EventBus/EventBus/InMemoryEventBusSubscriptionsManager.cs @@ -15,7 +15,7 @@ public partial class InMemoryEventBusSubscriptionsManager : IEventBusSubscriptio _eventTypes = new List(); } - public bool IsEmpty => !_handlers.Keys.Any(); + public bool IsEmpty => _handlers is { Count: 0 }; public void Clear() => _handlers.Clear(); public void AddDynamicSubscription(string eventName) diff --git a/src/BuildingBlocks/EventBus/EventBus/SubscriptionInfo.cs b/src/BuildingBlocks/EventBus/EventBus/SubscriptionInfo.cs index 7270c6e90..17e29d965 100644 --- a/src/BuildingBlocks/EventBus/EventBus/SubscriptionInfo.cs +++ b/src/BuildingBlocks/EventBus/EventBus/SubscriptionInfo.cs @@ -13,13 +13,10 @@ public partial class InMemoryEventBusSubscriptionsManager : IEventBusSubscriptio HandlerType = handlerType; } - public static SubscriptionInfo Dynamic(Type handlerType) - { - return new SubscriptionInfo(true, handlerType); - } - public static SubscriptionInfo Typed(Type handlerType) - { - return new SubscriptionInfo(false, handlerType); - } + public static SubscriptionInfo Dynamic(Type handlerType) => + new SubscriptionInfo(true, handlerType); + + public static SubscriptionInfo Typed(Type handlerType) => + new SubscriptionInfo(false, handlerType); } } diff --git a/src/BuildingBlocks/EventBus/EventBusRabbitMQ/DefaultRabbitMQPersistentConnection.cs b/src/BuildingBlocks/EventBus/EventBusRabbitMQ/DefaultRabbitMQPersistentConnection.cs index daacf83cd..17fdba7da 100644 --- a/src/BuildingBlocks/EventBus/EventBusRabbitMQ/DefaultRabbitMQPersistentConnection.cs +++ b/src/BuildingBlocks/EventBus/EventBusRabbitMQ/DefaultRabbitMQPersistentConnection.cs @@ -44,6 +44,9 @@ public class DefaultRabbitMQPersistentConnection try { + _connection.ConnectionShutdown -= OnConnectionShutdown; + _connection.CallbackException -= OnCallbackException; + _connection.ConnectionBlocked -= OnConnectionBlocked; _connection.Dispose(); } catch (IOException ex) diff --git a/src/BuildingBlocks/EventBus/EventBusServiceBus/EventBusServiceBus.cs b/src/BuildingBlocks/EventBus/EventBusServiceBus/EventBusServiceBus.cs index efe59f438..6c722b492 100644 --- a/src/BuildingBlocks/EventBus/EventBusServiceBus/EventBusServiceBus.cs +++ b/src/BuildingBlocks/EventBus/EventBusServiceBus/EventBusServiceBus.cs @@ -139,7 +139,7 @@ public class EventBusServiceBus : IEventBus return Task.CompletedTask; } - private async Task ProcessEvent(string eventName, string message) + private async Task ProcessEventAsync(string eventName, string message) { var processed = false; if (_subsManager.HasSubscriptionsForEvent(eventName)) diff --git a/src/BuildingBlocks/EventBus/IntegrationEventLogEF/Services/IntegrationEventLogService.cs b/src/BuildingBlocks/EventBus/IntegrationEventLogEF/Services/IntegrationEventLogService.cs index b8e7d59bd..472fba6e9 100644 --- a/src/BuildingBlocks/EventBus/IntegrationEventLogEF/Services/IntegrationEventLogService.cs +++ b/src/BuildingBlocks/EventBus/IntegrationEventLogEF/Services/IntegrationEventLogService.cs @@ -5,7 +5,7 @@ public class IntegrationEventLogService : IIntegrationEventLogService, IDisposab private readonly IntegrationEventLogContext _integrationEventLogContext; private readonly DbConnection _dbConnection; private readonly List _eventTypes; - private volatile bool disposedValue; + private volatile bool _disposedValue; public IntegrationEventLogService(DbConnection dbConnection) { @@ -79,7 +79,7 @@ public class IntegrationEventLogService : IIntegrationEventLogService, IDisposab protected virtual void Dispose(bool disposing) { - if (!disposedValue) + if (!_disposedValue) { if (disposing) { @@ -87,7 +87,7 @@ public class IntegrationEventLogService : IIntegrationEventLogService, IDisposab } - disposedValue = true; + _disposedValue = true; } } diff --git a/src/BuildingBlocks/EventBus/IntegrationEventLogEF/Utilities/ResilientTransaction.cs b/src/BuildingBlocks/EventBus/IntegrationEventLogEF/Utilities/ResilientTransaction.cs index 0d75021dc..23022729b 100644 --- a/src/BuildingBlocks/EventBus/IntegrationEventLogEF/Utilities/ResilientTransaction.cs +++ b/src/BuildingBlocks/EventBus/IntegrationEventLogEF/Utilities/ResilientTransaction.cs @@ -6,8 +6,7 @@ public class ResilientTransaction private ResilientTransaction(DbContext context) => _context = context ?? throw new ArgumentNullException(nameof(context)); - public static ResilientTransaction New(DbContext context) => - new ResilientTransaction(context); + public static ResilientTransaction New(DbContext context) => new(context); public async Task ExecuteAsync(Func action) { diff --git a/src/Services/Basket/Basket.API/Infrastructure/Middlewares/FailingMiddleware.cs b/src/Services/Basket/Basket.API/Infrastructure/Middlewares/FailingMiddleware.cs index 990168e5a..60fbdb655 100644 --- a/src/Services/Basket/Basket.API/Infrastructure/Middlewares/FailingMiddleware.cs +++ b/src/Services/Basket/Basket.API/Infrastructure/Middlewares/FailingMiddleware.cs @@ -1,4 +1,5 @@ namespace Basket.API.Infrastructure.Middlewares; + using Microsoft.Extensions.Logging; public class FailingMiddleware