From 349a5ac560696f8c820996f809bb04797a3df70a Mon Sep 17 00:00:00 2001 From: Anatolii Grynchuk Date: Sat, 2 May 2026 03:32:50 +0300 Subject: [PATCH] fix: serialize smtp settings using runtime type not base class JsonSerializer.Serialize(p.Settings) uses the compile-time type EmailChannelSettings, producing only {EmailChannelType:1} in the DB. Use p.Settings.GetType() to force runtime type so all SmtpChannelSettings properties (Host, Port, Username, Password, etc.) are actually persisted. Ref: IT-628 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../Repositories/EmailChannelRepository.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/HrynCo.NotificationService.DAL.EF/Repositories/EmailChannelRepository.cs b/HrynCo.NotificationService.DAL.EF/Repositories/EmailChannelRepository.cs index bba5a2d..e471dee 100644 --- a/HrynCo.NotificationService.DAL.EF/Repositories/EmailChannelRepository.cs +++ b/HrynCo.NotificationService.DAL.EF/Repositories/EmailChannelRepository.cs @@ -89,7 +89,7 @@ internal sealed class EmailChannelRepository : EfRepository, ServiceName = p.ServiceName, Priority = p.Priority, EmailChannelType = p.EmailChannelType, - SettingsJson = JsonSerializer.Serialize(p.Settings), + SettingsJson = JsonSerializer.Serialize(p.Settings, p.Settings.GetType()), DailyLimit = p.DailyLimit, MonthlyLimit = p.MonthlyLimit, WarnThresholdPercent = p.WarnThresholdPercent,