From 04121b0378e7c2dca601e117d5eae0eadc0facc8 Mon Sep 17 00:00:00 2001 From: Jason Webb Date: Thu, 12 Sep 2024 09:53:31 -0600 Subject: [PATCH] WIP: updating examples. --- .../Caching/Examples.Caching.PersistenceCaching/Program.cs | 5 +++-- .../RCommon.TestBase.Data/EFConfigurations/TestDbContext.cs | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Examples/Caching/Examples.Caching.PersistenceCaching/Program.cs b/Examples/Caching/Examples.Caching.PersistenceCaching/Program.cs index 4e43684d..470363d1 100644 --- a/Examples/Caching/Examples.Caching.PersistenceCaching/Program.cs +++ b/Examples/Caching/Examples.Caching.PersistenceCaching/Program.cs @@ -22,8 +22,9 @@ var host = Host.CreateDefaultBuilder(args) .ConfigureAppConfiguration((context, builder) => { - ConfigurationContainer.Configuration = builder - .Build(); + builder + .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true); + ConfigurationContainer.Configuration = builder.Build(); }) .ConfigureServices(services => { diff --git a/Tests/RCommon.TestBase.Data/EFConfigurations/TestDbContext.cs b/Tests/RCommon.TestBase.Data/EFConfigurations/TestDbContext.cs index 025d5ec0..b9857257 100644 --- a/Tests/RCommon.TestBase.Data/EFConfigurations/TestDbContext.cs +++ b/Tests/RCommon.TestBase.Data/EFConfigurations/TestDbContext.cs @@ -70,7 +70,8 @@ protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) { if (_configuration != null) { - optionsBuilder.UseSqlServer(_configuration.GetConnectionString(@"TestDbContext")); + string connString = _configuration.GetConnectionString(@"TestDbContext"); + optionsBuilder.UseSqlServer(connString); optionsBuilder.UseLoggerFactory(EFUnitTestLoggingFactory) .EnableSensitiveDataLogging(); }