From f1b5f9eef34057f950404c50a9f1854e3338bcbc Mon Sep 17 00:00:00 2001 From: Stuart Ferguson Date: Thu, 26 Feb 2026 15:49:50 +0000 Subject: [PATCH] Update Shared package versions and config access method Updated Shared, Shared.Logger, and Shared.Results.Web packages to version 2026.2.2. Replaced usage of ConfigurationReaderExtensions.GetValueOrDefault with ConfigurationReader.GetValueOrDefault in Program.cs, and removed the now-obsolete ConfigurationReaderExtensions class. These changes align with updates in the Shared package. --- .../MobileConfiguration.csproj | 6 ++--- MobileConfiguration/Program.cs | 25 +++---------------- 2 files changed, 6 insertions(+), 25 deletions(-) diff --git a/MobileConfiguration/MobileConfiguration.csproj b/MobileConfiguration/MobileConfiguration.csproj index 531b2ac..73c1d34 100644 --- a/MobileConfiguration/MobileConfiguration.csproj +++ b/MobileConfiguration/MobileConfiguration.csproj @@ -65,9 +65,9 @@ - - - + + + diff --git a/MobileConfiguration/Program.cs b/MobileConfiguration/Program.cs index af57c19..94436ea 100644 --- a/MobileConfiguration/Program.cs +++ b/MobileConfiguration/Program.cs @@ -82,9 +82,9 @@ builder.Services.AddDbContext(options => options.UseSqlServer(configuration.GetConnectionString("ConfigurationDatabase"))); } -bool logRequests = ConfigurationReaderExtensions.GetValueOrDefault("MiddlewareLogging", "LogRequests", true); -bool logResponses = ConfigurationReaderExtensions.GetValueOrDefault("MiddlewareLogging", "LogResponses", true); -LogLevel middlewareLogLevel = ConfigurationReaderExtensions.GetValueOrDefault("MiddlewareLogging", "MiddlewareLogLevel", LogLevel.Warning); +bool logRequests = ConfigurationReader.GetValueOrDefault("MiddlewareLogging", "LogRequests", true); +bool logResponses = ConfigurationReader.GetValueOrDefault("MiddlewareLogging", "LogResponses", true); +LogLevel middlewareLogLevel = ConfigurationReader.GetValueOrDefault("MiddlewareLogging", "MiddlewareLogLevel", LogLevel.Warning); RequestResponseMiddlewareLoggingConfig config = new(middlewareLogLevel, logRequests, logResponses); @@ -132,23 +132,4 @@ async Task InitializeDatabase(IApplicationBuilder app) await dbContext.MigrateAsync(CancellationToken.None); } } -} - -public static class ConfigurationReaderExtensions { - public static T GetValueOrDefault(String sectionName, - String keyName, - T defaultValue) { - try { - var value = ConfigurationReader.GetValue(sectionName, keyName); - - if (String.IsNullOrEmpty(value)) { - return defaultValue; - } - - return (T)Convert.ChangeType(value, typeof(T)); - } - catch (KeyNotFoundException kex) { - return defaultValue; - } - } } \ No newline at end of file