fix: PlatformInfrastructureModule 补 UseSnakeCaseNamingConvention

根因:PlatformDbContext 注册时缺少 UseSnakeCaseNamingConvention,
导致 EF 查询用 PascalCase 列名("Id")但实际表是 snake_case("id"),
报 column u.Id does not exist。
This commit is contained in:
xiangning 2026-07-03 11:47:37 +08:00
parent 47c45bd15f
commit bdd1ad39bb
9 changed files with 1 additions and 20 deletions

View File

@ -16,7 +16,6 @@ using IM.Application;
using IM.Domain.Common; using IM.Domain.Common;
using IM.Infrastructure; using IM.Infrastructure;
using BuildFlow.Platform.Application; using BuildFlow.Platform.Application;
using BuildFlow.Platform.Infrastructure.Persistence;
using Volo.Abp; using Volo.Abp;
using Volo.Abp.Modularity; using Volo.Abp.Modularity;
using Workflow.Application; using Workflow.Application;

View File

@ -3,13 +3,9 @@ using BuildFlow.Platform.Infrastructure.Persistence;
using File.Infrastructure.Persistence; using File.Infrastructure.Persistence;
using IM.Infrastructure.Mongo; using IM.Infrastructure.Mongo;
using IM.Infrastructure.Persistence; using IM.Infrastructure.Persistence;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Diagnostics; using Microsoft.EntityFrameworkCore.Diagnostics;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using MongoDB.Entities; using MongoDB.Entities;
using Workflow.Infrastructure.Persistence; using Workflow.Infrastructure.Persistence;
using RagSeedData = BuildFlow.Infrastructure.Persistence.SeedData;
using PlatformSeedData = BuildFlow.Platform.Infrastructure.Persistence.SeedData; using PlatformSeedData = BuildFlow.Platform.Infrastructure.Persistence.SeedData;
using WorkflowSeedData = Workflow.Infrastructure.Persistence.SeedData; using WorkflowSeedData = Workflow.Infrastructure.Persistence.SeedData;

View File

@ -1,7 +1,3 @@
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Routing;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Volo.Abp.DependencyInjection; using Volo.Abp.DependencyInjection;
namespace BuildFlow.Host.Configuration; namespace BuildFlow.Host.Configuration;

View File

@ -1,10 +1,8 @@
using File.Application.Events; using File.Application.Events;
using File.Application.Features.Files.Commands; using File.Application.Features.Files.Commands;
using File.Domain.Entities;
using File.Infrastructure.Persistence; using File.Infrastructure.Persistence;
using File.Infrastructure.Storage; using File.Infrastructure.Storage;
using MediatR; using MediatR;
using Microsoft.EntityFrameworkCore;
namespace File.Application.Features.Files.Handlers; namespace File.Application.Features.Files.Handlers;

View File

@ -10,9 +10,6 @@ namespace BuildFlow.Platform.Infrastructure;
/// <summary>平台基础能力基础设施层模块。注册 PlatformDbContext(连 platform 库)。</summary> /// <summary>平台基础能力基础设施层模块。注册 PlatformDbContext(连 platform 库)。</summary>
[DependsOn(typeof(PlatformDomainModule))] [DependsOn(typeof(PlatformDomainModule))]
/// <summary>
/// undefined
/// </summary>
public class PlatformInfrastructureModule : AbpModule public class PlatformInfrastructureModule : AbpModule
{ {
public override void ConfigureServices(ServiceConfigurationContext context) public override void ConfigureServices(ServiceConfigurationContext context)
@ -23,6 +20,7 @@ public class PlatformInfrastructureModule : AbpModule
var conn = $"{config.GetConnectionString("Default")};Database={config["DatabaseNames:Platform"]}"; var conn = $"{config.GetConnectionString("Default")};Database={config["DatabaseNames:Platform"]}";
services.AddDbContext<PlatformDbContext>((sp, options) => services.AddDbContext<PlatformDbContext>((sp, options) =>
options.UseNpgsql(conn) options.UseNpgsql(conn)
.UseSnakeCaseNamingConvention()
.AddInterceptors(sp.GetRequiredService<AuditInterceptor>())); .AddInterceptors(sp.GetRequiredService<AuditInterceptor>()));
services.AddScoped<AuditInterceptor>(); services.AddScoped<AuditInterceptor>();
} }

View File

@ -1,6 +1,5 @@
namespace BuildFlow.Architecture.Tests; namespace BuildFlow.Architecture.Tests;
using System.Xml.Linq;
using Xunit; using Xunit;
/// <summary> /// <summary>

View File

@ -1,13 +1,11 @@
using IM.Application.Chat.DTOs; using IM.Application.Chat.DTOs;
using IM.Domain.Common; using IM.Domain.Common;
using IM.Domain.Enums; using IM.Domain.Enums;
using IM.Infrastructure.Mongo;
using IM.Infrastructure.Persistence; using IM.Infrastructure.Persistence;
using Xunit; using Xunit;
using Microsoft.AspNetCore.SignalR.Client; using Microsoft.AspNetCore.SignalR.Client;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using MongoDB.Driver;
namespace BuildFlow.IM.Integration.Tests; namespace BuildFlow.IM.Integration.Tests;

View File

@ -1,11 +1,9 @@
using IM.Application.Chat.DTOs; using IM.Application.Chat.DTOs;
using IM.Domain.Common; using IM.Domain.Common;
using IM.Domain.Enums; using IM.Domain.Enums;
using IM.Infrastructure.Mongo;
using IM.Infrastructure.Persistence; using IM.Infrastructure.Persistence;
using Xunit; using Xunit;
using Microsoft.AspNetCore.SignalR.Client; using Microsoft.AspNetCore.SignalR.Client;
using MongoDB.Driver;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;

View File

@ -17,7 +17,6 @@ using BuildFlow.Shared.Infrastructure;
using IM.Application.Chat.Commands; using IM.Application.Chat.Commands;
using IM.Domain.Common; using IM.Domain.Common;
using IM.Infrastructure.Cache; using IM.Infrastructure.Cache;
using IM.Infrastructure.Mongo;
using IM.Infrastructure.Persistence; using IM.Infrastructure.Persistence;
using StackExchange.Redis; using StackExchange.Redis;