From bdd1ad39bb86cab9b80e37b2522f12f6cfbf68d5 Mon Sep 17 00:00:00 2001 From: xiangning Date: Fri, 3 Jul 2026 11:47:37 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20PlatformInfrastructureModule=20=E8=A1=A5?= =?UTF-8?q?=20UseSnakeCaseNamingConvention?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 根因:PlatformDbContext 注册时缺少 UseSnakeCaseNamingConvention, 导致 EF 查询用 PascalCase 列名("Id")但实际表是 snake_case("id"), 报 column u.Id does not exist。 --- src/BuildFlow.Host/BuildFlowHostModule.cs | 1 - src/BuildFlow.Host/Configuration/DatabaseInitializer.cs | 4 ---- src/BuildFlow.Host/Configuration/HostObjectAccessors.cs | 4 ---- .../Features/Files/Handlers/DeleteFileCommandHandler.cs | 2 -- .../platform/Infrastructure/PlatformInfrastructureModule.cs | 4 +--- tests/BuildFlow.Architecture.Tests/HostArchitectureTests.cs | 1 - tests/BuildFlow.IM.Integration.Tests/ChatHubMessagingTests.cs | 2 -- .../ChatHubReadAndRecallTests.cs | 2 -- tests/BuildFlow.IM.Integration.Tests/ImServerFixture.cs | 1 - 9 files changed, 1 insertion(+), 20 deletions(-) diff --git a/src/BuildFlow.Host/BuildFlowHostModule.cs b/src/BuildFlow.Host/BuildFlowHostModule.cs index 0302489..d8f1153 100644 --- a/src/BuildFlow.Host/BuildFlowHostModule.cs +++ b/src/BuildFlow.Host/BuildFlowHostModule.cs @@ -16,7 +16,6 @@ using IM.Application; using IM.Domain.Common; using IM.Infrastructure; using BuildFlow.Platform.Application; -using BuildFlow.Platform.Infrastructure.Persistence; using Volo.Abp; using Volo.Abp.Modularity; using Workflow.Application; diff --git a/src/BuildFlow.Host/Configuration/DatabaseInitializer.cs b/src/BuildFlow.Host/Configuration/DatabaseInitializer.cs index ebc678b..9bccad8 100644 --- a/src/BuildFlow.Host/Configuration/DatabaseInitializer.cs +++ b/src/BuildFlow.Host/Configuration/DatabaseInitializer.cs @@ -3,13 +3,9 @@ using BuildFlow.Platform.Infrastructure.Persistence; using File.Infrastructure.Persistence; using IM.Infrastructure.Mongo; using IM.Infrastructure.Persistence; -using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Diagnostics; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Logging; using MongoDB.Entities; using Workflow.Infrastructure.Persistence; -using RagSeedData = BuildFlow.Infrastructure.Persistence.SeedData; using PlatformSeedData = BuildFlow.Platform.Infrastructure.Persistence.SeedData; using WorkflowSeedData = Workflow.Infrastructure.Persistence.SeedData; diff --git a/src/BuildFlow.Host/Configuration/HostObjectAccessors.cs b/src/BuildFlow.Host/Configuration/HostObjectAccessors.cs index 9f1c3ca..366367e 100644 --- a/src/BuildFlow.Host/Configuration/HostObjectAccessors.cs +++ b/src/BuildFlow.Host/Configuration/HostObjectAccessors.cs @@ -1,7 +1,3 @@ -using Microsoft.AspNetCore.Builder; -using Microsoft.AspNetCore.Routing; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Hosting; using Volo.Abp.DependencyInjection; namespace BuildFlow.Host.Configuration; diff --git a/src/modules/file/Application/Features/Files/Handlers/DeleteFileCommandHandler.cs b/src/modules/file/Application/Features/Files/Handlers/DeleteFileCommandHandler.cs index 4f23223..b6001f1 100644 --- a/src/modules/file/Application/Features/Files/Handlers/DeleteFileCommandHandler.cs +++ b/src/modules/file/Application/Features/Files/Handlers/DeleteFileCommandHandler.cs @@ -1,10 +1,8 @@ using File.Application.Events; using File.Application.Features.Files.Commands; -using File.Domain.Entities; using File.Infrastructure.Persistence; using File.Infrastructure.Storage; using MediatR; -using Microsoft.EntityFrameworkCore; namespace File.Application.Features.Files.Handlers; diff --git a/src/modules/platform/Infrastructure/PlatformInfrastructureModule.cs b/src/modules/platform/Infrastructure/PlatformInfrastructureModule.cs index 00ca88a..bedf14e 100644 --- a/src/modules/platform/Infrastructure/PlatformInfrastructureModule.cs +++ b/src/modules/platform/Infrastructure/PlatformInfrastructureModule.cs @@ -10,9 +10,6 @@ namespace BuildFlow.Platform.Infrastructure; /// 平台基础能力基础设施层模块。注册 PlatformDbContext(连 platform 库)。 [DependsOn(typeof(PlatformDomainModule))] -/// -/// undefined -/// public class PlatformInfrastructureModule : AbpModule { public override void ConfigureServices(ServiceConfigurationContext context) @@ -23,6 +20,7 @@ public class PlatformInfrastructureModule : AbpModule var conn = $"{config.GetConnectionString("Default")};Database={config["DatabaseNames:Platform"]}"; services.AddDbContext((sp, options) => options.UseNpgsql(conn) + .UseSnakeCaseNamingConvention() .AddInterceptors(sp.GetRequiredService())); services.AddScoped(); } diff --git a/tests/BuildFlow.Architecture.Tests/HostArchitectureTests.cs b/tests/BuildFlow.Architecture.Tests/HostArchitectureTests.cs index 3d08882..907417b 100644 --- a/tests/BuildFlow.Architecture.Tests/HostArchitectureTests.cs +++ b/tests/BuildFlow.Architecture.Tests/HostArchitectureTests.cs @@ -1,6 +1,5 @@ namespace BuildFlow.Architecture.Tests; -using System.Xml.Linq; using Xunit; /// diff --git a/tests/BuildFlow.IM.Integration.Tests/ChatHubMessagingTests.cs b/tests/BuildFlow.IM.Integration.Tests/ChatHubMessagingTests.cs index 06b4f07..49c18a1 100644 --- a/tests/BuildFlow.IM.Integration.Tests/ChatHubMessagingTests.cs +++ b/tests/BuildFlow.IM.Integration.Tests/ChatHubMessagingTests.cs @@ -1,13 +1,11 @@ using IM.Application.Chat.DTOs; using IM.Domain.Common; using IM.Domain.Enums; -using IM.Infrastructure.Mongo; using IM.Infrastructure.Persistence; using Xunit; using Microsoft.AspNetCore.SignalR.Client; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; -using MongoDB.Driver; namespace BuildFlow.IM.Integration.Tests; diff --git a/tests/BuildFlow.IM.Integration.Tests/ChatHubReadAndRecallTests.cs b/tests/BuildFlow.IM.Integration.Tests/ChatHubReadAndRecallTests.cs index 4275197..2daf7f8 100644 --- a/tests/BuildFlow.IM.Integration.Tests/ChatHubReadAndRecallTests.cs +++ b/tests/BuildFlow.IM.Integration.Tests/ChatHubReadAndRecallTests.cs @@ -1,11 +1,9 @@ using IM.Application.Chat.DTOs; using IM.Domain.Common; using IM.Domain.Enums; -using IM.Infrastructure.Mongo; using IM.Infrastructure.Persistence; using Xunit; using Microsoft.AspNetCore.SignalR.Client; -using MongoDB.Driver; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; diff --git a/tests/BuildFlow.IM.Integration.Tests/ImServerFixture.cs b/tests/BuildFlow.IM.Integration.Tests/ImServerFixture.cs index 40acd8f..87ba0ea 100644 --- a/tests/BuildFlow.IM.Integration.Tests/ImServerFixture.cs +++ b/tests/BuildFlow.IM.Integration.Tests/ImServerFixture.cs @@ -17,7 +17,6 @@ using BuildFlow.Shared.Infrastructure; using IM.Application.Chat.Commands; using IM.Domain.Common; using IM.Infrastructure.Cache; -using IM.Infrastructure.Mongo; using IM.Infrastructure.Persistence; using StackExchange.Redis;