From 308cdd03f21b7a2b07b3f58677cfd535c51681f3 Mon Sep 17 00:00:00 2001 From: TekH Date: Tue, 9 Jun 2026 13:52:30 +0200 Subject: [PATCH] Add SQL Server distributed cache configuration Configured the application to use SQL Server as a distributed cache provider. Added `AddDistributedSqlServerCache` to `Program.cs` and set up the connection string, schema name, and table name from the `Cache:SqlServer` configuration section. This enables persistent and shared caching across multiple application instances. --- EnvelopeGenerator.API/Program.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/EnvelopeGenerator.API/Program.cs b/EnvelopeGenerator.API/Program.cs index b01334b3..38119574 100644 --- a/EnvelopeGenerator.API/Program.cs +++ b/EnvelopeGenerator.API/Program.cs @@ -269,6 +269,15 @@ try // Cache options builder.Services.Configure(config.GetSection(CacheOptions.SectionName)); + // Distributed Cache - SQL Server + var sqlCacheConfig = config.GetSection("Cache:SqlServer"); + builder.Services.AddDistributedSqlServerCache(options => + { + options.ConnectionString = sqlCacheConfig["ConnectionString"] ?? connStr; + options.SchemaName = sqlCacheConfig["SchemaName"]; + options.TableName = sqlCacheConfig["TableName"]; + }); + // Envelope generator serives #pragma warning disable CS0618 // Type or member is obsolete builder.Services