From 308995ab34b4456696665f089ebe565958e496c7 Mon Sep 17 00:00:00 2001 From: Stuart Ferguson Date: Wed, 11 Mar 2026 18:19:39 +0000 Subject: [PATCH] Update dependencies, MediatR config, and logging setup Upgraded internal and third-party NuGet packages to latest versions across all projects. Refactored MediatR handler registration to use assembly scanning via AddMediatR. Consolidated request/response logging middleware into a single AddRequestResponseLogging call in Startup.cs for simpler configuration. --- .../EstateReportingAPI.BusinessLogic.csproj | 8 ++-- .../EstateReportingAPI.Client.csproj | 4 +- ...EstateReportingAPI.IntegrationTests.csproj | 20 +++++----- .../EstateReportingAPI.Tests.csproj | 16 ++++---- .../Bootstrapper/MediatorRegistry.cs | 37 ++----------------- EstateReportingAPI/EstateReportingAPI.csproj | 28 +++++++------- EstateReportingAPI/Startup.cs | 3 +- 7 files changed, 42 insertions(+), 74 deletions(-) diff --git a/EstateReportingAPI.BusinessLogic/EstateReportingAPI.BusinessLogic.csproj b/EstateReportingAPI.BusinessLogic/EstateReportingAPI.BusinessLogic.csproj index 55f07ea..6f4d479 100644 --- a/EstateReportingAPI.BusinessLogic/EstateReportingAPI.BusinessLogic.csproj +++ b/EstateReportingAPI.BusinessLogic/EstateReportingAPI.BusinessLogic.csproj @@ -7,11 +7,11 @@ - + - - - + + + diff --git a/EstateReportingAPI.Client/EstateReportingAPI.Client.csproj b/EstateReportingAPI.Client/EstateReportingAPI.Client.csproj index 4117090..a2b57d1 100644 --- a/EstateReportingAPI.Client/EstateReportingAPI.Client.csproj +++ b/EstateReportingAPI.Client/EstateReportingAPI.Client.csproj @@ -7,9 +7,9 @@ - + - + diff --git a/EstateReportingAPI.IntegrationTests/EstateReportingAPI.IntegrationTests.csproj b/EstateReportingAPI.IntegrationTests/EstateReportingAPI.IntegrationTests.csproj index 57f6c60..f077d50 100644 --- a/EstateReportingAPI.IntegrationTests/EstateReportingAPI.IntegrationTests.csproj +++ b/EstateReportingAPI.IntegrationTests/EstateReportingAPI.IntegrationTests.csproj @@ -7,10 +7,10 @@ - - - - + + + + @@ -22,13 +22,13 @@ runtime; build; native; contentfiles; analyzers; buildtransitive - - - + + + - - - + + + diff --git a/EstateReportingAPI.Tests/EstateReportingAPI.Tests.csproj b/EstateReportingAPI.Tests/EstateReportingAPI.Tests.csproj index fd732b7..a4ea6d0 100644 --- a/EstateReportingAPI.Tests/EstateReportingAPI.Tests.csproj +++ b/EstateReportingAPI.Tests/EstateReportingAPI.Tests.csproj @@ -7,20 +7,20 @@ - - - - - - + + + + + + all runtime; build; native; contentfiles; analyzers; buildtransitive - - + + all diff --git a/EstateReportingAPI/Bootstrapper/MediatorRegistry.cs b/EstateReportingAPI/Bootstrapper/MediatorRegistry.cs index b283f35..e8b16c8 100644 --- a/EstateReportingAPI/Bootstrapper/MediatorRegistry.cs +++ b/EstateReportingAPI/Bootstrapper/MediatorRegistry.cs @@ -5,46 +5,15 @@ using SimpleResults; using System.Diagnostics.CodeAnalysis; using EstateReportingAPI.BusinessLogic.Queries; +using Shared.General; namespace EstateReportingAPI.Bootstrapper; [ExcludeFromCodeCoverage] public class MediatorRegistry : ServiceRegistry { public MediatorRegistry() { - this.AddTransient(); - - this.AddSingleton>, EstateRequestHandler >(); - this.AddSingleton>>, EstateRequestHandler>(); - - this.AddSingleton>>, OperatorRequestHandler>(); - this.AddSingleton>, OperatorRequestHandler>(); - - this.AddSingleton>, TransactionRequestHandler>(); - this.AddSingleton>, TransactionRequestHandler>(); - this.AddSingleton>, TransactionRequestHandler>(); - this.AddSingleton>, TransactionRequestHandler>(); - this.AddSingleton>, TransactionRequestHandler>(); - this.AddSingleton>, TransactionRequestHandler>(); - this.AddSingleton>>, TransactionRequestHandler>(); - - this.AddSingleton>,SettlementRequestHandler>(); - - - this.AddSingleton>>, CalendarRequestHandler>(); - this.AddSingleton>>, CalendarRequestHandler>(); - this.AddSingleton>>, CalendarRequestHandler>(); - - this.AddSingleton>>, MerchantRequestHandler>(); - this.AddSingleton>, MerchantRequestHandler>(); - this.AddSingleton>>, MerchantRequestHandler>(); - this.AddSingleton>, MerchantRequestHandler>(); - this.AddSingleton>>, MerchantRequestHandler>(); - this.AddSingleton>>, MerchantRequestHandler>(); - this.AddSingleton>>, MerchantRequestHandler>(); - - this.AddSingleton>>, ContractRequestHandler>(); - this.AddSingleton>>, ContractRequestHandler>(); - this.AddSingleton>, ContractRequestHandler>(); + this.AddMediatR(cfg => cfg.RegisterServicesFromAssembly(typeof(EstateRequestHandler).Assembly)); + this.AddSingleton>(container => (serviceName) => ConfigurationReader.GetBaseServerUri(serviceName).OriginalString); } } diff --git a/EstateReportingAPI/EstateReportingAPI.csproj b/EstateReportingAPI/EstateReportingAPI.csproj index 44f70ac..48a32f3 100644 --- a/EstateReportingAPI/EstateReportingAPI.csproj +++ b/EstateReportingAPI/EstateReportingAPI.csproj @@ -10,32 +10,32 @@ - + - - + + - - + + - - - - + + + + - - - - - + + + + + diff --git a/EstateReportingAPI/Startup.cs b/EstateReportingAPI/Startup.cs index b9bdf0a..d6f5b22 100644 --- a/EstateReportingAPI/Startup.cs +++ b/EstateReportingAPI/Startup.cs @@ -57,8 +57,7 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerF ConfigurationReader.Initialise(Configuration); app.UseMiddleware(); - app.AddRequestLogging(); - app.AddResponseLogging(); + app.AddRequestResponseLogging(); app.AddExceptionHandler(); app.UseRouting();