Compare commits
2 Commits
f0c53bc319
...
6614747b6a
| Author | SHA1 | Date | |
|---|---|---|---|
| 6614747b6a | |||
| 707e6131fa |
@ -4,6 +4,6 @@
|
|||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<!-- All Fake packages -->
|
<!-- All Fake packages -->
|
||||||
<!-- 清本地nuget缓存:dotnet nuget locals -c http-cache -->
|
<!-- 清本地nuget缓存:dotnet nuget locals -c http-cache -->
|
||||||
<FakePackageVersion>8.0.6.2</FakePackageVersion>
|
<FakePackageVersion>8.0.6.3</FakePackageVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@ -21,8 +21,6 @@
|
|||||||
<PackageReference Include="Fake.Autofac" Version="$(FakePackageVersion)" />
|
<PackageReference Include="Fake.Autofac" Version="$(FakePackageVersion)" />
|
||||||
<PackageReference Include="Fake.Consul" Version="$(FakePackageVersion)" />
|
<PackageReference Include="Fake.Consul" Version="$(FakePackageVersion)" />
|
||||||
<PackageReference Include="Fake.Messaging.Dashboard" 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" />
|
<PackageReference Include="Serilog.AspNetCore" Version="8.0.1" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|||||||
@ -5,10 +5,9 @@ using Fake.AspNetCore.ExceptionHandling;
|
|||||||
using Fake.AspNetCore.Newtonsoft;
|
using Fake.AspNetCore.Newtonsoft;
|
||||||
using Fake.AspNetCore.Swagger;
|
using Fake.AspNetCore.Swagger;
|
||||||
using Fake.Autofac;
|
using Fake.Autofac;
|
||||||
using Fake.Messaging.Dashboard;
|
|
||||||
using Fake.Messaging.EntityFrameworkCore;
|
|
||||||
using Fake.FeiShu;
|
using Fake.FeiShu;
|
||||||
using Fake.Json;
|
using Fake.Json;
|
||||||
|
using Fake.Messaging.Dashboard;
|
||||||
using Fake.Modularity;
|
using Fake.Modularity;
|
||||||
using Fake.Security.Claims;
|
using Fake.Security.Claims;
|
||||||
using Fake.Serilog;
|
using Fake.Serilog;
|
||||||
@ -17,7 +16,6 @@ using Hangfire;
|
|||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.HttpOverrides;
|
using Microsoft.AspNetCore.HttpOverrides;
|
||||||
using Microsoft.AspNetCore.Mvc.Authorization;
|
using Microsoft.AspNetCore.Mvc.Authorization;
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using OpenTelemetry.Resources;
|
using OpenTelemetry.Resources;
|
||||||
using OpenTelemetry.Trace;
|
using OpenTelemetry.Trace;
|
||||||
using TrackCenter.Application;
|
using TrackCenter.Application;
|
||||||
@ -33,7 +31,6 @@ namespace TrackCenter.Api;
|
|||||||
[DependsOn(typeof(FakeAspNetCoreModule))]
|
[DependsOn(typeof(FakeAspNetCoreModule))]
|
||||||
[DependsOn(typeof(TrackCenterApplicationModule))]
|
[DependsOn(typeof(TrackCenterApplicationModule))]
|
||||||
[DependsOn(typeof(TrackCenterRepositoryModule))]
|
[DependsOn(typeof(TrackCenterRepositoryModule))]
|
||||||
// Messaging 独立队列(Outbox/Inbox + Dashboard);物理传输由 FakeMessagingRabbitMqModule 提供
|
|
||||||
[DependsOn(typeof(FakeMessagingDashboardModule))]
|
[DependsOn(typeof(FakeMessagingDashboardModule))]
|
||||||
[DependsOn(typeof(FakeSerilogModule))]
|
[DependsOn(typeof(FakeSerilogModule))]
|
||||||
public class TrackCenterApiModule : FakeModule
|
public class TrackCenterApiModule : FakeModule
|
||||||
@ -58,28 +55,6 @@ public class TrackCenterApiModule : FakeModule
|
|||||||
// 配置签名验证选项
|
// 配置签名验证选项
|
||||||
services.Configure<SignatureValidationOptions>(configuration.GetSection("SignatureValidation"));
|
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 =>
|
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": {
|
"Consul": {
|
||||||
"Address": "http://test.ideship.com:30850",
|
"Address": "http://test.ideship.com:30850",
|
||||||
"Token": "c0aea902-dca0-ac29-299b-a0d47e5402aa"
|
"Token": "c0aea902-dca0-ac29-299b-a0d47e5402aa"
|
||||||
},
|
|
||||||
"DataSeed": {
|
|
||||||
"Enable": false
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -12,6 +12,8 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="8.0.1"/>
|
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="8.0.1"/>
|
||||||
<PackageReference Include="FreeRedis" Version="1.3.6"/>
|
<PackageReference Include="FreeRedis" Version="1.3.6"/>
|
||||||
|
<PackageReference Include="Fake.Messaging.EntityFrameworkCore" Version="$(FakePackageVersion)" />
|
||||||
|
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="8.0.3" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@ -1,5 +1,8 @@
|
|||||||
|
using Fake.Messaging;
|
||||||
|
using Fake.Messaging.EntityFrameworkCore;
|
||||||
using Fake.Modularity;
|
using Fake.Modularity;
|
||||||
using Fake.SqlSugarCore;
|
using Fake.SqlSugarCore;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using TrackCenter.Domain;
|
using TrackCenter.Domain;
|
||||||
@ -11,6 +14,8 @@ namespace TrackCenter.Repository;
|
|||||||
/// 仓储模块
|
/// 仓储模块
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DependsOn(typeof(FakeSqlSugarCoreModule))]
|
[DependsOn(typeof(FakeSqlSugarCoreModule))]
|
||||||
|
// Outbox/Inbox(EF)+ Dashboard;Rabbit 传输在 Application 的 FakeMessagingRabbitMqModule
|
||||||
|
[DependsOn(typeof(FakeMessagingEntityFrameworkCoreModule))]
|
||||||
public class TrackCenterRepositoryModule : FakeModule
|
public class TrackCenterRepositoryModule : FakeModule
|
||||||
{
|
{
|
||||||
public override void ConfigureServices(ServiceConfigurationContext context)
|
public override void ConfigureServices(ServiceConfigurationContext context)
|
||||||
@ -23,6 +28,15 @@ public class TrackCenterRepositoryModule : FakeModule
|
|||||||
options.DbType = DbType.MySql;
|
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.AddTransient(typeof(IBasicRepository<>), typeof(BasicRepository<>));
|
||||||
|
|
||||||
context.Services.Configure<ElasticSearchOptions>(options =>
|
context.Services.Configure<ElasticSearchOptions>(options =>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user