This commit is contained in:
parent
5c7829bdbd
commit
707e6131fa
@ -4,6 +4,6 @@
|
||||
<PropertyGroup>
|
||||
<!-- All Fake packages -->
|
||||
<!-- 清本地nuget缓存:dotnet nuget locals -c http-cache -->
|
||||
<FakePackageVersion>8.0.6.2</FakePackageVersion>
|
||||
<FakePackageVersion>8.0.6.3</FakePackageVersion>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
|
||||
@ -21,8 +21,6 @@
|
||||
<PackageReference Include="Fake.Autofac" Version="$(FakePackageVersion)" />
|
||||
<PackageReference Include="Fake.Consul" Version="$(FakePackageVersion)" />
|
||||
<PackageReference Include="Fake.Messaging.Dashboard" Version="$(FakePackageVersion)" />
|
||||
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="8.0.3" />
|
||||
|
||||
<PackageReference Include="Serilog.AspNetCore" Version="8.0.1" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
@ -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<SignatureValidationOptions>(configuration.GetSection("SignatureValidation"));
|
||||
|
||||
// Outbox / Inbox(fk_msg_*)与业务同库(EF),通过 DbTransaction 征用 SqlSugar 事务
|
||||
services.AddDbContext<MessagingDbContext>(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<MessagingDashboardOptions>(o =>
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(o.PathMatch) || o.PathMatch == "/messaging")
|
||||
o.PathMatch = "/eventbus";
|
||||
});
|
||||
|
||||
// 全局授权配置:所有接口默认需要授权
|
||||
services.AddMvc(options =>
|
||||
{
|
||||
|
||||
5
src/TrackCenter.Api/appsettings.Development.json
Normal file
5
src/TrackCenter.Api/appsettings.Development.json
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"DataSeed": {
|
||||
"Enable": false
|
||||
}
|
||||
}
|
||||
@ -3,8 +3,5 @@
|
||||
"Consul": {
|
||||
"Address": "http://test.ideship.com:30850",
|
||||
"Token": "c0aea902-dca0-ac29-299b-a0d47e5402aa"
|
||||
},
|
||||
"DataSeed": {
|
||||
"Enable": false
|
||||
}
|
||||
}
|
||||
|
||||
@ -12,6 +12,8 @@
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="8.0.1"/>
|
||||
<PackageReference Include="FreeRedis" Version="1.3.6"/>
|
||||
<PackageReference Include="Fake.Messaging.EntityFrameworkCore" Version="$(FakePackageVersion)" />
|
||||
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="8.0.3" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@ -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;
|
||||
/// 仓储模块
|
||||
/// </summary>
|
||||
[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<ElasticSearchOptions>(options =>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user