From 707e6131fa667a424a727aa650f56c1624215154 Mon Sep 17 00:00:00 2001
From: xiaolipro <2357729423@qq.com>
Date: Wed, 28 Oct 2026 11:50:58 +0800
Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E8=80=A6=E5=90=88?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
Directory.Build.props | 2 +-
src/TrackCenter.Api/TrackCenter.Api.csproj | 2 --
src/TrackCenter.Api/TrackCenterApiModule.cs | 27 +------------------
.../appsettings.Development.json | 5 ++++
src/TrackCenter.Api/appsettings.json | 3 ---
.../TrackCenter.Repository.csproj | 2 ++
.../TrackCenterRepositoryModule.cs | 14 ++++++++++
7 files changed, 23 insertions(+), 32 deletions(-)
create mode 100644 src/TrackCenter.Api/appsettings.Development.json
diff --git a/Directory.Build.props b/Directory.Build.props
index a4b16976..21e819fe 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -4,6 +4,6 @@
- 8.0.6.2
+ 8.0.6.3
diff --git a/src/TrackCenter.Api/TrackCenter.Api.csproj b/src/TrackCenter.Api/TrackCenter.Api.csproj
index 9dff28a6..effa8b6f 100644
--- a/src/TrackCenter.Api/TrackCenter.Api.csproj
+++ b/src/TrackCenter.Api/TrackCenter.Api.csproj
@@ -21,8 +21,6 @@
-
-
diff --git a/src/TrackCenter.Api/TrackCenterApiModule.cs b/src/TrackCenter.Api/TrackCenterApiModule.cs
index 6fbba35d..2883b19e 100644
--- a/src/TrackCenter.Api/TrackCenterApiModule.cs
+++ b/src/TrackCenter.Api/TrackCenterApiModule.cs
@@ -5,10 +5,9 @@ using Fake.AspNetCore.ExceptionHandling;
using Fake.AspNetCore.Newtonsoft;
using Fake.AspNetCore.Swagger;
using Fake.Autofac;
-using Fake.Messaging.Dashboard;
-using Fake.Messaging.EntityFrameworkCore;
using Fake.FeiShu;
using Fake.Json;
+using Fake.Messaging.Dashboard;
using Fake.Modularity;
using Fake.Security.Claims;
using Fake.Serilog;
@@ -17,7 +16,6 @@ using Hangfire;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.HttpOverrides;
using Microsoft.AspNetCore.Mvc.Authorization;
-using Microsoft.EntityFrameworkCore;
using OpenTelemetry.Resources;
using OpenTelemetry.Trace;
using TrackCenter.Application;
@@ -33,7 +31,6 @@ namespace TrackCenter.Api;
[DependsOn(typeof(FakeAspNetCoreModule))]
[DependsOn(typeof(TrackCenterApplicationModule))]
[DependsOn(typeof(TrackCenterRepositoryModule))]
-// Messaging 独立队列(Outbox/Inbox + Dashboard);物理传输由 FakeMessagingRabbitMqModule 提供
[DependsOn(typeof(FakeMessagingDashboardModule))]
[DependsOn(typeof(FakeSerilogModule))]
public class TrackCenterApiModule : FakeModule
@@ -58,28 +55,6 @@ public class TrackCenterApiModule : FakeModule
// 配置签名验证选项
services.Configure(configuration.GetSection("SignatureValidation"));
- // Outbox / Inbox(fk_msg_*)与业务同库(EF),通过 DbTransaction 征用 SqlSugar 事务
- services.AddDbContext(options =>
- {
- var connectionString = configuration.GetConnectionString("Messaging")
- ?? configuration.GetConnectionString("IntegrationEventLog")
- ?? configuration.GetConnectionString("Default")
- ?? configuration["ConnectionStrings:Default"]
- ?? string.Empty;
- var serverVersion = ServerVersion.AutoDetect(connectionString);
- options.UseMySql(connectionString, serverVersion);
-#if DEBUG
- options.EnableSensitiveDataLogging();
-#endif
- });
-
- // Dashboard 路径保持 /eventbus,兼容旧书签与网关
- services.Configure(o =>
- {
- if (string.IsNullOrWhiteSpace(o.PathMatch) || o.PathMatch == "/messaging")
- o.PathMatch = "/eventbus";
- });
-
// 全局授权配置:所有接口默认需要授权
services.AddMvc(options =>
{
diff --git a/src/TrackCenter.Api/appsettings.Development.json b/src/TrackCenter.Api/appsettings.Development.json
new file mode 100644
index 00000000..3984be1e
--- /dev/null
+++ b/src/TrackCenter.Api/appsettings.Development.json
@@ -0,0 +1,5 @@
+{
+ "DataSeed": {
+ "Enable": false
+ }
+}
diff --git a/src/TrackCenter.Api/appsettings.json b/src/TrackCenter.Api/appsettings.json
index c004a63e..06ba18d7 100644
--- a/src/TrackCenter.Api/appsettings.json
+++ b/src/TrackCenter.Api/appsettings.json
@@ -3,8 +3,5 @@
"Consul": {
"Address": "http://test.ideship.com:30850",
"Token": "c0aea902-dca0-ac29-299b-a0d47e5402aa"
- },
- "DataSeed": {
- "Enable": false
}
}
diff --git a/src/TrackCenter.Repository/TrackCenter.Repository.csproj b/src/TrackCenter.Repository/TrackCenter.Repository.csproj
index 5c484242..f375379d 100644
--- a/src/TrackCenter.Repository/TrackCenter.Repository.csproj
+++ b/src/TrackCenter.Repository/TrackCenter.Repository.csproj
@@ -12,6 +12,8 @@
+
+
diff --git a/src/TrackCenter.Repository/TrackCenterRepositoryModule.cs b/src/TrackCenter.Repository/TrackCenterRepositoryModule.cs
index 01650a96..927ecdf5 100644
--- a/src/TrackCenter.Repository/TrackCenterRepositoryModule.cs
+++ b/src/TrackCenter.Repository/TrackCenterRepositoryModule.cs
@@ -1,5 +1,8 @@
+using Fake.Messaging;
+using Fake.Messaging.EntityFrameworkCore;
using Fake.Modularity;
using Fake.SqlSugarCore;
+using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using TrackCenter.Domain;
@@ -11,6 +14,8 @@ namespace TrackCenter.Repository;
/// 仓储模块
///
[DependsOn(typeof(FakeSqlSugarCoreModule))]
+// Outbox/Inbox(EF)+ Dashboard;Rabbit 传输在 Application 的 FakeMessagingRabbitMqModule
+[DependsOn(typeof(FakeMessagingEntityFrameworkCoreModule))]
public class TrackCenterRepositoryModule : FakeModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
@@ -23,6 +28,15 @@ public class TrackCenterRepositoryModule : FakeModule
options.DbType = DbType.MySql;
});
+ context.Services.AddMessagingDbContext(configuration, (options, connectionString) =>
+ {
+ var serverVersion = ServerVersion.AutoDetect(connectionString);
+ options.UseMySql(connectionString, serverVersion);
+#if DEBUG
+ options.EnableSensitiveDataLogging();
+#endif
+ });
+
context.Services.AddTransient(typeof(IBasicRepository<>), typeof(BasicRepository<>));
context.Services.Configure(options =>
--
2.45.2