committed by
GitHub
47 changed files with 20618 additions and 24 deletions
File diff suppressed because it is too large
@ -0,0 +1,45 @@ |
|||
<Project Sdk="Microsoft.NET.Sdk"> |
|||
|
|||
<PropertyGroup> |
|||
<OutputType>Exe</OutputType> |
|||
<TargetFramework>net7.0</TargetFramework> |
|||
<ImplicitUsings>enable</ImplicitUsings> |
|||
<Nullable>enable</Nullable> |
|||
</PropertyGroup> |
|||
|
|||
<ItemGroup> |
|||
<PackageReference Include="Serilog.Extensions.Logging" Version="$(SerilogExtensionsLoggingPackageVersion)" /> |
|||
<PackageReference Include="Serilog.Sinks.File" Version="$(SerilogSinksFilePackageVersion)" /> |
|||
<PackageReference Include="Serilog.Sinks.Console" Version="$(SerilogSinksConsolePackageVersion)" /> |
|||
<PackageReference Include="Microsoft.Extensions.Hosting" Version="$(MicrosoftPackageVersion)" /> |
|||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="$(MicrosoftPackageVersion)"> |
|||
<PrivateAssets>all</PrivateAssets> |
|||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> |
|||
</PackageReference> |
|||
<PackageReference Include="Volo.Abp.Autofac" Version="$(VoloAbpPackageVersion)" /> |
|||
</ItemGroup> |
|||
|
|||
<ItemGroup> |
|||
<Compile Remove="Logs\**" /> |
|||
<Content Remove="Logs\**" /> |
|||
<EmbeddedResource Remove="Logs\**" /> |
|||
<None Remove="Logs\**" /> |
|||
</ItemGroup> |
|||
|
|||
<ItemGroup> |
|||
<None Remove="appsettings.json" /> |
|||
</ItemGroup> |
|||
|
|||
<ItemGroup> |
|||
<Content Include="appsettings.json"> |
|||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> |
|||
<ExcludeFromSingleFile>true</ExcludeFromSingleFile> |
|||
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory> |
|||
</Content> |
|||
</ItemGroup> |
|||
|
|||
<ItemGroup> |
|||
<ProjectReference Include="..\LY.MicroService.Applications.Single.EntityFrameworkCore\LY.MicroService.Applications.Single.EntityFrameworkCore.csproj" /> |
|||
</ItemGroup> |
|||
|
|||
</Project> |
|||
@ -0,0 +1,40 @@ |
|||
using Microsoft.Extensions.DependencyInjection; |
|||
using Microsoft.Extensions.Hosting; |
|||
using Microsoft.Extensions.Logging; |
|||
using Serilog; |
|||
using Serilog.Events; |
|||
|
|||
namespace LY.MicroService.Applications.Single.DbMigrator; |
|||
|
|||
public class Program |
|||
{ |
|||
public async static Task Main(string[] args) |
|||
{ |
|||
Log.Logger = new LoggerConfiguration() |
|||
.MinimumLevel.Information() |
|||
.MinimumLevel.Override("Microsoft", LogEventLevel.Warning) |
|||
.MinimumLevel.Override("Volo.Abp", LogEventLevel.Warning) |
|||
#if DEBUG
|
|||
.MinimumLevel.Override("LY.MicroService.Applications.Single.DbMigrator", LogEventLevel.Debug) |
|||
#else
|
|||
.MinimumLevel.Override("LY.MicroService.Applications.Single.DbMigrator", LogEventLevel.Information) |
|||
#endif
|
|||
.Enrich.FromLogContext() |
|||
.WriteTo.Console() |
|||
.WriteTo.File("Logs/migrations.txt") |
|||
.CreateLogger(); |
|||
|
|||
await CreateHostBuilder(args).RunConsoleAsync(); |
|||
} |
|||
|
|||
public static IHostBuilder CreateHostBuilder(string[] args) |
|||
{ |
|||
return Host.CreateDefaultBuilder(args) |
|||
.AddAppSettingsSecretsJson() |
|||
.ConfigureLogging((context, logging) => logging.ClearProviders()) |
|||
.ConfigureServices((hostContext, services) => |
|||
{ |
|||
services.AddHostedService<SingleDbMigratorModule>(); |
|||
}); |
|||
} |
|||
} |
|||
@ -0,0 +1,51 @@ |
|||
using LY.MicroService.Applications.Single.EntityFrameworkCore; |
|||
using Microsoft.Extensions.Configuration; |
|||
using Microsoft.Extensions.DependencyInjection; |
|||
using Microsoft.Extensions.Hosting; |
|||
using Serilog; |
|||
using Volo.Abp; |
|||
using Volo.Abp.Data; |
|||
|
|||
namespace LY.MicroService.Applications.Single.DbMigrator; |
|||
|
|||
public class SingleDbMigratorHostedService : IHostedService |
|||
{ |
|||
private readonly IHostApplicationLifetime _hostApplicationLifetime; |
|||
private readonly IConfiguration _configuration; |
|||
|
|||
public SingleDbMigratorHostedService( |
|||
IHostApplicationLifetime hostApplicationLifetime, |
|||
IConfiguration configuration) |
|||
{ |
|||
_hostApplicationLifetime = hostApplicationLifetime; |
|||
_configuration = configuration; |
|||
} |
|||
|
|||
public async Task StartAsync(CancellationToken cancellationToken) |
|||
{ |
|||
using var application = await AbpApplicationFactory |
|||
.CreateAsync<SingleDbMigratorModule>(options => |
|||
{ |
|||
options.Services.ReplaceConfiguration(_configuration); |
|||
options.UseAutofac(); |
|||
options.Services.AddLogging(c => c.AddSerilog()); |
|||
options.AddDataMigrationEnvironment(); |
|||
}); |
|||
await application.InitializeAsync(); |
|||
|
|||
await application |
|||
.ServiceProvider |
|||
.GetRequiredService<SingleDbMigrationService>() |
|||
.MigrateAsync(); |
|||
|
|||
await application.ShutdownAsync(); |
|||
|
|||
_hostApplicationLifetime.StopApplication(); |
|||
} |
|||
|
|||
public Task StopAsync(CancellationToken cancellationToken) |
|||
{ |
|||
return Task.CompletedTask; |
|||
} |
|||
} |
|||
|
|||
@ -0,0 +1,4 @@ |
|||
namespace LY.MicroService.Applications.Single.DbMigrator; |
|||
public partial class SingleDbMigratorModule |
|||
{ |
|||
} |
|||
@ -0,0 +1,14 @@ |
|||
using LY.MicroService.Applications.Single.EntityFrameworkCore; |
|||
using Volo.Abp.Autofac; |
|||
using Volo.Abp.Modularity; |
|||
|
|||
namespace LY.MicroService.Applications.Single.DbMigrator; |
|||
|
|||
[DependsOn( |
|||
typeof(SingleMigrationsEntityFrameworkCoreModule), |
|||
typeof(AbpAutofacModule) |
|||
)] |
|||
public partial class SingleDbMigratorModule : AbpModule |
|||
{ |
|||
|
|||
} |
|||
@ -0,0 +1,7 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp; |
|||
using LINGYUN.Abp; |
|||
@ -0,0 +1,87 @@ |
|||
{ |
|||
"ConnectionStrings": { |
|||
"Default": "Server=127.0.0.1;Port=3306;Database=platform;User Id=root;Password=123456", |
|||
"AbpAuditLogging": "Server=127.0.0.1;Port=3306;Database=platform;User Id=root;Password=123456", |
|||
"AbpIdentity": "Server=127.0.0.1;Port=3306;Database=identity;User Id=root;Password=123456", |
|||
"AbpIdentityServer": "Server=127.0.0.1;Port=3306;Database=identity;User Id=root;Password=123456", |
|||
"AbpSaas": "Server=127.0.0.1;Port=3306;Database=platform;User Id=root;Password=123456", |
|||
"AbpTenantManagement": "Server=127.0.0.1;Port=3306;Database=platform;User Id=root;Password=123456", |
|||
"AbpFeatureManagement": "Server=127.0.0.1;Port=3306;Database=platform;User Id=root;Password=123456", |
|||
"AbpSettingManagement": "Server=127.0.0.1;Port=3306;Database=platform;User Id=root;Password=123456", |
|||
"AbpPermissionManagement": "Server=127.0.0.1;Port=3306;Database=platform;User Id=root;Password=123456", |
|||
"AbpLocalizationManagement": "Server=127.0.0.1;Port=3306;Database=platform;User Id=root;Password=123456", |
|||
"AbpTextTemplating": "Server=127.0.0.1;Port=3306;Database=platform;User Id=root;Password=123456", |
|||
"TaskManagement": "Server=127.0.0.1;Port=3306;Database=platform;User Id=root;Password=123456", |
|||
"Workflow": "Server=127.0.0.1;Port=3306;Database=workflow;User Id=root;Password=123456" |
|||
}, |
|||
"StringEncryption": { |
|||
"DefaultPassPhrase": "s46c5q55nxpeS8Ra", |
|||
"InitVectorBytes": "s83ng0abvd02js84", |
|||
"DefaultSalt": "sf&5)s3#" |
|||
}, |
|||
"Serilog": { |
|||
"MinimumLevel": { |
|||
"Default": "Information", |
|||
"Override": { |
|||
"System": "Warning", |
|||
"Microsoft": "Warning", |
|||
"DotNetCore": "Information" |
|||
} |
|||
}, |
|||
"Enrich": [ "FromLogContext", "WithProcessId", "WithThreadId", "WithEnvironmentName", "WithMachineName", "WithApplicationName", "WithUniqueId" ], |
|||
"WriteTo": [ |
|||
{ |
|||
"Name": "Console", |
|||
"Args": { |
|||
"restrictedToMinimumLevel": "Debug", |
|||
"outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss} [{Level:u3}] [{SourceContext}] [{ProcessId}] [{ThreadId}] - {Message:lj}{NewLine}{Exception}" |
|||
} |
|||
}, |
|||
{ |
|||
"Name": "File", |
|||
"Args": { |
|||
"path": "Logs/Debug-.log", |
|||
"restrictedToMinimumLevel": "Debug", |
|||
"rollingInterval": "Day", |
|||
"outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss} [{Level:u3}] [{SourceContext}] [{ProcessId}] [{ThreadId}] - {Message:lj}{NewLine}{Exception}" |
|||
} |
|||
}, |
|||
{ |
|||
"Name": "File", |
|||
"Args": { |
|||
"path": "Logs/Info-.log", |
|||
"restrictedToMinimumLevel": "Information", |
|||
"rollingInterval": "Day", |
|||
"outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss} [{Level:u3}] [{SourceContext}] [{ProcessId}] [{ThreadId}] - {Message:lj}{NewLine}{Exception}" |
|||
} |
|||
}, |
|||
{ |
|||
"Name": "File", |
|||
"Args": { |
|||
"path": "Logs/Warn-.log", |
|||
"restrictedToMinimumLevel": "Warning", |
|||
"rollingInterval": "Day", |
|||
"outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss} [{Level:u3}] [{SourceContext}] [{ProcessId}] [{ThreadId}] - {Message:lj}{NewLine}{Exception}" |
|||
} |
|||
}, |
|||
{ |
|||
"Name": "File", |
|||
"Args": { |
|||
"path": "Logs/Error-.log", |
|||
"restrictedToMinimumLevel": "Error", |
|||
"rollingInterval": "Day", |
|||
"outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss} [{Level:u3}] [{SourceContext}] [{ProcessId}] [{ThreadId}] - {Message:lj}{NewLine}{Exception}" |
|||
} |
|||
}, |
|||
{ |
|||
"Name": "File", |
|||
"Args": { |
|||
"path": "Logs/Fatal-.log", |
|||
"restrictedToMinimumLevel": "Fatal", |
|||
"rollingInterval": "Day", |
|||
"outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss} [{Level:u3}] [{SourceContext}] [{ProcessId}] [{ThreadId}] - {Message:lj}{NewLine}{Exception}" |
|||
} |
|||
} |
|||
] |
|||
} |
|||
} |
|||
@ -0,0 +1,3 @@ |
|||
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd"> |
|||
<ConfigureAwait /> |
|||
</Weavers> |
|||
@ -0,0 +1,30 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> |
|||
<!-- This file was generated by Fody. Manual changes to this file will be lost when your project is rebuilt. --> |
|||
<xs:element name="Weavers"> |
|||
<xs:complexType> |
|||
<xs:all> |
|||
<xs:element name="ConfigureAwait" minOccurs="0" maxOccurs="1"> |
|||
<xs:complexType> |
|||
<xs:attribute name="ContinueOnCapturedContext" type="xs:boolean" /> |
|||
</xs:complexType> |
|||
</xs:element> |
|||
</xs:all> |
|||
<xs:attribute name="VerifyAssembly" type="xs:boolean"> |
|||
<xs:annotation> |
|||
<xs:documentation>'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed.</xs:documentation> |
|||
</xs:annotation> |
|||
</xs:attribute> |
|||
<xs:attribute name="VerifyIgnoreCodes" type="xs:string"> |
|||
<xs:annotation> |
|||
<xs:documentation>A comma-separated list of error codes that can be safely ignored in assembly verification.</xs:documentation> |
|||
</xs:annotation> |
|||
</xs:attribute> |
|||
<xs:attribute name="GenerateXsd" type="xs:boolean"> |
|||
<xs:annotation> |
|||
<xs:documentation>'false' to turn off automatic generation of the XML Schema file.</xs:documentation> |
|||
</xs:annotation> |
|||
</xs:attribute> |
|||
</xs:complexType> |
|||
</xs:element> |
|||
</xs:schema> |
|||
@ -0,0 +1,39 @@ |
|||
<Project Sdk="Microsoft.NET.Sdk"> |
|||
|
|||
<Import Project="..\..\configureawait.props" /> |
|||
<Import Project="..\..\common.props" /> |
|||
|
|||
<PropertyGroup> |
|||
<TargetFramework>net7.0</TargetFramework> |
|||
<RootNamespace>LY.MicroService.Applications.Single.EntityFrameworkCore</RootNamespace> |
|||
</PropertyGroup> |
|||
|
|||
<ItemGroup> |
|||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="$(MicrosoftEntityFrameworkCorePackageVersion)"> |
|||
<PrivateAssets>all</PrivateAssets> |
|||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> |
|||
</PackageReference> |
|||
<PackageReference Include="Volo.Abp.EntityFrameworkCore.MySql" Version="$(VoloAbpPackageVersion)" /> |
|||
<PackageReference Include="Volo.Abp.OpenIddict.EntityFrameworkCore" Version="$(VoloAbpPackageVersion)" /> |
|||
<PackageReference Include="Volo.Abp.FeatureManagement.EntityFrameworkCore" Version="$(VoloAbpPackageVersion)" /> |
|||
<PackageReference Include="Volo.Abp.SettingManagement.EntityFrameworkCore" Version="$(VoloAbpPackageVersion)" /> |
|||
<PackageReference Include="Volo.Abp.PermissionManagement.EntityFrameworkCore" Version="$(VoloAbpPackageVersion)" /> |
|||
</ItemGroup> |
|||
|
|||
<ItemGroup> |
|||
<ProjectReference Include="..\..\modules\auditing\LINGYUN.Abp.AuditLogging.EntityFrameworkCore\LINGYUN.Abp.AuditLogging.EntityFrameworkCore.csproj" /> |
|||
<ProjectReference Include="..\..\modules\wechat\LINGYUN.Abp.WeChat\LINGYUN.Abp.WeChat.csproj" /> |
|||
<ProjectReference Include="..\..\modules\common\LINGYUN.Abp.Data.DbMigrator\LINGYUN.Abp.Data.DbMigrator.csproj" /> |
|||
<ProjectReference Include="..\..\modules\message\LINGYUN.Abp.MessageService.EntityFrameworkCore\LINGYUN.Abp.MessageService.EntityFrameworkCore.csproj" /> |
|||
<ProjectReference Include="..\..\modules\notifications\LINGYUN.Abp.Notifications.EntityFrameworkCore\LINGYUN.Abp.Notifications.EntityFrameworkCore.csproj" /> |
|||
<ProjectReference Include="..\..\modules\saas\LINGYUN.Abp.Saas.EntityFrameworkCore\LINGYUN.Abp.Saas.EntityFrameworkCore.csproj" /> |
|||
<ProjectReference Include="..\..\modules\platform\LINGYUN.Platform.EntityFrameworkCore\LINGYUN.Platform.EntityFrameworkCore.csproj" /> |
|||
<ProjectReference Include="..\..\modules\lt\LINGYUN.Abp.LocalizationManagement.EntityFrameworkCore\LINGYUN.Abp.LocalizationManagement.EntityFrameworkCore.csproj" /> |
|||
<ProjectReference Include="..\..\modules\identityServer\LINGYUN.Abp.IdentityServer.EntityFrameworkCore\LINGYUN.Abp.IdentityServer.EntityFrameworkCore.csproj" /> |
|||
<ProjectReference Include="..\..\modules\identity\LINGYUN.Abp.Identity.EntityFrameworkCore\LINGYUN.Abp.Identity.EntityFrameworkCore.csproj" /> |
|||
<ProjectReference Include="..\..\modules\text-templating\LINGYUN.Abp.TextTemplating.EntityFrameworkCore\LINGYUN.Abp.TextTemplating.EntityFrameworkCore.csproj" /> |
|||
<ProjectReference Include="..\..\modules\task-management\LINGYUN.Abp.TaskManagement.EntityFrameworkCore\LINGYUN.Abp.TaskManagement.EntityFrameworkCore.csproj" /> |
|||
<ProjectReference Include="..\..\modules\webhooks\LINGYUN.Abp.WebhooksManagement.EntityFrameworkCore\LINGYUN.Abp.WebhooksManagement.EntityFrameworkCore.csproj" /> |
|||
</ItemGroup> |
|||
|
|||
</Project> |
|||
File diff suppressed because it is too large
File diff suppressed because it is too large
File diff suppressed because it is too large
@ -0,0 +1,204 @@ |
|||
using System; |
|||
using Microsoft.EntityFrameworkCore.Migrations; |
|||
|
|||
#nullable disable |
|||
|
|||
namespace LY.MicroService.Applications.Single.EntityFrameworkCore.Migrations |
|||
{ |
|||
/// <inheritdoc />
|
|||
public partial class AddModuleAuditing : Migration |
|||
{ |
|||
/// <inheritdoc />
|
|||
protected override void Up(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.CreateTable( |
|||
name: "AbpAuditLogs", |
|||
columns: table => new |
|||
{ |
|||
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"), |
|||
ApplicationName = table.Column<string>(type: "varchar(96)", maxLength: 96, nullable: true) |
|||
.Annotation("MySql:CharSet", "utf8mb4"), |
|||
UserId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"), |
|||
UserName = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: true) |
|||
.Annotation("MySql:CharSet", "utf8mb4"), |
|||
TenantId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"), |
|||
TenantName = table.Column<string>(type: "varchar(64)", maxLength: 64, nullable: true) |
|||
.Annotation("MySql:CharSet", "utf8mb4"), |
|||
ImpersonatorUserId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"), |
|||
ImpersonatorUserName = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: true) |
|||
.Annotation("MySql:CharSet", "utf8mb4"), |
|||
ImpersonatorTenantId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"), |
|||
ImpersonatorTenantName = table.Column<string>(type: "varchar(64)", maxLength: 64, nullable: true) |
|||
.Annotation("MySql:CharSet", "utf8mb4"), |
|||
ExecutionTime = table.Column<DateTime>(type: "datetime(6)", nullable: false), |
|||
ExecutionDuration = table.Column<int>(type: "int", nullable: false), |
|||
ClientIpAddress = table.Column<string>(type: "varchar(64)", maxLength: 64, nullable: true) |
|||
.Annotation("MySql:CharSet", "utf8mb4"), |
|||
ClientName = table.Column<string>(type: "varchar(128)", maxLength: 128, nullable: true) |
|||
.Annotation("MySql:CharSet", "utf8mb4"), |
|||
ClientId = table.Column<string>(type: "varchar(64)", maxLength: 64, nullable: true) |
|||
.Annotation("MySql:CharSet", "utf8mb4"), |
|||
CorrelationId = table.Column<string>(type: "varchar(64)", maxLength: 64, nullable: true) |
|||
.Annotation("MySql:CharSet", "utf8mb4"), |
|||
BrowserInfo = table.Column<string>(type: "varchar(512)", maxLength: 512, nullable: true) |
|||
.Annotation("MySql:CharSet", "utf8mb4"), |
|||
HttpMethod = table.Column<string>(type: "varchar(16)", maxLength: 16, nullable: true) |
|||
.Annotation("MySql:CharSet", "utf8mb4"), |
|||
Url = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: true) |
|||
.Annotation("MySql:CharSet", "utf8mb4"), |
|||
Exceptions = table.Column<string>(type: "longtext", nullable: true) |
|||
.Annotation("MySql:CharSet", "utf8mb4"), |
|||
Comments = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: true) |
|||
.Annotation("MySql:CharSet", "utf8mb4"), |
|||
HttpStatusCode = table.Column<int>(type: "int", nullable: true), |
|||
ExtraProperties = table.Column<string>(type: "longtext", nullable: true) |
|||
.Annotation("MySql:CharSet", "utf8mb4"), |
|||
ConcurrencyStamp = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: true) |
|||
.Annotation("MySql:CharSet", "utf8mb4") |
|||
}, |
|||
constraints: table => |
|||
{ |
|||
table.PrimaryKey("PK_AbpAuditLogs", x => x.Id); |
|||
}) |
|||
.Annotation("MySql:CharSet", "utf8mb4"); |
|||
|
|||
migrationBuilder.CreateTable( |
|||
name: "AbpAuditLogActions", |
|||
columns: table => new |
|||
{ |
|||
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"), |
|||
TenantId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"), |
|||
AuditLogId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"), |
|||
ServiceName = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: true) |
|||
.Annotation("MySql:CharSet", "utf8mb4"), |
|||
MethodName = table.Column<string>(type: "varchar(128)", maxLength: 128, nullable: true) |
|||
.Annotation("MySql:CharSet", "utf8mb4"), |
|||
Parameters = table.Column<string>(type: "varchar(2000)", maxLength: 2000, nullable: true) |
|||
.Annotation("MySql:CharSet", "utf8mb4"), |
|||
ExecutionTime = table.Column<DateTime>(type: "datetime(6)", nullable: false), |
|||
ExecutionDuration = table.Column<int>(type: "int", nullable: false), |
|||
ExtraProperties = table.Column<string>(type: "longtext", nullable: true) |
|||
.Annotation("MySql:CharSet", "utf8mb4") |
|||
}, |
|||
constraints: table => |
|||
{ |
|||
table.PrimaryKey("PK_AbpAuditLogActions", x => x.Id); |
|||
table.ForeignKey( |
|||
name: "FK_AbpAuditLogActions_AbpAuditLogs_AuditLogId", |
|||
column: x => x.AuditLogId, |
|||
principalTable: "AbpAuditLogs", |
|||
principalColumn: "Id", |
|||
onDelete: ReferentialAction.Cascade); |
|||
}) |
|||
.Annotation("MySql:CharSet", "utf8mb4"); |
|||
|
|||
migrationBuilder.CreateTable( |
|||
name: "AbpEntityChanges", |
|||
columns: table => new |
|||
{ |
|||
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"), |
|||
AuditLogId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"), |
|||
TenantId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"), |
|||
ChangeTime = table.Column<DateTime>(type: "datetime(6)", nullable: false), |
|||
ChangeType = table.Column<byte>(type: "tinyint unsigned", nullable: false), |
|||
EntityTenantId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"), |
|||
EntityId = table.Column<string>(type: "varchar(128)", maxLength: 128, nullable: false) |
|||
.Annotation("MySql:CharSet", "utf8mb4"), |
|||
EntityTypeFullName = table.Column<string>(type: "varchar(128)", maxLength: 128, nullable: false) |
|||
.Annotation("MySql:CharSet", "utf8mb4"), |
|||
ExtraProperties = table.Column<string>(type: "longtext", nullable: true) |
|||
.Annotation("MySql:CharSet", "utf8mb4") |
|||
}, |
|||
constraints: table => |
|||
{ |
|||
table.PrimaryKey("PK_AbpEntityChanges", x => x.Id); |
|||
table.ForeignKey( |
|||
name: "FK_AbpEntityChanges_AbpAuditLogs_AuditLogId", |
|||
column: x => x.AuditLogId, |
|||
principalTable: "AbpAuditLogs", |
|||
principalColumn: "Id", |
|||
onDelete: ReferentialAction.Cascade); |
|||
}) |
|||
.Annotation("MySql:CharSet", "utf8mb4"); |
|||
|
|||
migrationBuilder.CreateTable( |
|||
name: "AbpEntityPropertyChanges", |
|||
columns: table => new |
|||
{ |
|||
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"), |
|||
TenantId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"), |
|||
EntityChangeId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"), |
|||
NewValue = table.Column<string>(type: "varchar(512)", maxLength: 512, nullable: true) |
|||
.Annotation("MySql:CharSet", "utf8mb4"), |
|||
OriginalValue = table.Column<string>(type: "varchar(512)", maxLength: 512, nullable: true) |
|||
.Annotation("MySql:CharSet", "utf8mb4"), |
|||
PropertyName = table.Column<string>(type: "varchar(128)", maxLength: 128, nullable: false) |
|||
.Annotation("MySql:CharSet", "utf8mb4"), |
|||
PropertyTypeFullName = table.Column<string>(type: "varchar(64)", maxLength: 64, nullable: false) |
|||
.Annotation("MySql:CharSet", "utf8mb4") |
|||
}, |
|||
constraints: table => |
|||
{ |
|||
table.PrimaryKey("PK_AbpEntityPropertyChanges", x => x.Id); |
|||
table.ForeignKey( |
|||
name: "FK_AbpEntityPropertyChanges_AbpEntityChanges_EntityChangeId", |
|||
column: x => x.EntityChangeId, |
|||
principalTable: "AbpEntityChanges", |
|||
principalColumn: "Id", |
|||
onDelete: ReferentialAction.Cascade); |
|||
}) |
|||
.Annotation("MySql:CharSet", "utf8mb4"); |
|||
|
|||
migrationBuilder.CreateIndex( |
|||
name: "IX_AbpAuditLogActions_AuditLogId", |
|||
table: "AbpAuditLogActions", |
|||
column: "AuditLogId"); |
|||
|
|||
migrationBuilder.CreateIndex( |
|||
name: "IX_AbpAuditLogActions_TenantId_ServiceName_MethodName_Execution~", |
|||
table: "AbpAuditLogActions", |
|||
columns: new[] { "TenantId", "ServiceName", "MethodName", "ExecutionTime" }); |
|||
|
|||
migrationBuilder.CreateIndex( |
|||
name: "IX_AbpAuditLogs_TenantId_ExecutionTime", |
|||
table: "AbpAuditLogs", |
|||
columns: new[] { "TenantId", "ExecutionTime" }); |
|||
|
|||
migrationBuilder.CreateIndex( |
|||
name: "IX_AbpAuditLogs_TenantId_UserId_ExecutionTime", |
|||
table: "AbpAuditLogs", |
|||
columns: new[] { "TenantId", "UserId", "ExecutionTime" }); |
|||
|
|||
migrationBuilder.CreateIndex( |
|||
name: "IX_AbpEntityChanges_AuditLogId", |
|||
table: "AbpEntityChanges", |
|||
column: "AuditLogId"); |
|||
|
|||
migrationBuilder.CreateIndex( |
|||
name: "IX_AbpEntityChanges_TenantId_EntityTypeFullName_EntityId", |
|||
table: "AbpEntityChanges", |
|||
columns: new[] { "TenantId", "EntityTypeFullName", "EntityId" }); |
|||
|
|||
migrationBuilder.CreateIndex( |
|||
name: "IX_AbpEntityPropertyChanges_EntityChangeId", |
|||
table: "AbpEntityPropertyChanges", |
|||
column: "EntityChangeId"); |
|||
} |
|||
|
|||
/// <inheritdoc />
|
|||
protected override void Down(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.DropTable( |
|||
name: "AbpAuditLogActions"); |
|||
|
|||
migrationBuilder.DropTable( |
|||
name: "AbpEntityPropertyChanges"); |
|||
|
|||
migrationBuilder.DropTable( |
|||
name: "AbpEntityChanges"); |
|||
|
|||
migrationBuilder.DropTable( |
|||
name: "AbpAuditLogs"); |
|||
} |
|||
} |
|||
} |
|||
File diff suppressed because it is too large
@ -0,0 +1,221 @@ |
|||
using LINGYUN.Abp.Data.DbMigrator; |
|||
using LINGYUN.Abp.Saas.Tenants; |
|||
using Microsoft.EntityFrameworkCore; |
|||
using Microsoft.Extensions.Logging; |
|||
using Microsoft.Extensions.Logging.Abstractions; |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Diagnostics; |
|||
using System.IO; |
|||
using System.Linq; |
|||
using System.Runtime.InteropServices; |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp.Data; |
|||
using Volo.Abp.DependencyInjection; |
|||
using Volo.Abp.MultiTenancy; |
|||
|
|||
namespace LY.MicroService.Applications.Single.EntityFrameworkCore; |
|||
|
|||
public class SingleDbMigrationService : ITransientDependency |
|||
{ |
|||
public ILogger<SingleDbMigrationService> Logger { get; set; } |
|||
|
|||
private readonly IDataSeeder _dataSeeder; |
|||
private readonly IDbSchemaMigrator _dbSchemaMigrator; |
|||
private readonly ITenantRepository _tenantRepository; |
|||
private readonly ICurrentTenant _currentTenant; |
|||
|
|||
public SingleDbMigrationService( |
|||
IDataSeeder dataSeeder, |
|||
IDbSchemaMigrator dbSchemaMigrator, |
|||
ITenantRepository tenantRepository, |
|||
ICurrentTenant currentTenant) |
|||
{ |
|||
_dataSeeder = dataSeeder; |
|||
_dbSchemaMigrator = dbSchemaMigrator; |
|||
_tenantRepository = tenantRepository; |
|||
_currentTenant = currentTenant; |
|||
|
|||
Logger = NullLogger<SingleDbMigrationService>.Instance; |
|||
} |
|||
|
|||
public async Task MigrateAsync() |
|||
{ |
|||
var initialMigrationAdded = AddInitialMigrationIfNotExist(); |
|||
|
|||
if (initialMigrationAdded) |
|||
{ |
|||
return; |
|||
} |
|||
|
|||
Logger.LogInformation("Started database migrations..."); |
|||
|
|||
await MigrateDatabaseSchemaAsync(); |
|||
await SeedDataAsync(); |
|||
|
|||
Logger.LogInformation($"Successfully completed host database migrations."); |
|||
|
|||
var tenants = await _tenantRepository.GetListAsync(includeDetails: true); |
|||
|
|||
var migratedDatabaseSchemas = new HashSet<string>(); |
|||
foreach (var tenant in tenants) |
|||
{ |
|||
using (_currentTenant.Change(tenant.Id)) |
|||
{ |
|||
if (tenant.ConnectionStrings.Any()) |
|||
{ |
|||
var tenantConnectionStrings = tenant.ConnectionStrings |
|||
.Select(x => x.Value) |
|||
.ToList(); |
|||
|
|||
if (!migratedDatabaseSchemas.IsSupersetOf(tenantConnectionStrings)) |
|||
{ |
|||
await MigrateDatabaseSchemaAsync(tenant); |
|||
|
|||
migratedDatabaseSchemas.AddIfNotContains(tenantConnectionStrings); |
|||
} |
|||
} |
|||
|
|||
await SeedDataAsync(tenant); |
|||
} |
|||
|
|||
Logger.LogInformation($"Successfully completed {tenant.Name} tenant database migrations."); |
|||
} |
|||
|
|||
Logger.LogInformation("Successfully completed all database migrations."); |
|||
Logger.LogInformation("You can safely end this process..."); |
|||
} |
|||
|
|||
private async Task MigrateDatabaseSchemaAsync(Tenant tenant = null) |
|||
{ |
|||
Logger.LogInformation($"Migrating schema for {(tenant == null ? "host" : tenant.Name + " tenant")} database..."); |
|||
// 迁移租户数据
|
|||
await _dbSchemaMigrator.MigrateAsync<SingleMigrationsDbContext>( |
|||
(connectionString, builder) => |
|||
{ |
|||
builder.UseMySql(connectionString, ServerVersion.AutoDetect(connectionString)); |
|||
|
|||
return new SingleMigrationsDbContext(builder.Options); |
|||
}); |
|||
} |
|||
|
|||
private async Task SeedDataAsync(Tenant tenant = null) |
|||
{ |
|||
Logger.LogInformation($"Executing {(tenant == null ? "host" : tenant.Name + " tenant")} database seed..."); |
|||
|
|||
await _dataSeeder.SeedAsync(tenant?.Id); |
|||
} |
|||
|
|||
private bool AddInitialMigrationIfNotExist() |
|||
{ |
|||
try |
|||
{ |
|||
if (!DbMigrationsProjectExists()) |
|||
{ |
|||
return false; |
|||
} |
|||
} |
|||
catch (Exception) |
|||
{ |
|||
return false; |
|||
} |
|||
|
|||
try |
|||
{ |
|||
if (!MigrationsFolderExists()) |
|||
{ |
|||
AddInitialMigration(); |
|||
return true; |
|||
} |
|||
else |
|||
{ |
|||
return false; |
|||
} |
|||
} |
|||
catch (Exception e) |
|||
{ |
|||
Logger.LogWarning("Couldn't determinate if any migrations exist : " + e.Message); |
|||
return false; |
|||
} |
|||
} |
|||
|
|||
private bool DbMigrationsProjectExists() |
|||
{ |
|||
return Directory.Exists(GetEntityFrameworkCoreProjectFolderPath()); |
|||
} |
|||
|
|||
private bool MigrationsFolderExists() |
|||
{ |
|||
var dbMigrationsProjectFolder = GetEntityFrameworkCoreProjectFolderPath(); |
|||
|
|||
return Directory.Exists(Path.Combine(dbMigrationsProjectFolder, "Migrations")); |
|||
} |
|||
|
|||
private void AddInitialMigration() |
|||
{ |
|||
Logger.LogInformation("Creating initial migration..."); |
|||
|
|||
string argumentPrefix; |
|||
string fileName; |
|||
|
|||
if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX) || RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) |
|||
{ |
|||
argumentPrefix = "-c"; |
|||
fileName = "/bin/bash"; |
|||
} |
|||
else |
|||
{ |
|||
argumentPrefix = "/C"; |
|||
fileName = "cmd.exe"; |
|||
} |
|||
|
|||
var procStartInfo = new ProcessStartInfo(fileName, |
|||
$"{argumentPrefix} \"abp create-migration-and-run-migrator \"{GetEntityFrameworkCoreProjectFolderPath()}\" --nolayers\"" |
|||
); |
|||
|
|||
try |
|||
{ |
|||
Process.Start(procStartInfo); |
|||
} |
|||
catch (Exception) |
|||
{ |
|||
throw new Exception("Couldn't run ABP CLI..."); |
|||
} |
|||
} |
|||
|
|||
private string GetEntityFrameworkCoreProjectFolderPath() |
|||
{ |
|||
var slnDirectoryPath = GetSolutionDirectoryPath(); |
|||
|
|||
if (slnDirectoryPath == null) |
|||
{ |
|||
throw new Exception("Solution folder not found!"); |
|||
} |
|||
|
|||
return Path.Combine(slnDirectoryPath, "LY.MicroService.RealtimeMessage.DbMigrator"); |
|||
} |
|||
|
|||
private string GetSolutionDirectoryPath() |
|||
{ |
|||
var currentDirectory = new DirectoryInfo(Directory.GetCurrentDirectory()); |
|||
|
|||
while (Directory.GetParent(currentDirectory.FullName) != null) |
|||
{ |
|||
currentDirectory = Directory.GetParent(currentDirectory.FullName); |
|||
|
|||
if (Directory.GetFiles(currentDirectory!.FullName).FirstOrDefault(f => f.EndsWith(".sln")) != null) |
|||
{ |
|||
return currentDirectory.FullName; |
|||
} |
|||
|
|||
// parent host
|
|||
currentDirectory = Directory.GetParent(currentDirectory.FullName); |
|||
if (Directory.GetFiles(currentDirectory!.FullName).FirstOrDefault(f => f.EndsWith(".sln")) != null) |
|||
{ |
|||
return currentDirectory.FullName; |
|||
} |
|||
} |
|||
|
|||
return null; |
|||
} |
|||
} |
|||
@ -0,0 +1,52 @@ |
|||
using LINGYUN.Abp.LocalizationManagement.EntityFrameworkCore; |
|||
using LINGYUN.Abp.MessageService.EntityFrameworkCore; |
|||
using LINGYUN.Abp.Notifications.EntityFrameworkCore; |
|||
using LINGYUN.Abp.Saas.EntityFrameworkCore; |
|||
using LINGYUN.Abp.TaskManagement.EntityFrameworkCore; |
|||
using LINGYUN.Abp.TextTemplating.EntityFrameworkCore; |
|||
using LINGYUN.Abp.WebhooksManagement.EntityFrameworkCore; |
|||
using LINGYUN.Platform.EntityFrameworkCore; |
|||
using Microsoft.EntityFrameworkCore; |
|||
using Volo.Abp.AuditLogging.EntityFrameworkCore; |
|||
using Volo.Abp.Data; |
|||
using Volo.Abp.EntityFrameworkCore; |
|||
using Volo.Abp.FeatureManagement.EntityFrameworkCore; |
|||
using Volo.Abp.Identity.EntityFrameworkCore; |
|||
using Volo.Abp.IdentityServer.EntityFrameworkCore; |
|||
using Volo.Abp.OpenIddict.EntityFrameworkCore; |
|||
using Volo.Abp.PermissionManagement.EntityFrameworkCore; |
|||
using Volo.Abp.SettingManagement.EntityFrameworkCore; |
|||
|
|||
namespace LY.MicroService.Applications.Single.EntityFrameworkCore; |
|||
|
|||
[ConnectionStringName("SingleDbMigrator")] |
|||
public class SingleMigrationsDbContext : AbpDbContext<SingleMigrationsDbContext> |
|||
{ |
|||
public SingleMigrationsDbContext(DbContextOptions<SingleMigrationsDbContext> options) |
|||
: base(options) |
|||
{ |
|||
|
|||
} |
|||
|
|||
protected override void OnModelCreating(ModelBuilder modelBuilder) |
|||
{ |
|||
base.OnModelCreating(modelBuilder); |
|||
|
|||
modelBuilder.ConfigureAuditLogging(); |
|||
modelBuilder.ConfigureIdentity(); |
|||
modelBuilder.ConfigureIdentityServer(); |
|||
modelBuilder.ConfigureOpenIddict(); |
|||
modelBuilder.ConfigureSaas(); |
|||
modelBuilder.ConfigureFeatureManagement(); |
|||
modelBuilder.ConfigureSettingManagement(); |
|||
modelBuilder.ConfigurePermissionManagement(); |
|||
modelBuilder.ConfigureTextTemplating(); |
|||
modelBuilder.ConfigureTaskManagement(); |
|||
modelBuilder.ConfigureWebhooksManagement(); |
|||
modelBuilder.ConfigurePlatform(); |
|||
modelBuilder.ConfigureLocalization(); |
|||
modelBuilder.ConfigureNotifications(); |
|||
modelBuilder.ConfigureNotificationsDefinition(); |
|||
modelBuilder.ConfigureMessageService(); |
|||
} |
|||
} |
|||
@ -0,0 +1,29 @@ |
|||
using Microsoft.EntityFrameworkCore; |
|||
using Microsoft.EntityFrameworkCore.Design; |
|||
using Microsoft.Extensions.Configuration; |
|||
using System.IO; |
|||
|
|||
namespace LY.MicroService.Applications.Single.EntityFrameworkCore; |
|||
|
|||
public class SingleMigrationsDbContextFactory : IDesignTimeDbContextFactory<SingleMigrationsDbContext> |
|||
{ |
|||
public SingleMigrationsDbContext CreateDbContext(string[] args) |
|||
{ |
|||
var configuration = BuildConfiguration(); |
|||
var connectionString = configuration.GetConnectionString("Default"); |
|||
|
|||
var builder = new DbContextOptionsBuilder<SingleMigrationsDbContext>() |
|||
.UseMySql(connectionString, ServerVersion.AutoDetect(connectionString)); |
|||
|
|||
return new SingleMigrationsDbContext(builder!.Options); |
|||
} |
|||
|
|||
private static IConfigurationRoot BuildConfiguration() |
|||
{ |
|||
var builder = new ConfigurationBuilder() |
|||
.SetBasePath(Path.Combine(Directory.GetCurrentDirectory(), "../LY.MicroService.Applications.Single.DbMigrator/")) |
|||
.AddJsonFile("appsettings.json", optional: false); |
|||
|
|||
return builder.Build(); |
|||
} |
|||
} |
|||
@ -0,0 +1,56 @@ |
|||
using LINGYUN.Abp.AuditLogging.EntityFrameworkCore; |
|||
using LINGYUN.Abp.Data.DbMigrator; |
|||
using LINGYUN.Abp.Identity.EntityFrameworkCore; |
|||
using LINGYUN.Abp.IdentityServer.EntityFrameworkCore; |
|||
using LINGYUN.Abp.LocalizationManagement.EntityFrameworkCore; |
|||
using LINGYUN.Abp.MessageService.EntityFrameworkCore; |
|||
using LINGYUN.Abp.Notifications.EntityFrameworkCore; |
|||
using LINGYUN.Abp.Saas.EntityFrameworkCore; |
|||
using LINGYUN.Abp.TaskManagement.EntityFrameworkCore; |
|||
using LINGYUN.Abp.TextTemplating.EntityFrameworkCore; |
|||
using LINGYUN.Abp.WebhooksManagement.EntityFrameworkCore; |
|||
using LINGYUN.Abp.WeChat; |
|||
using LINGYUN.Platform.EntityFrameworkCore; |
|||
using Microsoft.Extensions.DependencyInjection; |
|||
using Volo.Abp.EntityFrameworkCore; |
|||
using Volo.Abp.EntityFrameworkCore.MySQL; |
|||
using Volo.Abp.FeatureManagement.EntityFrameworkCore; |
|||
using Volo.Abp.Modularity; |
|||
using Volo.Abp.OpenIddict.EntityFrameworkCore; |
|||
using Volo.Abp.PermissionManagement.EntityFrameworkCore; |
|||
using Volo.Abp.SettingManagement.EntityFrameworkCore; |
|||
|
|||
namespace LY.MicroService.Applications.Single.EntityFrameworkCore; |
|||
|
|||
[DependsOn( |
|||
typeof(AbpSaasEntityFrameworkCoreModule), |
|||
typeof(AbpAuditLoggingEntityFrameworkCoreModule), |
|||
typeof(AbpSettingManagementEntityFrameworkCoreModule), |
|||
typeof(AbpPermissionManagementEntityFrameworkCoreModule), |
|||
typeof(AbpFeatureManagementEntityFrameworkCoreModule), |
|||
typeof(AbpNotificationsEntityFrameworkCoreModule), |
|||
typeof(AbpMessageServiceEntityFrameworkCoreModule), |
|||
typeof(PlatformEntityFrameworkCoreModule), |
|||
typeof(AbpLocalizationManagementEntityFrameworkCoreModule), |
|||
typeof(AbpIdentityEntityFrameworkCoreModule), |
|||
typeof(AbpIdentityServerEntityFrameworkCoreModule), |
|||
typeof(AbpOpenIddictEntityFrameworkCoreModule), |
|||
typeof(AbpTextTemplatingEntityFrameworkCoreModule), |
|||
typeof(WebhooksManagementEntityFrameworkCoreModule), |
|||
typeof(TaskManagementEntityFrameworkCoreModule), |
|||
typeof(AbpEntityFrameworkCoreMySQLModule), |
|||
typeof(AbpWeChatModule), |
|||
typeof(AbpDataDbMigratorModule) |
|||
)] |
|||
public class SingleMigrationsEntityFrameworkCoreModule : AbpModule |
|||
{ |
|||
public override void ConfigureServices(ServiceConfigurationContext context) |
|||
{ |
|||
context.Services.AddAbpDbContext<SingleMigrationsDbContext>(); |
|||
|
|||
Configure<AbpDbContextOptions>(options => |
|||
{ |
|||
options.UseMySQL(); |
|||
}); |
|||
} |
|||
} |
|||
@ -0,0 +1,12 @@ |
|||
{ |
|||
"version": 1, |
|||
"isRoot": true, |
|||
"tools": { |
|||
"dotnet-ef": { |
|||
"version": "7.0.3", |
|||
"commands": [ |
|||
"dotnet-ef" |
|||
] |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,11 @@ |
|||
using Microsoft.AspNetCore.Mvc; |
|||
|
|||
namespace LY.MicroService.Applications.Single.Controllers; |
|||
|
|||
public class HomeController : Controller |
|||
{ |
|||
public IActionResult Index() |
|||
{ |
|||
return Redirect("/swagger"); |
|||
} |
|||
} |
|||
@ -0,0 +1,18 @@ |
|||
using Volo.Abp.Data; |
|||
|
|||
namespace LY.MicroService.Applications.Single.DataSeeder; |
|||
|
|||
public class DataSeederWorker : BackgroundService |
|||
{ |
|||
protected IDataSeeder DataSeeder { get; } |
|||
|
|||
public DataSeederWorker(IDataSeeder dataSeeder) |
|||
{ |
|||
DataSeeder = dataSeeder; |
|||
} |
|||
|
|||
protected async override Task ExecuteAsync(CancellationToken stoppingToken) |
|||
{ |
|||
await DataSeeder.SeedAsync(); |
|||
} |
|||
} |
|||
@ -0,0 +1,145 @@ |
|||
using LINGYUN.Abp.BackgroundTasks; |
|||
using LINGYUN.Abp.BackgroundTasks.Internal; |
|||
using LINGYUN.Abp.Data.DbMigrator; |
|||
using LINGYUN.Abp.MultiTenancy; |
|||
using LINGYUN.Abp.Saas.Tenants; |
|||
using LY.MicroService.Applications.Single.EntityFrameworkCore; |
|||
using Microsoft.EntityFrameworkCore; |
|||
using Microsoft.Extensions.Options; |
|||
using Volo.Abp.DependencyInjection; |
|||
using Volo.Abp.Domain.Entities.Events.Distributed; |
|||
using Volo.Abp.EventBus.Distributed; |
|||
using Volo.Abp.MultiTenancy; |
|||
using Volo.Abp.Uow; |
|||
|
|||
namespace LY.MicroService.Applications.Single.EventBus.Handlers |
|||
{ |
|||
public class TenantSynchronizer : |
|||
IDistributedEventHandler<CreateEventData>, |
|||
IDistributedEventHandler<EntityDeletedEto<TenantEto>>, |
|||
ITransientDependency |
|||
{ |
|||
protected ILogger<TenantSynchronizer> Logger { get; } |
|||
|
|||
protected ICurrentTenant CurrentTenant { get; } |
|||
protected IUnitOfWorkManager UnitOfWorkManager { get; } |
|||
protected IDbSchemaMigrator DbSchemaMigrator { get; } |
|||
protected AbpBackgroundTasksOptions Options { get; } |
|||
protected IJobStore JobStore { get; } |
|||
protected IJobScheduler JobScheduler { get; } |
|||
public TenantSynchronizer( |
|||
ICurrentTenant currentTenant, |
|||
IUnitOfWorkManager unitOfWorkManager, |
|||
IDbSchemaMigrator dbSchemaMigrator, |
|||
IOptions<AbpBackgroundTasksOptions> options, |
|||
IJobStore jobStore, |
|||
IJobScheduler jobScheduler, |
|||
ILogger<TenantSynchronizer> logger) |
|||
{ |
|||
CurrentTenant = currentTenant; |
|||
UnitOfWorkManager = unitOfWorkManager; |
|||
DbSchemaMigrator = dbSchemaMigrator; |
|||
JobStore = jobStore; |
|||
JobScheduler = jobScheduler; |
|||
Options = options.Value; |
|||
|
|||
Logger = logger; |
|||
} |
|||
|
|||
public async Task HandleEventAsync(EntityDeletedEto<TenantEto> eventData) |
|||
{ |
|||
// 租户删除时移除轮询作业
|
|||
var pollingJob = BuildPollingJobInfo(eventData.Entity.Id, eventData.Entity.Name); |
|||
await JobScheduler.RemoveAsync(pollingJob); |
|||
await JobStore.RemoveAsync(pollingJob.Id); |
|||
|
|||
var cleaningJob = BuildCleaningJobInfo(eventData.Entity.Id, eventData.Entity.Name); |
|||
await JobScheduler.RemoveAsync(cleaningJob); |
|||
await JobStore.RemoveAsync(cleaningJob.Id); |
|||
} |
|||
|
|||
public async Task HandleEventAsync(CreateEventData eventData) |
|||
{ |
|||
await MigrateAsync(eventData); |
|||
|
|||
// 持久层介入之后提供对于租户的后台工作者轮询作业
|
|||
await QueueBackgroundJobAsync(eventData); |
|||
} |
|||
|
|||
private async Task QueueBackgroundJobAsync(CreateEventData eventData) |
|||
{ |
|||
var pollingJob = BuildPollingJobInfo(eventData.Id, eventData.Name); |
|||
await JobStore.StoreAsync(pollingJob); |
|||
await JobScheduler.QueueAsync(pollingJob); |
|||
|
|||
var cleaningJob = BuildCleaningJobInfo(eventData.Id, eventData.Name); |
|||
await JobStore.StoreAsync(cleaningJob); |
|||
await JobScheduler.QueueAsync(cleaningJob); |
|||
} |
|||
|
|||
private async Task MigrateAsync(CreateEventData eventData) |
|||
{ |
|||
using (var unitOfWork = UnitOfWorkManager.Begin()) |
|||
{ |
|||
using (CurrentTenant.Change(eventData.Id, eventData.Name)) |
|||
{ |
|||
Logger.LogInformation("Migrating the new tenant database with localization.."); |
|||
// 迁移租户数据
|
|||
await DbSchemaMigrator.MigrateAsync<SingleMigrationsDbContext>( |
|||
(connectionString, builder) => |
|||
{ |
|||
builder.UseMySql(connectionString, ServerVersion.AutoDetect(connectionString)); |
|||
|
|||
return new SingleMigrationsDbContext(builder.Options); |
|||
}); |
|||
await unitOfWork.SaveChangesAsync(); |
|||
|
|||
Logger.LogInformation("Migrated the new tenant database with localization."); |
|||
} |
|||
} |
|||
} |
|||
|
|||
private JobInfo BuildPollingJobInfo(Guid tenantId, string tenantName) |
|||
{ |
|||
return new JobInfo |
|||
{ |
|||
Id = tenantId.ToString() + "_Polling", |
|||
Name = nameof(BackgroundPollingJob), |
|||
Group = "Polling", |
|||
Description = "Polling tasks to be executed", |
|||
Args = new Dictionary<string, object>() { { nameof(JobInfo.TenantId), tenantId } }, |
|||
Status = JobStatus.Running, |
|||
BeginTime = DateTime.Now, |
|||
CreationTime = DateTime.Now, |
|||
Cron = Options.JobFetchCronExpression, |
|||
JobType = JobType.Period, |
|||
Priority = JobPriority.High, |
|||
Source = JobSource.System, |
|||
LockTimeOut = Options.JobFetchLockTimeOut, |
|||
TenantId = tenantId, |
|||
Type = typeof(BackgroundPollingJob).AssemblyQualifiedName, |
|||
}; |
|||
} |
|||
|
|||
private JobInfo BuildCleaningJobInfo(Guid tenantId, string tenantName) |
|||
{ |
|||
return new JobInfo |
|||
{ |
|||
Id = tenantId.ToString() + "_Cleaning", |
|||
Name = nameof(BackgroundCleaningJob), |
|||
Group = "Cleaning", |
|||
Description = "Cleaning tasks to be executed", |
|||
Args = new Dictionary<string, object>() { { nameof(JobInfo.TenantId), tenantId } }, |
|||
Status = JobStatus.Running, |
|||
BeginTime = DateTime.Now, |
|||
CreationTime = DateTime.Now, |
|||
Cron = Options.JobCleanCronExpression, |
|||
JobType = JobType.Period, |
|||
Priority = JobPriority.High, |
|||
Source = JobSource.System, |
|||
TenantId = tenantId, |
|||
Type = typeof(BackgroundCleaningJob).AssemblyQualifiedName, |
|||
}; |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,19 @@ |
|||
using IdentityServer4.Models; |
|||
using LINGYUN.Abp.Identity; |
|||
|
|||
namespace LY.MicroService.Applications.Single.IdentityResources; |
|||
|
|||
public class CustomIdentityResources |
|||
{ |
|||
public class AvatarUrl : IdentityResource |
|||
{ |
|||
public AvatarUrl() |
|||
{ |
|||
Name = IdentityConsts.ClaimType.Avatar.Name; |
|||
DisplayName = IdentityConsts.ClaimType.Avatar.DisplayName; |
|||
Description = IdentityConsts.ClaimType.Avatar.Description; |
|||
Emphasize = true; |
|||
UserClaims = new string[] { IdentityConsts.ClaimType.Avatar.Name }; |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,225 @@ |
|||
<Project Sdk="Microsoft.NET.Sdk.Web"> |
|||
|
|||
<PropertyGroup> |
|||
<TargetFramework>net7.0</TargetFramework> |
|||
<ImplicitUsings>enable</ImplicitUsings> |
|||
<RootNamespace>LY.MicroService.Applications.Single</RootNamespace> |
|||
</PropertyGroup> |
|||
|
|||
<ItemGroup> |
|||
<PackageReference Include="DistributedLock.Redis" Version="$(DistributedLockRedisPackageVersion)" /> |
|||
<PackageReference Include="Elsa.Activities.Email" Version="$(ElsaPackageVersion)" /> |
|||
<PackageReference Include="Elsa.Activities.Http" Version="$(ElsaPackageVersion)" /> |
|||
<PackageReference Include="Elsa.Activities.UserTask" Version="$(ElsaPackageVersion)" /> |
|||
<PackageReference Include="Elsa.Activities.Temporal.Quartz" Version="$(ElsaPackageVersion)" /> |
|||
<!--<PackageReference Include="Elsa.Designer.Components.Web" Version="$(ElsaPackageVersion)" />--> |
|||
<PackageReference Include="Elsa.Webhooks.Api" Version="$(ElsaPackageVersion)" /> |
|||
<PackageReference Include="Microsoft.AspNetCore.DataProtection.StackExchangeRedis" Version="$(MicrosoftPackageVersion)" /> |
|||
<PackageReference Include="Serilog.AspNetCore" Version="$(SerilogAspNetCorePackageVersion)" /> |
|||
<PackageReference Include="Serilog.Enrichers.Environment" Version="$(SerilogEnrichersEnvironmentPackageVersion)" /> |
|||
<PackageReference Include="Serilog.Enrichers.Assembly" Version="$(SerilogEnrichersAssemblyPackageVersion)" /> |
|||
<PackageReference Include="Serilog.Enrichers.Process" Version="$(SerilogEnrichersProcessPackageVersion)" /> |
|||
<PackageReference Include="Serilog.Enrichers.Thread" Version="$(SerilogEnrichersThreadPackageVersion)" /> |
|||
<PackageReference Include="Serilog.Settings.Configuration" Version="$(SerilogSettingsConfigurationPackageVersion)" /> |
|||
<PackageReference Include="Serilog.Sinks.Elasticsearch" Version="$(SerilogSinksElasticsearchPackageVersion)" /> |
|||
<PackageReference Include="Serilog.Sinks.File" Version="$(SerilogSinksFilePackageVersion)" /> |
|||
<PackageReference Include="Swashbuckle.AspNetCore" Version="$(SwashbuckleAspNetCorePackageVersion)" /> |
|||
<PackageReference Include="Quartz.Serialization.Json" Version="$(QuartzNETPackageVersion)" /> |
|||
<PackageReference Include="Volo.Abp.AspNetCore.Serilog" Version="$(VoloAbpPackageVersion)" /> |
|||
<PackageReference Include="Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy" Version="$(VoloAbpPackageVersion)" /> |
|||
<PackageReference Include="Volo.Abp.AspNetCore.Authentication.JwtBearer" Version="$(VoloAbpPackageVersion)" /> |
|||
<PackageReference Include="Volo.Abp.Autofac" Version="$(VoloAbpPackageVersion)" /> |
|||
<PackageReference Include="Volo.Abp.Caching.StackExchangeRedis" Version="$(VoloAbpPackageVersion)" /> |
|||
<PackageReference Include="Volo.Abp.EntityFrameworkCore.MySQL" Version="$(VoloAbpPackageVersion)" /> |
|||
<PackageReference Include="Volo.Abp.FeatureManagement.Application" Version="$(VoloAbpPackageVersion)" /> |
|||
<PackageReference Include="Volo.Abp.FeatureManagement.EntityFrameworkCore" Version="$(VoloAbpPackageVersion)" /> |
|||
<PackageReference Include="Volo.Abp.FeatureManagement.HttpApi" Version="$(VoloAbpPackageVersion)" /> |
|||
<PackageReference Include="Volo.Abp.PermissionManagement.Application" Version="$(VoloAbpPackageVersion)" /> |
|||
<PackageReference Include="Volo.Abp.PermissionManagement.Domain.Identity" Version="$(VoloAbpPackageVersion)" /> |
|||
<PackageReference Include="Volo.Abp.PermissionManagement.Domain.IdentityServer" Version="$(VoloAbpPackageVersion)" /> |
|||
<PackageReference Include="Volo.Abp.PermissionManagement.HttpApi" Version="$(VoloAbpPackageVersion)" /> |
|||
<PackageReference Include="Volo.Abp.Identity.AspNetCore" Version="$(VoloAbpPackageVersion)" /> |
|||
<PackageReference Include="Volo.Abp.IdentityServer.EntityFrameworkCore" Version="$(VoloAbpPackageVersion)" /> |
|||
<PackageReference Include="Volo.Abp.SettingManagement.EntityFrameworkCore" Version="$(VoloAbpPackageVersion)" /> |
|||
<PackageReference Include="Volo.Abp.PermissionManagement.EntityFrameworkCore" Version="$(VoloAbpPackageVersion)" /> |
|||
<PackageReference Include="Volo.Abp.OpenIddict.EntityFrameworkCore" Version="$(VoloAbpPackageVersion)" /> |
|||
</ItemGroup> |
|||
|
|||
<ItemGroup> |
|||
<ProjectReference Include="..\..\migrations\LY.MicroService.Applications.Single.EntityFrameworkCore\LY.MicroService.Applications.Single.EntityFrameworkCore.csproj" /> |
|||
<ProjectReference Include="..\..\modules\account\LINGYUN.Abp.Account.Application.Contracts\LINGYUN.Abp.Account.Application.Contracts.csproj" /> |
|||
<ProjectReference Include="..\..\modules\account\LINGYUN.Abp.Account.Application\LINGYUN.Abp.Account.Application.csproj" /> |
|||
<ProjectReference Include="..\..\modules\account\LINGYUN.Abp.Account.HttpApi\LINGYUN.Abp.Account.HttpApi.csproj" /> |
|||
<ProjectReference Include="..\..\modules\account\LINGYUN.Abp.Account.Templates\LINGYUN.Abp.Account.Templates.csproj" /> |
|||
<ProjectReference Include="..\..\modules\auditing\LINGYUN.Abp.Auditing.Application.Contracts\LINGYUN.Abp.Auditing.Application.Contracts.csproj" /> |
|||
<ProjectReference Include="..\..\modules\auditing\LINGYUN.Abp.Auditing.Application\LINGYUN.Abp.Auditing.Application.csproj" /> |
|||
<ProjectReference Include="..\..\modules\auditing\LINGYUN.Abp.Auditing.HttpApi\LINGYUN.Abp.Auditing.HttpApi.csproj" /> |
|||
<ProjectReference Include="..\..\modules\auditing\LINGYUN.Abp.AuditLogging.Elasticsearch\LINGYUN.Abp.AuditLogging.Elasticsearch.csproj" /> |
|||
<ProjectReference Include="..\..\modules\auditing\LINGYUN.Abp.AuditLogging.EntityFrameworkCore\LINGYUN.Abp.AuditLogging.EntityFrameworkCore.csproj" /> |
|||
<ProjectReference Include="..\..\modules\auditing\LINGYUN.Abp.AuditLogging\LINGYUN.Abp.AuditLogging.csproj" /> |
|||
<ProjectReference Include="..\..\modules\authentication\LINGYUN.Abp.Authentication.QQ\LINGYUN.Abp.Authentication.QQ.csproj" /> |
|||
<ProjectReference Include="..\..\modules\authentication\LINGYUN.Abp.Authentication.WeChat\LINGYUN.Abp.Authentication.WeChat.csproj" /> |
|||
<ProjectReference Include="..\..\modules\authorization\LINGYUN.Abp.Authorization.OrganizationUnits\LINGYUN.Abp.Authorization.OrganizationUnits.csproj" /> |
|||
<ProjectReference Include="..\..\modules\authorization\LINGYUN.Abp.Identity.OrganizaztionUnits\LINGYUN.Abp.Identity.OrganizaztionUnits.csproj" /> |
|||
<ProjectReference Include="..\..\modules\caching\LINGYUN.Abp.CachingManagement.Application.Contracts\LINGYUN.Abp.CachingManagement.Application.Contracts.csproj" /> |
|||
<ProjectReference Include="..\..\modules\caching\LINGYUN.Abp.CachingManagement.Application\LINGYUN.Abp.CachingManagement.Application.csproj" /> |
|||
<ProjectReference Include="..\..\modules\caching\LINGYUN.Abp.CachingManagement.Domain\LINGYUN.Abp.CachingManagement.Domain.csproj" /> |
|||
<ProjectReference Include="..\..\modules\caching\LINGYUN.Abp.CachingManagement.HttpApi\LINGYUN.Abp.CachingManagement.HttpApi.csproj" /> |
|||
<ProjectReference Include="..\..\modules\caching\LINGYUN.Abp.CachingManagement.StackExchangeRedis\LINGYUN.Abp.CachingManagement.StackExchangeRedis.csproj" /> |
|||
<ProjectReference Include="..\..\modules\cloud-aliyun\LINGYUN.Abp.Aliyun.SettingManagement\LINGYUN.Abp.Aliyun.SettingManagement.csproj" /> |
|||
<ProjectReference Include="..\..\modules\cloud-aliyun\LINGYUN.Abp.Aliyun\LINGYUN.Abp.Aliyun.csproj" /> |
|||
<ProjectReference Include="..\..\modules\cloud-tencent\LINGYUN.Abp.Tencent.QQ\LINGYUN.Abp.Tencent.QQ.csproj" /> |
|||
<ProjectReference Include="..\..\modules\cloud-tencent\LINGYUN.Abp.Tencent.SettingManagement\LINGYUN.Abp.Tencent.SettingManagement.csproj" /> |
|||
<ProjectReference Include="..\..\modules\cloud-tencent\LINGYUN.Abp.Tencent\LINGYUN.Abp.Tencent.csproj" /> |
|||
<ProjectReference Include="..\..\modules\common\LINGYUN.Abp.AspNetCore.HttpOverrides\LINGYUN.Abp.AspNetCore.HttpOverrides.csproj" /> |
|||
<ProjectReference Include="..\..\modules\common\LINGYUN.Abp.Data.DbMigrator\LINGYUN.Abp.Data.DbMigrator.csproj" /> |
|||
<ProjectReference Include="..\..\modules\common\LINGYUN.Abp.ExceptionHandling.Emailing\LINGYUN.Abp.ExceptionHandling.Emailing.csproj" /> |
|||
<ProjectReference Include="..\..\modules\common\LINGYUN.Abp.ExceptionHandling.Notifications\LINGYUN.Abp.ExceptionHandling.Notifications.csproj" /> |
|||
<ProjectReference Include="..\..\modules\common\LINGYUN.Abp.ExceptionHandling\LINGYUN.Abp.ExceptionHandling.csproj" /> |
|||
<ProjectReference Include="..\..\modules\common\LINGYUN.Abp.Features.LimitValidation.Redis.Client\LINGYUN.Abp.Features.LimitValidation.Redis.Client.csproj" /> |
|||
<ProjectReference Include="..\..\modules\common\LINGYUN.Abp.Features.LimitValidation.Redis\LINGYUN.Abp.Features.LimitValidation.Redis.csproj" /> |
|||
<ProjectReference Include="..\..\modules\common\LINGYUN.Abp.Features.LimitValidation\LINGYUN.Abp.Features.LimitValidation.csproj" /> |
|||
<ProjectReference Include="..\..\modules\common\LINGYUN.Abp.Http.Client.Wrapper\LINGYUN.Abp.Http.Client.Wrapper.csproj" /> |
|||
<ProjectReference Include="..\..\modules\common\LINGYUN.Abp.IdGenerator\LINGYUN.Abp.IdGenerator.csproj" /> |
|||
<ProjectReference Include="..\..\modules\common\LINGYUN.Abp.IM.SignalR\LINGYUN.Abp.IM.SignalR.csproj" /> |
|||
<ProjectReference Include="..\..\modules\common\LINGYUN.Abp.IM\LINGYUN.Abp.IM.csproj" /> |
|||
<ProjectReference Include="..\..\modules\common\LINGYUN.Abp.Notifications.Common\LINGYUN.Abp.Notifications.Common.csproj" /> |
|||
<ProjectReference Include="..\..\modules\common\LINGYUN.Abp.Notifications.Core\LINGYUN.Abp.Notifications.Core.csproj" /> |
|||
<ProjectReference Include="..\..\modules\common\LINGYUN.Abp.Notifications.Emailing\LINGYUN.Abp.Notifications.Emailing.csproj" /> |
|||
<ProjectReference Include="..\..\modules\common\LINGYUN.Abp.Notifications.SignalR\LINGYUN.Abp.Notifications.SignalR.csproj" /> |
|||
<ProjectReference Include="..\..\modules\common\LINGYUN.Abp.RealTime\LINGYUN.Abp.RealTime.csproj" /> |
|||
<ProjectReference Include="..\..\modules\common\LINGYUN.Abp.Wrapper\LINGYUN.Abp.Wrapper.csproj" /> |
|||
<ProjectReference Include="..\..\modules\dynamic-queryable\LINGYUN.Abp.Dynamic.Queryable.Application.Contracts\LINGYUN.Abp.Dynamic.Queryable.Application.Contracts.csproj" /> |
|||
<ProjectReference Include="..\..\modules\dynamic-queryable\LINGYUN.Abp.Dynamic.Queryable.Application\LINGYUN.Abp.Dynamic.Queryable.Application.csproj" /> |
|||
<ProjectReference Include="..\..\modules\dynamic-queryable\LINGYUN.Abp.Dynamic.Queryable.HttpApi\LINGYUN.Abp.Dynamic.Queryable.HttpApi.csproj" /> |
|||
<ProjectReference Include="..\..\modules\dynamic-queryable\LINGYUN.Linq.Dynamic.Queryable\LINGYUN.Linq.Dynamic.Queryable.csproj" /> |
|||
<ProjectReference Include="..\..\modules\elsa\LINGYUN.Abp.Elsa.Activities.BlobStoring\LINGYUN.Abp.Elsa.Activities.BlobStoring.csproj" /> |
|||
<ProjectReference Include="..\..\modules\elsa\LINGYUN.Abp.Elsa.Activities.Emailing\LINGYUN.Abp.Elsa.Activities.Emailing.csproj" /> |
|||
<ProjectReference Include="..\..\modules\elsa\LINGYUN.Abp.Elsa.Activities.IM\LINGYUN.Abp.Elsa.Activities.IM.csproj" /> |
|||
<ProjectReference Include="..\..\modules\elsa\LINGYUN.Abp.Elsa.Activities.Notifications\LINGYUN.Abp.Elsa.Activities.Notifications.csproj" /> |
|||
<ProjectReference Include="..\..\modules\elsa\LINGYUN.Abp.Elsa.Activities.Sms\LINGYUN.Abp.Elsa.Activities.Sms.csproj" /> |
|||
<ProjectReference Include="..\..\modules\elsa\LINGYUN.Abp.Elsa.Activities.Webhooks\LINGYUN.Abp.Elsa.Activities.Webhooks.csproj" /> |
|||
<ProjectReference Include="..\..\modules\elsa\LINGYUN.Abp.Elsa.Activities\LINGYUN.Abp.Elsa.Activities.csproj" /> |
|||
<ProjectReference Include="..\..\modules\elsa\LINGYUN.Abp.Elsa.EntityFrameworkCore.MySql\LINGYUN.Abp.Elsa.EntityFrameworkCore.MySql.csproj" /> |
|||
<ProjectReference Include="..\..\modules\elsa\LINGYUN.Abp.Elsa.EntityFrameworkCore\LINGYUN.Abp.Elsa.EntityFrameworkCore.csproj" /> |
|||
<ProjectReference Include="..\..\modules\elsa\LINGYUN.Abp.Elsa.Server\LINGYUN.Abp.Elsa.Server.csproj" /> |
|||
<ProjectReference Include="..\..\modules\elsa\LINGYUN.Abp.Elsa\LINGYUN.Abp.Elsa.csproj" /> |
|||
<ProjectReference Include="..\..\modules\features\LINGYUN.Abp.FeatureManagement.Client\LINGYUN.Abp.FeatureManagement.Client.csproj" /> |
|||
<ProjectReference Include="..\..\modules\identityServer\LINGYUN.Abp.IdentityServer.Application.Contracts\LINGYUN.Abp.IdentityServer.Application.Contracts.csproj" /> |
|||
<ProjectReference Include="..\..\modules\identityServer\LINGYUN.Abp.IdentityServer.Application\LINGYUN.Abp.IdentityServer.Application.csproj" /> |
|||
<ProjectReference Include="..\..\modules\identityServer\LINGYUN.Abp.IdentityServer.Domain\LINGYUN.Abp.IdentityServer.Domain.csproj" /> |
|||
<ProjectReference Include="..\..\modules\identityServer\LINGYUN.Abp.IdentityServer.EntityFrameworkCore\LINGYUN.Abp.IdentityServer.EntityFrameworkCore.csproj" /> |
|||
<ProjectReference Include="..\..\modules\identityServer\LINGYUN.Abp.IdentityServer.HttpApi\LINGYUN.Abp.IdentityServer.HttpApi.csproj" /> |
|||
<ProjectReference Include="..\..\modules\identityServer\LINGYUN.Abp.IdentityServer.LinkUser\LINGYUN.Abp.IdentityServer.LinkUser.csproj" /> |
|||
<ProjectReference Include="..\..\modules\identity\LINGYUN.Abp.Identity.Application.Contracts\LINGYUN.Abp.Identity.Application.Contracts.csproj" /> |
|||
<ProjectReference Include="..\..\modules\identity\LINGYUN.Abp.Identity.Application\LINGYUN.Abp.Identity.Application.csproj" /> |
|||
<ProjectReference Include="..\..\modules\identity\LINGYUN.Abp.Identity.Domain.Shared\LINGYUN.Abp.Identity.Domain.Shared.csproj" /> |
|||
<ProjectReference Include="..\..\modules\identity\LINGYUN.Abp.Identity.Domain\LINGYUN.Abp.Identity.Domain.csproj" /> |
|||
<ProjectReference Include="..\..\modules\identity\LINGYUN.Abp.Identity.EntityFrameworkCore\LINGYUN.Abp.Identity.EntityFrameworkCore.csproj" /> |
|||
<ProjectReference Include="..\..\modules\identity\LINGYUN.Abp.Identity.HttpApi\LINGYUN.Abp.Identity.HttpApi.csproj" /> |
|||
<ProjectReference Include="..\..\modules\localization\LINGYUN.Abp.AspNetCore.Mvc.Localization\LINGYUN.Abp.AspNetCore.Mvc.Localization.csproj" /> |
|||
<ProjectReference Include="..\..\modules\localization\LINGYUN.Abp.Localization.CultureMap\LINGYUN.Abp.Localization.CultureMap.csproj" /> |
|||
<ProjectReference Include="..\..\modules\localization\LINGYUN.Abp.Localization.Persistence\LINGYUN.Abp.Localization.Persistence.csproj" /> |
|||
<ProjectReference Include="..\..\modules\logging\LINGYUN.Abp.Logging.Serilog.Elasticsearch\LINGYUN.Abp.Logging.Serilog.Elasticsearch.csproj" /> |
|||
<ProjectReference Include="..\..\modules\logging\LINGYUN.Abp.Logging\LINGYUN.Abp.Logging.csproj" /> |
|||
<ProjectReference Include="..\..\modules\logging\LINGYUN.Abp.Serilog.Enrichers.Application\LINGYUN.Abp.Serilog.Enrichers.Application.csproj" /> |
|||
<ProjectReference Include="..\..\modules\logging\LINGYUN.Abp.Serilog.Enrichers.UniqueId\LINGYUN.Abp.Serilog.Enrichers.UniqueId.csproj" /> |
|||
<ProjectReference Include="..\..\modules\lt\LINGYUN.Abp.LocalizationManagement.Application.Contracts\LINGYUN.Abp.LocalizationManagement.Application.Contracts.csproj" /> |
|||
<ProjectReference Include="..\..\modules\lt\LINGYUN.Abp.LocalizationManagement.Application\LINGYUN.Abp.LocalizationManagement.Application.csproj" /> |
|||
<ProjectReference Include="..\..\modules\lt\LINGYUN.Abp.LocalizationManagement.Domain.Shared\LINGYUN.Abp.LocalizationManagement.Domain.Shared.csproj" /> |
|||
<ProjectReference Include="..\..\modules\lt\LINGYUN.Abp.LocalizationManagement.Domain\LINGYUN.Abp.LocalizationManagement.Domain.csproj" /> |
|||
<ProjectReference Include="..\..\modules\lt\LINGYUN.Abp.LocalizationManagement.EntityFrameworkCore\LINGYUN.Abp.LocalizationManagement.EntityFrameworkCore.csproj" /> |
|||
<ProjectReference Include="..\..\modules\common\LINGYUN.Abp.Sms.Aliyun\LINGYUN.Abp.Sms.Aliyun.csproj" /> |
|||
<ProjectReference Include="..\..\modules\lt\LINGYUN.Abp.LocalizationManagement.HttpApi\LINGYUN.Abp.LocalizationManagement.HttpApi.csproj" /> |
|||
<ProjectReference Include="..\..\modules\message\LINGYUN.Abp.MessageService.Application.Contracts\LINGYUN.Abp.MessageService.Application.Contracts.csproj" /> |
|||
<ProjectReference Include="..\..\modules\message\LINGYUN.Abp.MessageService.Application\LINGYUN.Abp.MessageService.Application.csproj" /> |
|||
<ProjectReference Include="..\..\modules\message\LINGYUN.Abp.MessageService.Domain.Shared\LINGYUN.Abp.MessageService.Domain.Shared.csproj" /> |
|||
<ProjectReference Include="..\..\modules\message\LINGYUN.Abp.MessageService.Domain\LINGYUN.Abp.MessageService.Domain.csproj" /> |
|||
<ProjectReference Include="..\..\modules\message\LINGYUN.Abp.MessageService.EntityFrameworkCore\LINGYUN.Abp.MessageService.EntityFrameworkCore.csproj" /> |
|||
<ProjectReference Include="..\..\modules\message\LINGYUN.Abp.MessageService.HttpApi\LINGYUN.Abp.MessageService.HttpApi.csproj" /> |
|||
<ProjectReference Include="..\..\modules\mvc\LINGYUN.Abp.AspNetCore.Mvc.Wrapper\LINGYUN.Abp.AspNetCore.Mvc.Wrapper.csproj" /> |
|||
<ProjectReference Include="..\..\modules\navigation\LINGYUN.Abp.UI.Navigation\LINGYUN.Abp.UI.Navigation.csproj" /> |
|||
<ProjectReference Include="..\..\modules\notifications\LINGYUN.Abp.Notifications.Application.Contracts\LINGYUN.Abp.Notifications.Application.Contracts.csproj" /> |
|||
<ProjectReference Include="..\..\modules\notifications\LINGYUN.Abp.Notifications.Application\LINGYUN.Abp.Notifications.Application.csproj" /> |
|||
<ProjectReference Include="..\..\modules\notifications\LINGYUN.Abp.Notifications.Domain.Shared\LINGYUN.Abp.Notifications.Domain.Shared.csproj" /> |
|||
<ProjectReference Include="..\..\modules\notifications\LINGYUN.Abp.Notifications.Domain\LINGYUN.Abp.Notifications.Domain.csproj" /> |
|||
<ProjectReference Include="..\..\modules\notifications\LINGYUN.Abp.Notifications.EntityFrameworkCore\LINGYUN.Abp.Notifications.EntityFrameworkCore.csproj" /> |
|||
<ProjectReference Include="..\..\modules\notifications\LINGYUN.Abp.Notifications.HttpApi\LINGYUN.Abp.Notifications.HttpApi.csproj" /> |
|||
<ProjectReference Include="..\..\modules\open-api\LINGYUN.Abp.OpenApi.Authorization\LINGYUN.Abp.OpenApi.Authorization.csproj" /> |
|||
<ProjectReference Include="..\..\modules\open-api\LINGYUN.Abp.OpenApi\LINGYUN.Abp.OpenApi.csproj" /> |
|||
<ProjectReference Include="..\..\modules\openIddict\LINGYUN.Abp.OpenIddict.Application.Contracts\LINGYUN.Abp.OpenIddict.Application.Contracts.csproj" /> |
|||
<ProjectReference Include="..\..\modules\openIddict\LINGYUN.Abp.OpenIddict.Application\LINGYUN.Abp.OpenIddict.Application.csproj" /> |
|||
<ProjectReference Include="..\..\modules\openIddict\LINGYUN.Abp.OpenIddict.HttpApi\LINGYUN.Abp.OpenIddict.HttpApi.csproj" /> |
|||
<ProjectReference Include="..\..\modules\openIddict\LINGYUN.Abp.OpenIddict.LinkUser\LINGYUN.Abp.OpenIddict.LinkUser.csproj" /> |
|||
<ProjectReference Include="..\..\modules\openIddict\LINGYUN.Abp.OpenIddict.Sms\LINGYUN.Abp.OpenIddict.Sms.csproj" /> |
|||
<ProjectReference Include="..\..\modules\openIddict\LINGYUN.Abp.OpenIddict.WeChat\LINGYUN.Abp.OpenIddict.WeChat.csproj" /> |
|||
<ProjectReference Include="..\..\modules\oss-management\LINGYUN.Abp.OssManagement.Application.Contracts\LINGYUN.Abp.OssManagement.Application.Contracts.csproj" /> |
|||
<ProjectReference Include="..\..\modules\oss-management\LINGYUN.Abp.OssManagement.Application\LINGYUN.Abp.OssManagement.Application.csproj" /> |
|||
<ProjectReference Include="..\..\modules\oss-management\LINGYUN.Abp.OssManagement.Domain.Shared\LINGYUN.Abp.OssManagement.Domain.Shared.csproj" /> |
|||
<ProjectReference Include="..\..\modules\oss-management\LINGYUN.Abp.OssManagement.Domain\LINGYUN.Abp.OssManagement.Domain.csproj" /> |
|||
<ProjectReference Include="..\..\modules\oss-management\LINGYUN.Abp.OssManagement.FileSystem.ImageSharp\LINGYUN.Abp.OssManagement.FileSystem.ImageSharp.csproj" /> |
|||
<ProjectReference Include="..\..\modules\oss-management\LINGYUN.Abp.OssManagement.FileSystem\LINGYUN.Abp.OssManagement.FileSystem.csproj" /> |
|||
<ProjectReference Include="..\..\modules\oss-management\LINGYUN.Abp.OssManagement.HttpApi\LINGYUN.Abp.OssManagement.HttpApi.csproj" /> |
|||
<ProjectReference Include="..\..\modules\oss-management\LINGYUN.Abp.OssManagement.SettingManagement\LINGYUN.Abp.OssManagement.SettingManagement.csproj" /> |
|||
<ProjectReference Include="..\..\modules\permissions-management\LINGYUN.Abp.PermissionManagement.Domain.OrganizationUnits\LINGYUN.Abp.PermissionManagement.Domain.OrganizationUnits.csproj" /> |
|||
<ProjectReference Include="..\..\modules\platform\LINGYUN.Abp.UI.Navigation.VueVbenAdmin\LINGYUN.Abp.UI.Navigation.VueVbenAdmin.csproj" /> |
|||
<ProjectReference Include="..\..\modules\platform\LINGYUN.Platform.Application.Contracts\LINGYUN.Platform.Application.Contracts.csproj" /> |
|||
<ProjectReference Include="..\..\modules\platform\LINGYUN.Platform.Application\LINGYUN.Platform.Application.csproj" /> |
|||
<ProjectReference Include="..\..\modules\platform\LINGYUN.Platform.Domain.Shared\LINGYUN.Platform.Domain.Shared.csproj" /> |
|||
<ProjectReference Include="..\..\modules\platform\LINGYUN.Platform.Domain\LINGYUN.Platform.Domain.csproj" /> |
|||
<ProjectReference Include="..\..\modules\platform\LINGYUN.Platform.EntityFrameworkCore\LINGYUN.Platform.EntityFrameworkCore.csproj" /> |
|||
<ProjectReference Include="..\..\modules\platform\LINGYUN.Platform.HttpApi\LINGYUN.Platform.HttpApi.csproj" /> |
|||
<ProjectReference Include="..\..\modules\platform\LINGYUN.Platform.Settings.VueVbenAdmin\LINGYUN.Platform.Settings.VueVbenAdmin.csproj" /> |
|||
<ProjectReference Include="..\..\modules\platform\LINGYUN.Platform.Theme.VueVbenAdmin\LINGYUN.Platform.Theme.VueVbenAdmin.csproj" /> |
|||
<ProjectReference Include="..\..\modules\saas\LINGYUN.Abp.Saas.Application.Contracts\LINGYUN.Abp.Saas.Application.Contracts.csproj" /> |
|||
<ProjectReference Include="..\..\modules\saas\LINGYUN.Abp.Saas.Domain.Shared\LINGYUN.Abp.Saas.Domain.Shared.csproj" /> |
|||
<ProjectReference Include="..\..\modules\saas\LINGYUN.Abp.Saas.Domain\LINGYUN.Abp.Saas.Domain.csproj" /> |
|||
<ProjectReference Include="..\..\modules\settings\LINGYUN.Abp.SettingManagement.Application.Contracts\LINGYUN.Abp.SettingManagement.Application.Contracts.csproj" /> |
|||
<ProjectReference Include="..\..\modules\settings\LINGYUN.Abp.SettingManagement.Application\LINGYUN.Abp.SettingManagement.Application.csproj" /> |
|||
<ProjectReference Include="..\..\modules\settings\LINGYUN.Abp.SettingManagement.HttpApi\LINGYUN.Abp.SettingManagement.HttpApi.csproj" /> |
|||
<ProjectReference Include="..\..\modules\saas\LINGYUN.Abp.Saas.Application\LINGYUN.Abp.Saas.Application.csproj" /> |
|||
<ProjectReference Include="..\..\modules\saas\LINGYUN.Abp.Saas.EntityFrameworkCore\LINGYUN.Abp.Saas.EntityFrameworkCore.csproj" /> |
|||
<ProjectReference Include="..\..\modules\saas\LINGYUN.Abp.Saas.HttpApi\LINGYUN.Abp.Saas.HttpApi.csproj" /> |
|||
<ProjectReference Include="..\..\modules\task-management\LINGYUN.Abp.BackgroundTasks.Abstractions\LINGYUN.Abp.BackgroundTasks.Abstractions.csproj" /> |
|||
<ProjectReference Include="..\..\modules\task-management\LINGYUN.Abp.BackgroundTasks.Activities\LINGYUN.Abp.BackgroundTasks.Activities.csproj" /> |
|||
<ProjectReference Include="..\..\modules\task-management\LINGYUN.Abp.BackgroundTasks.DistributedLocking\LINGYUN.Abp.BackgroundTasks.DistributedLocking.csproj" /> |
|||
<ProjectReference Include="..\..\modules\task-management\LINGYUN.Abp.BackgroundTasks.EventBus\LINGYUN.Abp.BackgroundTasks.EventBus.csproj" /> |
|||
<ProjectReference Include="..\..\modules\task-management\LINGYUN.Abp.BackgroundTasks.ExceptionHandling\LINGYUN.Abp.BackgroundTasks.ExceptionHandling.csproj" /> |
|||
<ProjectReference Include="..\..\modules\task-management\LINGYUN.Abp.BackgroundTasks.Jobs\LINGYUN.Abp.BackgroundTasks.Jobs.csproj" /> |
|||
<ProjectReference Include="..\..\modules\task-management\LINGYUN.Abp.BackgroundTasks.Notifications\LINGYUN.Abp.BackgroundTasks.Notifications.csproj" /> |
|||
<ProjectReference Include="..\..\modules\task-management\LINGYUN.Abp.BackgroundTasks.Quartz\LINGYUN.Abp.BackgroundTasks.Quartz.csproj" /> |
|||
<ProjectReference Include="..\..\modules\task-management\LINGYUN.Abp.BackgroundTasks\LINGYUN.Abp.BackgroundTasks.csproj" /> |
|||
<ProjectReference Include="..\..\modules\task-management\LINGYUN.Abp.TaskManagement.Application.Contracts\LINGYUN.Abp.TaskManagement.Application.Contracts.csproj" /> |
|||
<ProjectReference Include="..\..\modules\task-management\LINGYUN.Abp.TaskManagement.Application\LINGYUN.Abp.TaskManagement.Application.csproj" /> |
|||
<ProjectReference Include="..\..\modules\task-management\LINGYUN.Abp.TaskManagement.Domain.Shared\LINGYUN.Abp.TaskManagement.Domain.Shared.csproj" /> |
|||
<ProjectReference Include="..\..\modules\task-management\LINGYUN.Abp.TaskManagement.Domain\LINGYUN.Abp.TaskManagement.Domain.csproj" /> |
|||
<ProjectReference Include="..\..\modules\task-management\LINGYUN.Abp.TaskManagement.EntityFrameworkCore\LINGYUN.Abp.TaskManagement.EntityFrameworkCore.csproj" /> |
|||
<ProjectReference Include="..\..\modules\task-management\LINGYUN.Abp.TaskManagement.HttpApi\LINGYUN.Abp.TaskManagement.HttpApi.csproj" /> |
|||
<ProjectReference Include="..\..\modules\tenants\LINGYUN.Abp.MultiTenancy.Editions\LINGYUN.Abp.MultiTenancy.Editions.csproj" /> |
|||
<ProjectReference Include="..\..\modules\text-templating\LINGYUN.Abp.TextTemplating.Application.Contracts\LINGYUN.Abp.TextTemplating.Application.Contracts.csproj" /> |
|||
<ProjectReference Include="..\..\modules\text-templating\LINGYUN.Abp.TextTemplating.Application\LINGYUN.Abp.TextTemplating.Application.csproj" /> |
|||
<ProjectReference Include="..\..\modules\text-templating\LINGYUN.Abp.TextTemplating.Domain.Shared\LINGYUN.Abp.TextTemplating.Domain.Shared.csproj" /> |
|||
<ProjectReference Include="..\..\modules\text-templating\LINGYUN.Abp.TextTemplating.Domain\LINGYUN.Abp.TextTemplating.Domain.csproj" /> |
|||
<ProjectReference Include="..\..\modules\text-templating\LINGYUN.Abp.TextTemplating.EntityFrameworkCore\LINGYUN.Abp.TextTemplating.EntityFrameworkCore.csproj" /> |
|||
<ProjectReference Include="..\..\modules\text-templating\LINGYUN.Abp.TextTemplating.HttpApi\LINGYUN.Abp.TextTemplating.HttpApi.csproj" /> |
|||
<ProjectReference Include="..\..\modules\text-templating\LINGYUN.Abp.TextTemplating.Scriban\LINGYUN.Abp.TextTemplating.Scriban.csproj" /> |
|||
<ProjectReference Include="..\..\modules\webhooks\LINGYUN.Abp.Webhooks.Core\LINGYUN.Abp.Webhooks.Core.csproj" /> |
|||
<ProjectReference Include="..\..\modules\webhooks\LINGYUN.Abp.Webhooks.EventBus\LINGYUN.Abp.Webhooks.EventBus.csproj" /> |
|||
<ProjectReference Include="..\..\modules\webhooks\LINGYUN.Abp.Webhooks.Identity\LINGYUN.Abp.Webhooks.Identity.csproj" /> |
|||
<ProjectReference Include="..\..\modules\webhooks\LINGYUN.Abp.Webhooks.Saas\LINGYUN.Abp.Webhooks.Saas.csproj" /> |
|||
<ProjectReference Include="..\..\modules\webhooks\LINGYUN.Abp.WebhooksManagement.Application.Contracts\LINGYUN.Abp.WebhooksManagement.Application.Contracts.csproj" /> |
|||
<ProjectReference Include="..\..\modules\webhooks\LINGYUN.Abp.WebhooksManagement.Application\LINGYUN.Abp.WebhooksManagement.Application.csproj" /> |
|||
<ProjectReference Include="..\..\modules\webhooks\LINGYUN.Abp.WebhooksManagement.Domain.Shared\LINGYUN.Abp.WebhooksManagement.Domain.Shared.csproj" /> |
|||
<ProjectReference Include="..\..\modules\webhooks\LINGYUN.Abp.WebhooksManagement.Domain\LINGYUN.Abp.WebhooksManagement.Domain.csproj" /> |
|||
<ProjectReference Include="..\..\modules\webhooks\LINGYUN.Abp.WebhooksManagement.EntityFrameworkCore\LINGYUN.Abp.WebhooksManagement.EntityFrameworkCore.csproj" /> |
|||
<ProjectReference Include="..\..\modules\webhooks\LINGYUN.Abp.WebhooksManagement.HttpApi\LINGYUN.Abp.WebhooksManagement.HttpApi.csproj" /> |
|||
<ProjectReference Include="..\..\modules\webhooks\LINGYUN.Abp.Webhooks\LINGYUN.Abp.Webhooks.csproj" /> |
|||
<ProjectReference Include="..\..\modules\wechat\LINGYUN.Abp.Identity.WeChat\LINGYUN.Abp.Identity.WeChat.csproj" /> |
|||
<ProjectReference Include="..\..\modules\wechat\LINGYUN.Abp.Notifications.WeChat.MiniProgram\LINGYUN.Abp.Notifications.WeChat.MiniProgram.csproj" /> |
|||
<ProjectReference Include="..\..\modules\wechat\LINGYUN.Abp.WeChat.MiniProgram\LINGYUN.Abp.WeChat.MiniProgram.csproj" /> |
|||
<ProjectReference Include="..\..\modules\wechat\LINGYUN.Abp.WeChat.Official\LINGYUN.Abp.WeChat.Official.csproj" /> |
|||
<ProjectReference Include="..\..\modules\wechat\LINGYUN.Abp.WeChat.SettingManagement\LINGYUN.Abp.WeChat.SettingManagement.csproj" /> |
|||
<ProjectReference Include="..\..\modules\wechat\LINGYUN.Abp.WeChat\LINGYUN.Abp.WeChat.csproj" /> |
|||
</ItemGroup> |
|||
|
|||
</Project> |
|||
@ -0,0 +1,544 @@ |
|||
using Elsa; |
|||
using Elsa.Options; |
|||
using LINGYUN.Abp.BackgroundTasks; |
|||
using LINGYUN.Abp.IdentityServer.IdentityResources; |
|||
using LINGYUN.Abp.Localization.CultureMap; |
|||
using LINGYUN.Abp.Saas; |
|||
using LINGYUN.Abp.Serilog.Enrichers.Application; |
|||
using LINGYUN.Abp.Serilog.Enrichers.UniqueId; |
|||
using LINGYUN.Abp.TextTemplating; |
|||
using LY.MicroService.Applications.Single.IdentityResources; |
|||
using Medallion.Threading; |
|||
using Medallion.Threading.Redis; |
|||
using Microsoft.AspNetCore.Authentication.JwtBearer; |
|||
using Microsoft.AspNetCore.Cors; |
|||
using Microsoft.AspNetCore.DataProtection; |
|||
using Microsoft.AspNetCore.Identity; |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using Microsoft.AspNetCore.Server.Kestrel.Core; |
|||
using Microsoft.Extensions.Caching.StackExchangeRedis; |
|||
using Microsoft.OpenApi.Models; |
|||
using Quartz; |
|||
using StackExchange.Redis; |
|||
using System.Security.Cryptography.X509Certificates; |
|||
using System.Text.Encodings.Web; |
|||
using System.Text.Unicode; |
|||
using Volo.Abp; |
|||
using Volo.Abp.AspNetCore.Mvc; |
|||
using Volo.Abp.AspNetCore.Mvc.UI.Bundling; |
|||
using Volo.Abp.Auditing; |
|||
using Volo.Abp.Authorization.Permissions; |
|||
using Volo.Abp.BlobStoring; |
|||
using Volo.Abp.BlobStoring.FileSystem; |
|||
using Volo.Abp.Caching; |
|||
using Volo.Abp.EntityFrameworkCore; |
|||
using Volo.Abp.FeatureManagement; |
|||
using Volo.Abp.Features; |
|||
using Volo.Abp.GlobalFeatures; |
|||
using Volo.Abp.IdentityServer; |
|||
using Volo.Abp.Json; |
|||
using Volo.Abp.Json.SystemTextJson; |
|||
using Volo.Abp.Localization; |
|||
using Volo.Abp.MultiTenancy; |
|||
using Volo.Abp.PermissionManagement; |
|||
using Volo.Abp.Quartz; |
|||
using Volo.Abp.Threading; |
|||
using Volo.Abp.UI.Navigation.Urls; |
|||
|
|||
namespace LY.MicroService.Applications.Single; |
|||
|
|||
public partial class MicroServiceApplicationsSingleModule |
|||
{ |
|||
protected const string DefaultCorsPolicyName = "Default"; |
|||
protected const string ApplicationName = "MicroService-Applications-Single"; |
|||
private readonly static OneTimeRunner OneTimeRunner = new(); |
|||
|
|||
private void PreConfigureFeature() |
|||
{ |
|||
OneTimeRunner.Run(() => |
|||
{ |
|||
GlobalFeatureManager.Instance.Modules.Editions().EnableAll(); |
|||
}); |
|||
} |
|||
|
|||
private void PreConfigureApp() |
|||
{ |
|||
AbpSerilogEnrichersConsts.ApplicationName = ApplicationName; |
|||
|
|||
PreConfigure<AbpSerilogEnrichersUniqueIdOptions>(options => |
|||
{ |
|||
// 以开放端口区别,应在0-31之间
|
|||
options.SnowflakeIdOptions.WorkerId = 1; |
|||
options.SnowflakeIdOptions.WorkerIdBits = 5; |
|||
options.SnowflakeIdOptions.DatacenterId = 1; |
|||
}); |
|||
} |
|||
|
|||
private void PreConfigureCertificate(IConfiguration configuration, IWebHostEnvironment environment) |
|||
{ |
|||
var cerConfig = configuration.GetSection("Certificates"); |
|||
if (environment.IsProduction() && |
|||
cerConfig.Exists()) |
|||
{ |
|||
// 开发环境下存在证书配置
|
|||
// 且证书文件存在则使用自定义的证书文件来启动Ids服务器
|
|||
var cerPath = Path.Combine(environment.ContentRootPath, cerConfig["CerPath"]); |
|||
if (File.Exists(cerPath)) |
|||
{ |
|||
PreConfigure<AbpIdentityServerBuilderOptions>(options => |
|||
{ |
|||
options.AddDeveloperSigningCredential = false; |
|||
}); |
|||
|
|||
var cer = new X509Certificate2(cerPath, cerConfig["Password"]); |
|||
|
|||
PreConfigure<IIdentityServerBuilder>(builder => |
|||
{ |
|||
builder.AddSigningCredential(cer); |
|||
}); |
|||
} |
|||
} |
|||
} |
|||
|
|||
private void PreConfigureQuartz(IConfiguration configuration) |
|||
{ |
|||
PreConfigure<AbpQuartzOptions>(options => |
|||
{ |
|||
// 如果使用持久化存储, 则配置quartz持久层
|
|||
if (configuration.GetSection("Quartz:UsePersistentStore").Get<bool>()) |
|||
{ |
|||
var settings = configuration.GetSection("Quartz:Properties").Get<Dictionary<string, string>>(); |
|||
if (settings != null) |
|||
{ |
|||
foreach (var setting in settings) |
|||
{ |
|||
options.Properties[setting.Key] = setting.Value; |
|||
} |
|||
} |
|||
|
|||
options.Configurator += (config) => |
|||
{ |
|||
config.UsePersistentStore(store => |
|||
{ |
|||
store.UseProperties = false; |
|||
store.UseJsonSerializer(); |
|||
}); |
|||
}; |
|||
} |
|||
}); |
|||
} |
|||
|
|||
private void PreConfigureElsa(IServiceCollection services, IConfiguration configuration) |
|||
{ |
|||
var elsaSection = configuration.GetSection("Elsa"); |
|||
var startups = new[] |
|||
{ |
|||
typeof(Elsa.Activities.Console.Startup), |
|||
typeof(Elsa.Activities.Http.Startup), |
|||
typeof(Elsa.Activities.UserTask.Startup), |
|||
typeof(Elsa.Activities.Temporal.Quartz.Startup), |
|||
typeof(Elsa.Activities.Email.Startup), |
|||
typeof(Elsa.Scripting.JavaScript.Startup), |
|||
typeof(Elsa.Activities.Webhooks.Startup), |
|||
}; |
|||
|
|||
PreConfigure<ElsaOptionsBuilder>(elsa => |
|||
{ |
|||
elsa |
|||
.AddActivitiesFrom<MicroServiceApplicationsSingleModule>() |
|||
.AddWorkflowsFrom<MicroServiceApplicationsSingleModule>() |
|||
.AddFeatures(startups, configuration) |
|||
.ConfigureWorkflowChannels(options => elsaSection.GetSection("WorkflowChannels").Bind(options)); |
|||
|
|||
elsa.DistributedLockingOptionsBuilder |
|||
.UseProviderFactory(sp => name => |
|||
{ |
|||
var provider = sp.GetRequiredService<IDistributedLockProvider>(); |
|||
|
|||
return provider.CreateLock(name); |
|||
}); |
|||
}); |
|||
|
|||
services.AddNotificationHandlersFrom<MicroServiceApplicationsSingleModule>(); |
|||
|
|||
PreConfigure<IMvcBuilder>(mvcBuilder => |
|||
{ |
|||
mvcBuilder.AddApplicationPartIfNotExists(typeof(Elsa.Webhooks.Api.Endpoints.List).Assembly); |
|||
}); |
|||
} |
|||
|
|||
private void ConfigureEndpoints(IServiceCollection services) |
|||
{ |
|||
// 不需要
|
|||
//Configure<AbpEndpointRouterOptions>(options =>
|
|||
//{
|
|||
// options.EndpointConfigureActions.Add(
|
|||
// (context) =>
|
|||
// {
|
|||
// context.Endpoints.MapFallbackToPage("/_Host");
|
|||
// });
|
|||
//});
|
|||
var preActions = services.GetPreConfigureActions<AbpAspNetCoreMvcOptions>(); |
|||
|
|||
services.AddAbpApiVersioning(options => |
|||
{ |
|||
options.ReportApiVersions = true; |
|||
options.AssumeDefaultVersionWhenUnspecified = true; |
|||
|
|||
//options.ApiVersionReader = new HeaderApiVersionReader("api-version"); //Supports header too
|
|||
//options.ApiVersionReader = new MediaTypeApiVersionReader(); //Supports accept header too
|
|||
|
|||
options.ConfigureAbp(preActions.Configure()); |
|||
}); |
|||
|
|||
//services.AddApiVersioning(config =>
|
|||
//{
|
|||
// // Specify the default API Version as 1.0
|
|||
// config.DefaultApiVersion = new ApiVersion(1, 0);
|
|||
// // Advertise the API versions supported for the particular endpoint (through 'api-supported-versions' response header which lists all available API versions for that endpoint)
|
|||
// config.ReportApiVersions = true;
|
|||
//});
|
|||
|
|||
//services.AddVersionedApiExplorer(options =>
|
|||
//{
|
|||
// // add the versioned api explorer, which also adds IApiVersionDescriptionProvider service
|
|||
// // note: the specified format code will format the version as "'v'major[.minor][-status]"
|
|||
// options.GroupNameFormat = "'v'VVV";
|
|||
|
|||
// // note: this option is only necessary when versioning by url segment. the SubstitutionFormat
|
|||
// // can also be used to control the format of the API version in route templates
|
|||
// options.SubstituteApiVersionInUrl = true;
|
|||
//});
|
|||
} |
|||
|
|||
private void ConfigureKestrelServer() |
|||
{ |
|||
Configure<KestrelServerOptions>(options => |
|||
{ |
|||
options.Limits.MaxRequestBodySize = null; |
|||
options.Limits.MaxRequestBufferSize = null; |
|||
}); |
|||
} |
|||
|
|||
private void ConfigureBlobStoring() |
|||
{ |
|||
Configure<AbpBlobStoringOptions>(options => |
|||
{ |
|||
options.Containers.ConfigureAll((containerName, containerConfiguration) => |
|||
{ |
|||
containerConfiguration.UseFileSystem(fileSystem => |
|||
{ |
|||
fileSystem.BasePath = Path.Combine(Directory.GetCurrentDirectory(), "blobs"); |
|||
}); |
|||
}); |
|||
}); |
|||
} |
|||
|
|||
private void ConfigureBackgroundTasks() |
|||
{ |
|||
Configure<AbpBackgroundTasksOptions>(options => |
|||
{ |
|||
options.NodeName = ApplicationName; |
|||
options.JobCleanEnabled = true; |
|||
options.JobFetchEnabled = true; |
|||
}); |
|||
} |
|||
|
|||
private void ConfigureTextTemplating() |
|||
{ |
|||
Configure<AbpTextTemplatingCachingOptions>(options => |
|||
{ |
|||
options.IsDynamicTemplateDefinitionStoreEnabled = true; |
|||
}); |
|||
} |
|||
|
|||
private void ConfigureFeatureManagement() |
|||
{ |
|||
Configure<FeatureManagementOptions>(options => |
|||
{ |
|||
options.ProviderPolicies[EditionFeatureValueProvider.ProviderName] = AbpSaasPermissions.Editions.ManageFeatures; |
|||
options.ProviderPolicies[TenantFeatureValueProvider.ProviderName] = AbpSaasPermissions.Tenants.ManageFeatures; |
|||
|
|||
options.IsDynamicFeatureStoreEnabled = true; |
|||
}); |
|||
} |
|||
|
|||
private void ConfigurePermissionManagement() |
|||
{ |
|||
Configure<PermissionManagementOptions>(options => |
|||
{ |
|||
// Rename IdentityServer.Client.ManagePermissions
|
|||
// See https://github.com/abpframework/abp/blob/dev/modules/identityserver/src/Volo.Abp.PermissionManagement.Domain.IdentityServer/Volo/Abp/PermissionManagement/IdentityServer/AbpPermissionManagementDomainIdentityServerModule.cs
|
|||
options.ProviderPolicies[ClientPermissionValueProvider.ProviderName] = "AbpIdentityServer.Clients.ManagePermissions"; |
|||
}); |
|||
} |
|||
|
|||
private void ConfigureDistributedLock(IServiceCollection services, IConfiguration configuration) |
|||
{ |
|||
var distributedLockEnabled = configuration["DistributedLock:IsEnabled"]; |
|||
if (distributedLockEnabled.IsNullOrEmpty() || bool.Parse(distributedLockEnabled)) |
|||
{ |
|||
var redis = ConnectionMultiplexer.Connect(configuration["DistributedLock:Redis:Configuration"]); |
|||
services.AddSingleton<IDistributedLockProvider>(_ => new RedisDistributedSynchronizationProvider(redis.GetDatabase())); |
|||
} |
|||
} |
|||
|
|||
private void ConfigureDbContext() |
|||
{ |
|||
Configure<AbpDbContextOptions>(options => |
|||
{ |
|||
options.UseMySQL(); |
|||
}); |
|||
} |
|||
|
|||
private void ConfigureDataSeeder() |
|||
{ |
|||
Configure<CustomIdentityResourceDataSeederOptions>(options => |
|||
{ |
|||
options.Resources.Add(new CustomIdentityResources.AvatarUrl()); |
|||
}); |
|||
} |
|||
|
|||
private void ConfigureJsonSerializer() |
|||
{ |
|||
// 统一时间日期格式
|
|||
Configure<AbpJsonOptions>(options => |
|||
{ |
|||
options.OutputDateTimeFormat = "yyyy-MM-dd HH:mm:ss"; |
|||
}); |
|||
// 中文序列化的编码问题
|
|||
Configure<AbpSystemTextJsonSerializerOptions>(options => |
|||
{ |
|||
options.JsonSerializerOptions.Encoder = JavaScriptEncoder.Create(UnicodeRanges.All); |
|||
}); |
|||
} |
|||
|
|||
private void ConfigureCaching(IConfiguration configuration) |
|||
{ |
|||
Configure<AbpDistributedCacheOptions>(options => |
|||
{ |
|||
configuration.GetSection("DistributedCache").Bind(options); |
|||
}); |
|||
|
|||
Configure<RedisCacheOptions>(options => |
|||
{ |
|||
var redisConfig = ConfigurationOptions.Parse(options.Configuration); |
|||
options.ConfigurationOptions = redisConfig; |
|||
options.InstanceName = configuration["Redis:InstanceName"]; |
|||
}); |
|||
} |
|||
|
|||
private void ConfigureMultiTenancy(IConfiguration configuration) |
|||
{ |
|||
// 多租户
|
|||
Configure<AbpMultiTenancyOptions>(options => |
|||
{ |
|||
options.IsEnabled = true; |
|||
}); |
|||
|
|||
var tenantResolveCfg = configuration.GetSection("App:Domains"); |
|||
if (tenantResolveCfg.Exists()) |
|||
{ |
|||
Configure<AbpTenantResolveOptions>(options => |
|||
{ |
|||
var domains = tenantResolveCfg.Get<string[]>(); |
|||
foreach (var domain in domains) |
|||
{ |
|||
options.AddDomainTenantResolver(domain); |
|||
} |
|||
}); |
|||
} |
|||
} |
|||
|
|||
private void ConfigureAuditing(IConfiguration configuration) |
|||
{ |
|||
Configure<AbpAuditingOptions>(options => |
|||
{ |
|||
options.ApplicationName = ApplicationName; |
|||
// 是否启用实体变更记录
|
|||
var allEntitiesSelectorIsEnabled = configuration["Auditing:AllEntitiesSelector"]; |
|||
if (allEntitiesSelectorIsEnabled.IsNullOrWhiteSpace() || |
|||
(bool.TryParse(allEntitiesSelectorIsEnabled, out var enabled) && enabled)) |
|||
{ |
|||
options.EntityHistorySelectors.AddAllEntities(); |
|||
} |
|||
}); |
|||
} |
|||
|
|||
private void ConfigureSwagger(IServiceCollection services) |
|||
{ |
|||
// Swagger
|
|||
services.AddSwaggerGen( |
|||
options => |
|||
{ |
|||
options.SwaggerDoc("v1", new OpenApiInfo { Title = "App API", Version = "v1" }); |
|||
options.DocInclusionPredicate((docName, description) => true); |
|||
options.CustomSchemaIds(type => type.FullName); |
|||
options.AddSecurityDefinition("Bearer", new OpenApiSecurityScheme |
|||
{ |
|||
Description = "JWT Authorization header using the Bearer scheme. Example: \"Authorization: Bearer {token}\"", |
|||
Name = "Authorization", |
|||
In = ParameterLocation.Header, |
|||
Scheme = "bearer", |
|||
Type = SecuritySchemeType.Http, |
|||
BearerFormat = "JWT" |
|||
}); |
|||
options.AddSecurityRequirement(new OpenApiSecurityRequirement |
|||
{ |
|||
{ |
|||
new OpenApiSecurityScheme |
|||
{ |
|||
Reference = new OpenApiReference { Type = ReferenceType.SecurityScheme, Id = "Bearer" } |
|||
}, |
|||
new string[] { } |
|||
} |
|||
}); |
|||
options.OperationFilter<TenantHeaderParamter>(); |
|||
}); |
|||
} |
|||
|
|||
private void ConfigureIdentity(IConfiguration configuration) |
|||
{ |
|||
// 增加配置文件定义,在新建租户时需要
|
|||
Configure<IdentityOptions>(options => |
|||
{ |
|||
var identityConfiguration = configuration.GetSection("Identity"); |
|||
if (identityConfiguration.Exists()) |
|||
{ |
|||
identityConfiguration.Bind(options); |
|||
} |
|||
}); |
|||
} |
|||
|
|||
private void ConfigureMvcUiTheme() |
|||
{ |
|||
Configure<AbpBundlingOptions>(options => |
|||
{ |
|||
//options.StyleBundles.Configure(
|
|||
// LeptonXLiteThemeBundles.Styles.Global,
|
|||
// bundle =>
|
|||
// {
|
|||
// bundle.AddFiles("/global-styles.css");
|
|||
// }
|
|||
//);
|
|||
}); |
|||
} |
|||
|
|||
private void ConfigureLocalization() |
|||
{ |
|||
Configure<AbpLocalizationOptions>(options => |
|||
{ |
|||
options.Languages.Add(new LanguageInfo("en", "en", "English")); |
|||
options.Languages.Add(new LanguageInfo("zh-Hans", "zh-Hans", "简体中文")); |
|||
|
|||
options |
|||
.AddLanguagesMapOrUpdate( |
|||
"vue-admin-element-ui", |
|||
new NameValue("zh-Hans", "zh"), |
|||
new NameValue("en", "en")); |
|||
|
|||
// vben admin 语言映射
|
|||
options |
|||
.AddLanguagesMapOrUpdate( |
|||
"vben-admin-ui", |
|||
new NameValue("zh_CN", "zh-Hans")); |
|||
}); |
|||
|
|||
Configure<AbpLocalizationCultureMapOptions>(options => |
|||
{ |
|||
var zhHansCultureMapInfo = new CultureMapInfo |
|||
{ |
|||
TargetCulture = "zh-Hans", |
|||
SourceCultures = new string[] { "zh", "zh_CN", "zh-CN" } |
|||
}; |
|||
|
|||
options.CulturesMaps.Add(zhHansCultureMapInfo); |
|||
options.UiCulturesMaps.Add(zhHansCultureMapInfo); |
|||
}); |
|||
} |
|||
|
|||
private void ConfigureAuditing() |
|||
{ |
|||
Configure<AbpAuditingOptions>(options => |
|||
{ |
|||
// options.IsEnabledForGetRequests = true;
|
|||
options.ApplicationName = ApplicationName; |
|||
}); |
|||
} |
|||
|
|||
private void ConfigureUrls(IConfiguration configuration) |
|||
{ |
|||
Configure<AppUrlOptions>(options => |
|||
{ |
|||
options.Applications["MVC"].RootUrl = configuration["App:SelfUrl"]; |
|||
options.Applications["STS"].RootUrl = configuration["App:StsUrl"]; |
|||
|
|||
options.Applications["MVC"].Urls["EmailVerifyLogin"] = "Account/VerifyCode"; |
|||
options.Applications["MVC"].Urls["EmailConfirm"] = "Account/EmailConfirm"; |
|||
}); |
|||
} |
|||
|
|||
private void ConfigureSecurity(IServiceCollection services, IConfiguration configuration, bool isDevelopment = false) |
|||
{ |
|||
services.AddAuthentication() |
|||
.AddJwtBearer(options => |
|||
{ |
|||
options.Authority = configuration["AuthServer:Authority"]; |
|||
options.RequireHttpsMetadata = false; |
|||
options.Audience = configuration["AuthServer:ApiName"]; |
|||
options.Events = new JwtBearerEvents |
|||
{ |
|||
OnMessageReceived = context => |
|||
{ |
|||
var accessToken = context.Request.Query["access_token"]; |
|||
var path = context.HttpContext.Request.Path; |
|||
if (!string.IsNullOrEmpty(accessToken) && |
|||
(path.StartsWithSegments("/api/files"))) |
|||
{ |
|||
context.Token = accessToken; |
|||
} |
|||
return Task.CompletedTask; |
|||
} |
|||
}; |
|||
}); |
|||
|
|||
if (isDevelopment) |
|||
{ |
|||
// services.AddAlwaysAllowAuthorization();
|
|||
} |
|||
|
|||
if (!isDevelopment) |
|||
{ |
|||
var redis = ConnectionMultiplexer.Connect(configuration["Redis:Configuration"]); |
|||
services |
|||
.AddDataProtection() |
|||
.SetApplicationName("LINGYUN.Abp.Application") |
|||
.PersistKeysToStackExchangeRedis(redis, "LINGYUN.Abp.Application:DataProtection:Protection-Keys"); |
|||
} |
|||
|
|||
services.AddSameSiteCookiePolicy(); |
|||
} |
|||
|
|||
private void ConfigureCors(IServiceCollection services, IConfiguration configuration) |
|||
{ |
|||
services.AddCors(options => |
|||
{ |
|||
options.AddPolicy(DefaultCorsPolicyName, builder => |
|||
{ |
|||
builder |
|||
.WithOrigins( |
|||
configuration["App:CorsOrigins"] |
|||
.Split(",", StringSplitOptions.RemoveEmptyEntries) |
|||
.Select(o => o.RemovePostFix("/")) |
|||
.ToArray() |
|||
) |
|||
.WithAbpExposedHeaders() |
|||
.WithAbpWrapExposedHeaders() |
|||
.SetIsOriginAllowedToAllowWildcardSubdomains() |
|||
.AllowAnyHeader() |
|||
.AllowAnyMethod() |
|||
.AllowCredentials(); |
|||
}); |
|||
}); |
|||
} |
|||
} |
|||
@ -0,0 +1,16 @@ |
|||
using LY.MicroService.Applications.Single.DataSeeder; |
|||
|
|||
namespace LY.MicroService.Applications.Single; |
|||
|
|||
public partial class MicroServiceApplicationsSingleModule |
|||
{ |
|||
private static void ConfigureSeedWorker(IServiceCollection services, bool isDevelopment = false) |
|||
{ |
|||
services.AddHostedService<DataSeederWorker>(); |
|||
|
|||
if (isDevelopment) |
|||
{ |
|||
services.AddHostedService<DataSeederWorker>(); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,331 @@ |
|||
using LINGYUN.Abp.Account; |
|||
using LINGYUN.Abp.Account.Templates; |
|||
using LINGYUN.Abp.Aliyun.SettingManagement; |
|||
using LINGYUN.Abp.AspNetCore.HttpOverrides; |
|||
using LINGYUN.Abp.AspNetCore.Mvc.Localization; |
|||
using LINGYUN.Abp.AspNetCore.Mvc.Wrapper; |
|||
using LINGYUN.Abp.Auditing; |
|||
using LINGYUN.Abp.AuditLogging.EntityFrameworkCore; |
|||
using LINGYUN.Abp.Authentication.QQ; |
|||
using LINGYUN.Abp.Authentication.WeChat; |
|||
using LINGYUN.Abp.Authorization.OrganizationUnits; |
|||
using LINGYUN.Abp.BackgroundTasks; |
|||
using LINGYUN.Abp.BackgroundTasks.Activities; |
|||
using LINGYUN.Abp.BackgroundTasks.DistributedLocking; |
|||
using LINGYUN.Abp.BackgroundTasks.EventBus; |
|||
using LINGYUN.Abp.BackgroundTasks.ExceptionHandling; |
|||
using LINGYUN.Abp.BackgroundTasks.Jobs; |
|||
using LINGYUN.Abp.BackgroundTasks.Notifications; |
|||
using LINGYUN.Abp.BackgroundTasks.Quartz; |
|||
using LINGYUN.Abp.CachingManagement; |
|||
using LINGYUN.Abp.CachingManagement.StackExchangeRedis; |
|||
using LINGYUN.Abp.Dapr.Client; |
|||
using LINGYUN.Abp.Data.DbMigrator; |
|||
using LINGYUN.Abp.Elsa; |
|||
using LINGYUN.Abp.Elsa.Activities; |
|||
using LINGYUN.Abp.Elsa.EntityFrameworkCore; |
|||
using LINGYUN.Abp.Elsa.EntityFrameworkCore.MySql; |
|||
using LINGYUN.Abp.ExceptionHandling; |
|||
using LINGYUN.Abp.ExceptionHandling.Emailing; |
|||
using LINGYUN.Abp.Features.LimitValidation; |
|||
using LINGYUN.Abp.Features.LimitValidation.Redis.Client; |
|||
using LINGYUN.Abp.Http.Client.Wrapper; |
|||
using LINGYUN.Abp.Identity; |
|||
using LINGYUN.Abp.Identity.EntityFrameworkCore; |
|||
using LINGYUN.Abp.Identity.OrganizaztionUnits; |
|||
using LINGYUN.Abp.Identity.WeChat; |
|||
using LINGYUN.Abp.IdentityServer; |
|||
using LINGYUN.Abp.IdentityServer.EntityFrameworkCore; |
|||
using LINGYUN.Abp.IdGenerator; |
|||
using LINGYUN.Abp.IM.SignalR; |
|||
using LINGYUN.Abp.Localization.CultureMap; |
|||
using LINGYUN.Abp.Localization.Persistence; |
|||
using LINGYUN.Abp.LocalizationManagement; |
|||
using LINGYUN.Abp.LocalizationManagement.EntityFrameworkCore; |
|||
using LINGYUN.Abp.MessageService; |
|||
using LINGYUN.Abp.MessageService.EntityFrameworkCore; |
|||
using LINGYUN.Abp.MultiTenancy.Editions; |
|||
using LINGYUN.Abp.Notifications; |
|||
using LINGYUN.Abp.Notifications.Common; |
|||
using LINGYUN.Abp.Notifications.Emailing; |
|||
using LINGYUN.Abp.Notifications.EntityFrameworkCore; |
|||
using LINGYUN.Abp.Notifications.SignalR; |
|||
using LINGYUN.Abp.Notifications.WeChat.MiniProgram; |
|||
using LINGYUN.Abp.OpenApi.Authorization; |
|||
using LINGYUN.Abp.OpenIddict; |
|||
using LINGYUN.Abp.OssManagement; |
|||
using LINGYUN.Abp.OssManagement.FileSystem.ImageSharp; |
|||
using LINGYUN.Abp.OssManagement.SettingManagement; |
|||
using LINGYUN.Abp.PermissionManagement.OrganizationUnits; |
|||
using LINGYUN.Abp.Saas; |
|||
using LINGYUN.Abp.Saas.EntityFrameworkCore; |
|||
using LINGYUN.Abp.Serilog.Enrichers.Application; |
|||
using LINGYUN.Abp.Serilog.Enrichers.UniqueId; |
|||
using LINGYUN.Abp.SettingManagement; |
|||
using LINGYUN.Abp.Sms.Aliyun; |
|||
using LINGYUN.Abp.TaskManagement; |
|||
using LINGYUN.Abp.TaskManagement.EntityFrameworkCore; |
|||
using LINGYUN.Abp.Tencent.QQ; |
|||
using LINGYUN.Abp.Tencent.SettingManagement; |
|||
using LINGYUN.Abp.TextTemplating; |
|||
using LINGYUN.Abp.TextTemplating.EntityFrameworkCore; |
|||
using LINGYUN.Abp.UI.Navigation; |
|||
using LINGYUN.Abp.UI.Navigation.VueVbenAdmin; |
|||
using LINGYUN.Abp.Webhooks; |
|||
using LINGYUN.Abp.Webhooks.EventBus; |
|||
using LINGYUN.Abp.Webhooks.Identity; |
|||
using LINGYUN.Abp.Webhooks.Saas; |
|||
using LINGYUN.Abp.WebhooksManagement; |
|||
using LINGYUN.Abp.WebhooksManagement.EntityFrameworkCore; |
|||
using LINGYUN.Abp.WeChat.MiniProgram; |
|||
using LINGYUN.Abp.WeChat.Official; |
|||
using LINGYUN.Abp.WeChat.SettingManagement; |
|||
using LINGYUN.Platform; |
|||
using LINGYUN.Platform.EntityFrameworkCore; |
|||
using LINGYUN.Platform.HttpApi; |
|||
using LINGYUN.Platform.Settings.VueVbenAdmin; |
|||
using LINGYUN.Platform.Theme.VueVbenAdmin; |
|||
using LY.MicroService.Applications.Single.EntityFrameworkCore; |
|||
using Volo.Abp; |
|||
using Volo.Abp.AspNetCore.Authentication.JwtBearer; |
|||
using Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy; |
|||
using Volo.Abp.AspNetCore.Serilog; |
|||
using Volo.Abp.Autofac; |
|||
using Volo.Abp.Caching.StackExchangeRedis; |
|||
using Volo.Abp.EntityFrameworkCore.MySQL; |
|||
using Volo.Abp.EventBus; |
|||
using Volo.Abp.FeatureManagement; |
|||
using Volo.Abp.FeatureManagement.EntityFrameworkCore; |
|||
using Volo.Abp.Modularity; |
|||
using Volo.Abp.OpenIddict; |
|||
using Volo.Abp.OpenIddict.EntityFrameworkCore; |
|||
using Volo.Abp.PermissionManagement; |
|||
using Volo.Abp.PermissionManagement.EntityFrameworkCore; |
|||
using Volo.Abp.PermissionManagement.HttpApi; |
|||
using Volo.Abp.PermissionManagement.Identity; |
|||
using Volo.Abp.PermissionManagement.IdentityServer; |
|||
using Volo.Abp.SettingManagement; |
|||
using Volo.Abp.SettingManagement.EntityFrameworkCore; |
|||
|
|||
namespace LY.MicroService.Applications.Single; |
|||
|
|||
[DependsOn( |
|||
typeof(AbpAccountApplicationModule), |
|||
typeof(AbpAccountHttpApiModule), |
|||
typeof(AbpAuditingApplicationModule), |
|||
typeof(AbpAuditingHttpApiModule), |
|||
typeof(AbpAuditLoggingEntityFrameworkCoreModule), |
|||
typeof(AbpCachingManagementStackExchangeRedisModule), |
|||
typeof(AbpCachingManagementApplicationModule), |
|||
typeof(AbpCachingManagementHttpApiModule), |
|||
typeof(AbpIdentityDomainModule), |
|||
typeof(AbpIdentityApplicationModule), |
|||
typeof(AbpIdentityHttpApiModule), |
|||
typeof(AbpIdentityEntityFrameworkCoreModule), |
|||
typeof(AbpIdentityServerDomainModule), |
|||
typeof(AbpIdentityServerApplicationModule), |
|||
typeof(AbpIdentityServerHttpApiModule), |
|||
typeof(AbpIdentityServerEntityFrameworkCoreModule), |
|||
typeof(AbpLocalizationManagementDomainModule), |
|||
typeof(AbpLocalizationManagementApplicationModule), |
|||
typeof(AbpLocalizationManagementHttpApiModule), |
|||
typeof(AbpLocalizationManagementEntityFrameworkCoreModule), |
|||
typeof(AbpSerilogEnrichersApplicationModule), |
|||
typeof(AbpSerilogEnrichersUniqueIdModule), |
|||
typeof(AbpMessageServiceDomainModule), |
|||
typeof(AbpMessageServiceApplicationModule), |
|||
typeof(AbpMessageServiceHttpApiModule), |
|||
typeof(AbpMessageServiceEntityFrameworkCoreModule), |
|||
typeof(AbpNotificationsDomainModule), |
|||
typeof(AbpNotificationsApplicationModule), |
|||
typeof(AbpNotificationsHttpApiModule), |
|||
typeof(AbpNotificationsEntityFrameworkCoreModule), |
|||
typeof(AbpOpenIddictDomainModule), |
|||
typeof(AbpOpenIddictApplicationModule), |
|||
typeof(AbpOpenIddictHttpApiModule), |
|||
typeof(AbpOpenIddictEntityFrameworkCoreModule), |
|||
typeof(AbpOssManagementDomainModule), |
|||
typeof(AbpOssManagementApplicationModule), |
|||
typeof(AbpOssManagementHttpApiModule), |
|||
typeof(AbpOssManagementFileSystemImageSharpModule), |
|||
typeof(AbpOssManagementSettingManagementModule), |
|||
typeof(PlatformDomainModule), |
|||
typeof(PlatformApplicationModule), |
|||
typeof(PlatformHttpApiModule), |
|||
typeof(PlatformEntityFrameworkCoreModule), |
|||
typeof(PlatformSettingsVueVbenAdminModule), |
|||
typeof(PlatformThemeVueVbenAdminModule), |
|||
typeof(AbpUINavigationVueVbenAdminModule), |
|||
typeof(AbpSaasDomainModule), |
|||
typeof(AbpSaasApplicationModule), |
|||
typeof(AbpSaasHttpApiModule), |
|||
typeof(AbpSaasEntityFrameworkCoreModule), |
|||
typeof(TaskManagementDomainModule), |
|||
typeof(TaskManagementApplicationModule), |
|||
typeof(TaskManagementHttpApiModule), |
|||
typeof(TaskManagementEntityFrameworkCoreModule), |
|||
typeof(AbpTextTemplatingDomainModule), |
|||
typeof(AbpTextTemplatingApplicationModule), |
|||
typeof(AbpTextTemplatingHttpApiModule), |
|||
typeof(AbpTextTemplatingEntityFrameworkCoreModule), |
|||
typeof(AbpWebhooksModule), |
|||
typeof(AbpWebhooksEventBusModule), |
|||
typeof(AbpWebhooksIdentityModule), |
|||
typeof(AbpWebhooksSaasModule), |
|||
typeof(WebhooksManagementDomainModule), |
|||
typeof(WebhooksManagementApplicationModule), |
|||
typeof(WebhooksManagementHttpApiModule), |
|||
typeof(WebhooksManagementEntityFrameworkCoreModule), |
|||
typeof(AbpFeatureManagementDomainModule), |
|||
typeof(AbpFeatureManagementApplicationModule), |
|||
typeof(AbpFeatureManagementHttpApiModule), |
|||
typeof(AbpFeatureManagementEntityFrameworkCoreModule), |
|||
typeof(AbpSettingManagementDomainModule), |
|||
typeof(AbpSettingManagementApplicationModule), |
|||
typeof(AbpSettingManagementHttpApiModule), |
|||
typeof(AbpSettingManagementEntityFrameworkCoreModule), |
|||
typeof(AbpPermissionManagementDomainModule), |
|||
typeof(AbpPermissionManagementApplicationModule), |
|||
typeof(AbpPermissionManagementHttpApiModule), |
|||
typeof(AbpPermissionManagementDomainIdentityModule), |
|||
typeof(AbpPermissionManagementDomainIdentityServerModule), |
|||
typeof(AbpPermissionManagementEntityFrameworkCoreModule), |
|||
typeof(AbpPermissionManagementDomainOrganizationUnitsModule), // 组织机构权限管理
|
|||
typeof(SingleMigrationsEntityFrameworkCoreModule), |
|||
typeof(AbpEntityFrameworkCoreMySQLModule), |
|||
typeof(AbpAliyunSmsModule), |
|||
typeof(AbpAliyunSettingManagementModule), |
|||
typeof(AbpAuthenticationQQModule), |
|||
typeof(AbpAuthenticationWeChatModule), |
|||
typeof(AbpAuthorizationOrganizationUnitsModule), |
|||
typeof(AbpIdentityOrganizaztionUnitsModule), |
|||
typeof(AbpBackgroundTasksModule), |
|||
typeof(AbpBackgroundTasksActivitiesModule), |
|||
typeof(AbpBackgroundTasksDistributedLockingModule), |
|||
typeof(AbpBackgroundTasksEventBusModule), |
|||
typeof(AbpBackgroundTasksExceptionHandlingModule), |
|||
typeof(AbpBackgroundTasksJobsModule), |
|||
typeof(AbpBackgroundTasksNotificationsModule), |
|||
typeof(AbpBackgroundTasksQuartzModule), |
|||
typeof(AbpDaprClientModule), |
|||
typeof(AbpExceptionHandlingModule), |
|||
typeof(AbpEmailingExceptionHandlingModule), |
|||
typeof(AbpFeaturesLimitValidationModule), |
|||
typeof(AbpFeaturesValidationRedisClientModule), |
|||
typeof(AbpAspNetCoreMvcLocalizationModule), |
|||
typeof(AbpLocalizationCultureMapModule), |
|||
typeof(AbpLocalizationPersistenceModule), |
|||
typeof(AbpOpenApiAuthorizationModule), |
|||
typeof(AbpIMSignalRModule), |
|||
typeof(AbpNotificationsModule), |
|||
typeof(AbpNotificationsCommonModule), |
|||
typeof(AbpNotificationsSignalRModule), |
|||
typeof(AbpNotificationsEmailingModule), |
|||
typeof(AbpMultiTenancyEditionsModule), |
|||
typeof(AbpTencentQQModule), |
|||
typeof(AbpTencentCloudSettingManagementModule), |
|||
typeof(AbpIdentityWeChatModule), |
|||
typeof(AbpNotificationsWeChatMiniProgramModule), |
|||
typeof(AbpWeChatMiniProgramModule), |
|||
typeof(AbpWeChatOfficialModule), |
|||
typeof(AbpWeChatSettingManagementModule), |
|||
typeof(AbpDataDbMigratorModule), |
|||
typeof(AbpIdGeneratorModule), |
|||
typeof(AbpUINavigationModule), |
|||
typeof(AbpAccountTemplatesModule), |
|||
typeof(AbpAspNetCoreAuthenticationJwtBearerModule), |
|||
typeof(AbpCachingStackExchangeRedisModule), |
|||
typeof(AbpElsaModule), |
|||
typeof(AbpElsaServerModule), |
|||
typeof(AbpElsaActivitiesModule), |
|||
typeof(AbpElsaEntityFrameworkCoreModule), |
|||
typeof(AbpElsaEntityFrameworkCoreMySqlModule), |
|||
typeof(AbpAspNetCoreMvcUiMultiTenancyModule), |
|||
typeof(AbpAspNetCoreSerilogModule), |
|||
typeof(AbpHttpClientWrapperModule), |
|||
typeof(AbpAspNetCoreMvcWrapperModule), |
|||
typeof(AbpAspNetCoreHttpOverridesModule), |
|||
typeof(AbpEventBusModule), |
|||
typeof(AbpAutofacModule) |
|||
)] |
|||
public partial class MicroServiceApplicationsSingleModule : AbpModule |
|||
{ |
|||
public override void PreConfigureServices(ServiceConfigurationContext context) |
|||
{ |
|||
var configuration = context.Services.GetConfiguration(); |
|||
var hostingEnvironment = context.Services.GetHostingEnvironment(); |
|||
|
|||
PreConfigureApp(); |
|||
PreConfigureFeature(); |
|||
PreConfigureQuartz(configuration); |
|||
PreConfigureElsa(context.Services, configuration); |
|||
PreConfigureCertificate(configuration, hostingEnvironment); |
|||
} |
|||
|
|||
public override void ConfigureServices(ServiceConfigurationContext context) |
|||
{ |
|||
var hostingEnvironment = context.Services.GetHostingEnvironment(); |
|||
var configuration = context.Services.GetConfiguration(); |
|||
|
|||
ConfigureAuditing(); |
|||
ConfigureDbContext(); |
|||
ConfigureMvcUiTheme(); |
|||
ConfigureDataSeeder(); |
|||
ConfigureBlobStoring(); |
|||
ConfigureLocalization(); |
|||
ConfigureKestrelServer(); |
|||
ConfigureJsonSerializer(); |
|||
ConfigureTextTemplating(); |
|||
ConfigureBackgroundTasks(); |
|||
ConfigureFeatureManagement(); |
|||
ConfigurePermissionManagement(); |
|||
ConfigureUrls(configuration); |
|||
ConfigureCaching(configuration); |
|||
ConfigureAuditing(configuration); |
|||
ConfigureIdentity(configuration); |
|||
ConfigureSwagger(context.Services); |
|||
ConfigureEndpoints(context.Services); |
|||
ConfigureMultiTenancy(configuration); |
|||
ConfigureCors(context.Services, configuration); |
|||
ConfigureDistributedLock(context.Services, configuration); |
|||
ConfigureSeedWorker(context.Services, hostingEnvironment.IsDevelopment()); |
|||
ConfigureSecurity(context.Services, configuration, hostingEnvironment.IsDevelopment()); |
|||
} |
|||
|
|||
public override void OnApplicationInitialization(ApplicationInitializationContext context) |
|||
{ |
|||
var app = context.GetApplicationBuilder(); |
|||
|
|||
app.UseCookiePolicy(); |
|||
// 本地化
|
|||
app.UseMapRequestLocalization(); |
|||
// http调用链
|
|||
app.UseCorrelationId(); |
|||
// 虚拟文件系统
|
|||
app.UseStaticFiles(); |
|||
// 路由
|
|||
app.UseRouting(); |
|||
// 跨域
|
|||
app.UseCors(DefaultCorsPolicyName); |
|||
// 认证
|
|||
app.UseAuthentication(); |
|||
// jwt
|
|||
app.UseJwtTokenMiddleware(); |
|||
// 多租户
|
|||
app.UseMultiTenancy(); |
|||
// 授权
|
|||
app.UseAuthorization(); |
|||
// Swagger
|
|||
app.UseSwagger(); |
|||
// Swagger可视化界面
|
|||
app.UseSwaggerUI(options => |
|||
{ |
|||
options.SwaggerEndpoint("/swagger/v1/swagger.json", "Support App API"); |
|||
}); |
|||
// 审计日志
|
|||
app.UseAuditing(); |
|||
app.UseAbpSerilogEnrichers(); |
|||
// 路由
|
|||
app.UseConfiguredEndpoints(); |
|||
} |
|||
} |
|||
@ -0,0 +1,70 @@ |
|||
using Microsoft.AspNetCore.Builder; |
|||
using Microsoft.AspNetCore.Http; |
|||
|
|||
namespace Microsoft.Extensions.DependencyInjection |
|||
{ |
|||
public static class SameSiteCookiesServiceCollectionExtensions |
|||
{ |
|||
public static IServiceCollection AddSameSiteCookiePolicy(this IServiceCollection services) |
|||
{ |
|||
services.Configure<CookiePolicyOptions>(options => |
|||
{ |
|||
options.MinimumSameSitePolicy = SameSiteMode.Unspecified; |
|||
options.OnAppendCookie = cookieContext => |
|||
CheckSameSite(cookieContext.Context, cookieContext.CookieOptions); |
|||
options.OnDeleteCookie = cookieContext => |
|||
CheckSameSite(cookieContext.Context, cookieContext.CookieOptions); |
|||
}); |
|||
|
|||
return services; |
|||
} |
|||
|
|||
private static void CheckSameSite(HttpContext httpContext, CookieOptions options) |
|||
{ |
|||
if (options.SameSite == SameSiteMode.None) |
|||
{ |
|||
var userAgent = httpContext.Request.Headers["User-Agent"].ToString(); |
|||
if (!httpContext.Request.IsHttps || DisallowsSameSiteNone(userAgent)) |
|||
{ |
|||
// For .NET Core < 3.1 set SameSite = (SameSiteMode)(-1)
|
|||
options.SameSite = SameSiteMode.Unspecified; |
|||
} |
|||
} |
|||
} |
|||
|
|||
private static bool DisallowsSameSiteNone(string userAgent) |
|||
{ |
|||
// Cover all iOS based browsers here. This includes:
|
|||
// - Safari on iOS 12 for iPhone, iPod Touch, iPad
|
|||
// - WkWebview on iOS 12 for iPhone, iPod Touch, iPad
|
|||
// - Chrome on iOS 12 for iPhone, iPod Touch, iPad
|
|||
// All of which are broken by SameSite=None, because they use the iOS networking stack
|
|||
if (userAgent.Contains("CPU iPhone OS 12") || userAgent.Contains("iPad; CPU OS 12")) |
|||
{ |
|||
return true; |
|||
} |
|||
|
|||
// Cover Mac OS X based browsers that use the Mac OS networking stack. This includes:
|
|||
// - Safari on Mac OS X.
|
|||
// This does not include:
|
|||
// - Chrome on Mac OS X
|
|||
// Because they do not use the Mac OS networking stack.
|
|||
if (userAgent.Contains("Macintosh; Intel Mac OS X 10_14") && |
|||
userAgent.Contains("Version/") && userAgent.Contains("Safari")) |
|||
{ |
|||
return true; |
|||
} |
|||
|
|||
// Cover Chrome 50-69, because some versions are broken by SameSite=None,
|
|||
// and none in this range require it.
|
|||
// Note: this covers some pre-Chromium Edge versions,
|
|||
// but pre-Chromium Edge does not require SameSite=None.
|
|||
if (userAgent.Contains("Chrome/5") || userAgent.Contains("Chrome/6")) |
|||
{ |
|||
return true; |
|||
} |
|||
|
|||
return false; |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,50 @@ |
|||
using Serilog; |
|||
using Volo.Abp.IO; |
|||
using Volo.Abp.Modularity.PlugIns; |
|||
|
|||
namespace LY.MicroService.Applications.Single; |
|||
|
|||
public class Program |
|||
{ |
|||
public async static Task<int> Main(string[] args) |
|||
{ |
|||
try |
|||
{ |
|||
Log.Information("Starting MicroService Applications Single Host."); |
|||
|
|||
var builder = WebApplication.CreateBuilder(args); |
|||
builder.Host.AddAppSettingsSecretsJson() |
|||
.UseAutofac() |
|||
.UseSerilog((context, provider, config) => |
|||
{ |
|||
config.ReadFrom.Configuration(context.Configuration); |
|||
}); |
|||
await builder.AddApplicationAsync<MicroServiceApplicationsSingleModule>(options => |
|||
{ |
|||
// 搜索 Modules 目录下所有文件作为插件
|
|||
// 取消显示引用所有其他项目的模块,改为通过插件的形式引用
|
|||
var pluginFolder = Path.Combine( |
|||
Directory.GetCurrentDirectory(), "Modules"); |
|||
DirectoryHelper.CreateIfNotExists(pluginFolder); |
|||
options.PlugInSources.AddFolder( |
|||
pluginFolder, |
|||
SearchOption.AllDirectories); |
|||
}); |
|||
var app = builder.Build(); |
|||
await app.InitializeApplicationAsync(); |
|||
await app.RunAsync(); |
|||
return 0; |
|||
} |
|||
catch (Exception ex) |
|||
{ |
|||
Log.Fatal(ex, "Host terminated unexpectedly!"); |
|||
Console.WriteLine("Host terminated unexpectedly!"); |
|||
Console.WriteLine(ex.ToString()); |
|||
return 1; |
|||
} |
|||
finally |
|||
{ |
|||
Log.CloseAndFlush(); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,21 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<!-- |
|||
https://go.microsoft.com/fwlink/?LinkID=208121. |
|||
--> |
|||
<Project> |
|||
<PropertyGroup> |
|||
<DeleteExistingFiles>true</DeleteExistingFiles> |
|||
<ExcludeApp_Data>false</ExcludeApp_Data> |
|||
<LaunchSiteAfterPublish>true</LaunchSiteAfterPublish> |
|||
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration> |
|||
<LastUsedPlatform>Any CPU</LastUsedPlatform> |
|||
<PublishProvider>FileSystem</PublishProvider> |
|||
<PublishUrl>bin\Release\net7.0\publish\</PublishUrl> |
|||
<WebPublishMethod>FileSystem</WebPublishMethod> |
|||
<_TargetId>Folder</_TargetId> |
|||
<SiteUrlToLaunchAfterPublish /> |
|||
<TargetFramework>net7.0</TargetFramework> |
|||
<ProjectGuid>83d2f8f2-82c7-4919-9b65-d0fbf0b5324c</ProjectGuid> |
|||
<SelfContained>false</SelfContained> |
|||
</PropertyGroup> |
|||
</Project> |
|||
@ -0,0 +1,11 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<!-- |
|||
https://go.microsoft.com/fwlink/?LinkID=208121. |
|||
--> |
|||
<Project> |
|||
<PropertyGroup> |
|||
<_PublishTargetUrl>F:\C Sharp\Open-Sources\abp-next-admin\aspnet-core\services\LY.MicroService.Applications.Single\bin\Release\net7.0\publish\</_PublishTargetUrl> |
|||
<History>True|2023-03-13T08:15:34.0614366Z;False|2023-03-13T16:09:47.4416329+08:00;</History> |
|||
<LastFailureDetails /> |
|||
</PropertyGroup> |
|||
</Project> |
|||
@ -0,0 +1,21 @@ |
|||
{ |
|||
"iisSettings": { |
|||
"windowsAuthentication": false, |
|||
"anonymousAuthentication": true, |
|||
"iisExpress": { |
|||
"applicationUrl": "http://localhost:19139", |
|||
"sslPort": 0 |
|||
} |
|||
}, |
|||
"profiles": { |
|||
"LY.MicroService.Applications.Single": { |
|||
"commandName": "Project", |
|||
"dotnetRunMessages": true, |
|||
"launchBrowser": false, |
|||
"applicationUrl": "http://127.0.0.1:30000", |
|||
"environmentVariables": { |
|||
"ASPNETCORE_ENVIRONMENT": "Production" |
|||
} |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,36 @@ |
|||
using Microsoft.Extensions.Options; |
|||
using Microsoft.OpenApi.Models; |
|||
using Swashbuckle.AspNetCore.SwaggerGen; |
|||
using System.Collections.Generic; |
|||
using Volo.Abp.MultiTenancy; |
|||
using Volo.Abp.AspNetCore.MultiTenancy; |
|||
|
|||
namespace LY.MicroService.Applications.Single; |
|||
|
|||
public class TenantHeaderParamter : IOperationFilter |
|||
{ |
|||
private readonly AbpMultiTenancyOptions _multiTenancyOptions; |
|||
private readonly AbpAspNetCoreMultiTenancyOptions _aspNetCoreMultiTenancyOptions; |
|||
public TenantHeaderParamter( |
|||
IOptions<AbpMultiTenancyOptions> multiTenancyOptions, |
|||
IOptions<AbpAspNetCoreMultiTenancyOptions> aspNetCoreMultiTenancyOptions) |
|||
{ |
|||
_multiTenancyOptions = multiTenancyOptions.Value; |
|||
_aspNetCoreMultiTenancyOptions = aspNetCoreMultiTenancyOptions.Value; |
|||
} |
|||
|
|||
public void Apply(OpenApiOperation operation, OperationFilterContext context) |
|||
{ |
|||
if (_multiTenancyOptions.IsEnabled) |
|||
{ |
|||
operation.Parameters = operation.Parameters ?? new List<OpenApiParameter>(); |
|||
operation.Parameters.Add(new OpenApiParameter |
|||
{ |
|||
Name = _aspNetCoreMultiTenancyOptions.TenantKey, |
|||
In = ParameterLocation.Header, |
|||
Description = "Tenant Id in http header", |
|||
Required = false |
|||
}); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,105 @@ |
|||
{ |
|||
"App": { |
|||
"Forwarded": { |
|||
"ForwardedHeaders": 5, |
|||
"KnownProxies": [ |
|||
"127.0.0.1" |
|||
] |
|||
}, |
|||
"CorsOrigins": "http://127.0.0.1:3100" |
|||
}, |
|||
"Auditing": { |
|||
"AllEntitiesSelector": true |
|||
}, |
|||
"DistributedCache": { |
|||
"HideErrors": true, |
|||
"KeyPrefix": "LINGYUN.Abp.Application", |
|||
"GlobalCacheEntryOptions": { |
|||
"SlidingExpiration": "30:00:00", |
|||
"AbsoluteExpirationRelativeToNow": "60:00:00" |
|||
} |
|||
}, |
|||
"ConnectionStrings": { |
|||
"Default": "Server=127.0.0.1;Database=Platform-V70;User Id=root;Password=123456", |
|||
"AbpIdentity": "Server=127.0.0.1;Database=IdentityServer-V70;User Id=root;Password=123456", |
|||
"AbpIdentityServer": "Server=127.0.0.1;Database=IdentityServer-V70;User Id=root;Password=123456", |
|||
"AbpSaas": "Server=127.0.0.1;Database=Platform-V70;User Id=root;Password=123456", |
|||
"AbpSettingManagement": "Server=127.0.0.1;Database=Platform-V70;User Id=root;Password=123456", |
|||
"AbpFeatureManagement": "Server=127.0.0.1;Database=Platform-V70;User Id=root;Password=123456", |
|||
"AbpPermissionManagement": "Server=127.0.0.1;Database=Platform-V70;User Id=root;Password=123456", |
|||
"AbpLocalizationManagement": "Server=127.0.0.1;Database=Platform-V70;User Id=root;Password=123456", |
|||
"AbpTextTemplating": "Server=127.0.0.1;Database=Platform-V70;User Id=root;Password=123456" |
|||
}, |
|||
"CAP": { |
|||
"EventBus": { |
|||
"DefaultGroupName": "BackendAdmin", |
|||
"Version": "v1", |
|||
"FailedRetryInterval": 300, |
|||
"FailedRetryCount": 10, |
|||
"CollectorCleaningInterval": 3600000 |
|||
}, |
|||
"MySql": { |
|||
"TableNamePrefix": "admin", |
|||
"ConnectionString": "Server=127.0.0.1;Database=Platform;User Id=root;Password=123456" |
|||
}, |
|||
"RabbitMQ": { |
|||
"HostName": "127.0.0.1", |
|||
"Port": 5672, |
|||
"UserName": "guest", |
|||
"Password": "guest", |
|||
"ExchangeName": "LINGYUN.Abp.Application", |
|||
"VirtualHost": "/" |
|||
} |
|||
}, |
|||
"Redis": { |
|||
"Configuration": "127.0.0.1,defaultDatabase=10", |
|||
"InstanceName": "LINGYUN.Abp.Application" |
|||
}, |
|||
"AuthServer": { |
|||
"Authority": "http://127.0.0.1:44385/", |
|||
"ApiName": "lingyun-abp-application" |
|||
}, |
|||
"Logging": { |
|||
"Serilog": { |
|||
"Elasticsearch": { |
|||
"IndexFormat": "abp.dev.logging-{0:yyyy.MM.dd}" |
|||
} |
|||
} |
|||
}, |
|||
"AuditLogging": { |
|||
"Elasticsearch": { |
|||
"IndexPrefix": "abp.dev.auditing" |
|||
} |
|||
}, |
|||
"Elasticsearch": { |
|||
"NodeUris": "http://127.0.0.1:9200" |
|||
}, |
|||
"Serilog": { |
|||
"MinimumLevel": { |
|||
"Default": "Debug", |
|||
"Override": { |
|||
"System": "Warning", |
|||
"Microsoft": "Warning", |
|||
"DotNetCore": "Debug" |
|||
} |
|||
}, |
|||
"WriteTo": [ |
|||
{ |
|||
"Name": "Console", |
|||
"Args": { |
|||
"restrictedToMinimumLevel": "Debug", |
|||
"outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss} [{Level:u3}] [{SourceContext}] [{ProcessId}] [{ThreadId}] - {Message:lj}{NewLine}{Exception}" |
|||
} |
|||
}, |
|||
{ |
|||
"Name": "Elasticsearch", |
|||
"Args": { |
|||
"nodeUris": "http://127.0.0.1:9200", |
|||
"indexFormat": "abp.dev.logging-{0:yyyy.MM.dd}", |
|||
"autoRegisterTemplate": true, |
|||
"autoRegisterTemplateVersion": "ESv7" |
|||
} |
|||
} |
|||
] |
|||
} |
|||
} |
|||
@ -0,0 +1,76 @@ |
|||
{ |
|||
"StringEncryption": { |
|||
"DefaultPassPhrase": "s46c5q55nxpeS8Ra", |
|||
"InitVectorBytes": "s83ng0abvd02js84", |
|||
"DefaultSalt": "sf&5)s3#" |
|||
}, |
|||
"AllowedHosts": "*", |
|||
"Hosting": { |
|||
"BasePath": "" |
|||
}, |
|||
"Serilog": { |
|||
"MinimumLevel": { |
|||
"Default": "Information", |
|||
"Override": { |
|||
"System": "Warning", |
|||
"Microsoft": "Warning", |
|||
"DotNetCore": "Information" |
|||
} |
|||
}, |
|||
"Enrich": [ "FromLogContext", "WithProcessId", "WithThreadId", "WithEnvironmentName", "WithMachineName", "WithApplicationName", "WithUniqueId" ], |
|||
"WriteTo": [ |
|||
{ |
|||
"Name": "Console", |
|||
"Args": { |
|||
"restrictedToMinimumLevel": "Debug", |
|||
"outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss} [{Level:u3}] [{SourceContext}] [{ProcessId}] [{ThreadId}] - {Message:lj}{NewLine}{Exception}" |
|||
} |
|||
}, |
|||
{ |
|||
"Name": "File", |
|||
"Args": { |
|||
"path": "Logs/Debug-.log", |
|||
"restrictedToMinimumLevel": "Debug", |
|||
"rollingInterval": "Day", |
|||
"outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss} [{Level:u3}] [{SourceContext}] [{ProcessId}] [{ThreadId}] - {Message:lj}{NewLine}{Exception}" |
|||
} |
|||
}, |
|||
{ |
|||
"Name": "File", |
|||
"Args": { |
|||
"path": "Logs/Info-.log", |
|||
"restrictedToMinimumLevel": "Information", |
|||
"rollingInterval": "Day", |
|||
"outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss} [{Level:u3}] [{SourceContext}] [{ProcessId}] [{ThreadId}] - {Message:lj}{NewLine}{Exception}" |
|||
} |
|||
}, |
|||
{ |
|||
"Name": "File", |
|||
"Args": { |
|||
"path": "Logs/Warn-.log", |
|||
"restrictedToMinimumLevel": "Warning", |
|||
"rollingInterval": "Day", |
|||
"outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss} [{Level:u3}] [{SourceContext}] [{ProcessId}] [{ThreadId}] - {Message:lj}{NewLine}{Exception}" |
|||
} |
|||
}, |
|||
{ |
|||
"Name": "File", |
|||
"Args": { |
|||
"path": "Logs/Error-.log", |
|||
"restrictedToMinimumLevel": "Error", |
|||
"rollingInterval": "Day", |
|||
"outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss} [{Level:u3}] [{SourceContext}] [{ProcessId}] [{ThreadId}] - {Message:lj}{NewLine}{Exception}" |
|||
} |
|||
}, |
|||
{ |
|||
"Name": "File", |
|||
"Args": { |
|||
"path": "Logs/Fatal-.log", |
|||
"restrictedToMinimumLevel": "Fatal", |
|||
"rollingInterval": "Day", |
|||
"outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss} [{Level:u3}] [{SourceContext}] [{ProcessId}] [{ThreadId}] - {Message:lj}{NewLine}{Exception}" |
|||
} |
|||
} |
|||
] |
|||
} |
|||
} |
|||
@ -1,4 +1,5 @@ |
|||
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers |
|||
@using Microsoft.Extensions.Configuration |
|||
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers |
|||
@addTagHelper *, Volo.Abp.AspNetCore.Mvc.UI |
|||
@addTagHelper *, Volo.Abp.AspNetCore.Mvc.UI.Bootstrap |
|||
@addTagHelper *, Volo.Abp.AspNetCore.Mvc.UI.Bundling |
|||
@ -0,0 +1,21 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<!-- |
|||
https://go.microsoft.com/fwlink/?LinkID=208121. |
|||
--> |
|||
<Project> |
|||
<PropertyGroup> |
|||
<DeleteExistingFiles>true</DeleteExistingFiles> |
|||
<ExcludeApp_Data>false</ExcludeApp_Data> |
|||
<LaunchSiteAfterPublish>true</LaunchSiteAfterPublish> |
|||
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration> |
|||
<LastUsedPlatform>Any CPU</LastUsedPlatform> |
|||
<PublishProvider>FileSystem</PublishProvider> |
|||
<PublishUrl>bin\Release\net7.0\publish\</PublishUrl> |
|||
<WebPublishMethod>FileSystem</WebPublishMethod> |
|||
<_TargetId>Folder</_TargetId> |
|||
<SiteUrlToLaunchAfterPublish /> |
|||
<TargetFramework>net7.0</TargetFramework> |
|||
<ProjectGuid>603fba8f-5c05-43f4-8b22-78b9e21cc5da</ProjectGuid> |
|||
<SelfContained>false</SelfContained> |
|||
</PropertyGroup> |
|||
</Project> |
|||
@ -0,0 +1,10 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<!-- |
|||
https://go.microsoft.com/fwlink/?LinkID=208121. |
|||
--> |
|||
<Project> |
|||
<PropertyGroup> |
|||
<History>False|2023-03-13T11:08:47.6004392Z;</History> |
|||
<LastFailureDetails /> |
|||
</PropertyGroup> |
|||
</Project> |
|||
Loading…
Reference in new issue