From 9692ae8c1d6d9d2c68ce868207424aef5345b621 Mon Sep 17 00:00:00 2001 From: barelyprofessional <150058423+barelyprofessional@users.noreply.github.com> Date: Fri, 3 Oct 2025 18:12:56 -0500 Subject: [PATCH] Trying to avoid tracking issues --- KfChatDotNetBot/Services/BotCommands.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/KfChatDotNetBot/Services/BotCommands.cs b/KfChatDotNetBot/Services/BotCommands.cs index 48e5f9e..efe5f81 100644 --- a/KfChatDotNetBot/Services/BotCommands.cs +++ b/KfChatDotNetBot/Services/BotCommands.cs @@ -7,6 +7,7 @@ using KfChatDotNetBot.Models; using KfChatDotNetBot.Models.DbModels; using KfChatDotNetBot.Settings; using KfChatDotNetWsClient.Models.Events; +using Microsoft.EntityFrameworkCore; using NLog; namespace KfChatDotNetBot.Services; @@ -61,7 +62,7 @@ internal class BotCommands if (!match.Success) continue; _logger.Debug($"Message matches {regex}"); using var db = new ApplicationDbContext(); - var user = db.Users.FirstOrDefault(u => u.KfId == message.Author.Id); + var user = db.Users.AsNoTracking().FirstOrDefault(u => u.KfId == message.Author.Id); // This should never happen as brand-new users are created upon join if (user == null) return; if (user.Ignored) return;