From ed642947dc7b7a4e11538b266f17929b4a455f48 Mon Sep 17 00:00:00 2001 From: masoud Date: Fri, 5 Dec 2025 18:55:12 +0000 Subject: [PATCH] Fix: Suppress EF Core 9 PendingModelChangesWarning --- .../Persistence/ApplicationDbContext.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/CMSMicroservice.Infrastructure/Persistence/ApplicationDbContext.cs b/src/CMSMicroservice.Infrastructure/Persistence/ApplicationDbContext.cs index 7f2d668..9f42582 100644 --- a/src/CMSMicroservice.Infrastructure/Persistence/ApplicationDbContext.cs +++ b/src/CMSMicroservice.Infrastructure/Persistence/ApplicationDbContext.cs @@ -1,5 +1,6 @@ using System.Reflection; using CMSMicroservice.Application.Common.Interfaces; +using Microsoft.EntityFrameworkCore.Diagnostics; using CMSMicroservice.Domain.Entities; using CMSMicroservice.Domain.Entities.Payment; @@ -39,6 +40,9 @@ public class ApplicationDbContext : DbContext, IApplicationDbContext protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) { optionsBuilder.AddInterceptors(_auditableEntitySaveChangesInterceptor); + + // Suppress PendingModelChangesWarning in EF Core 9 + optionsBuilder.ConfigureWarnings(w => w.Ignore(RelationalEventId.PendingModelChangesWarning)); } public override async Task SaveChangesAsync(CancellationToken cancellationToken = default)