64 changed files with 969 additions and 600 deletions
@ -0,0 +1,119 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Reflection; |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp.BackgroundWorkers; |
|||
using Volo.Abp.DynamicProxy; |
|||
using Volo.Abp.MultiTenancy; |
|||
using Volo.Abp.Threading; |
|||
using Volo.Abp.Timing; |
|||
|
|||
namespace LINGYUN.Abp.BackgroundTasks; |
|||
|
|||
public class BackgroundWorkerAdapter<TWorker> : BackgroundWorkerBase, IBackgroundWorkerRunnable |
|||
where TWorker : IBackgroundWorker |
|||
{ |
|||
protected IClock Clock => LazyServiceProvider.LazyGetRequiredService<IClock>(); |
|||
protected IJobStore JobStore => LazyServiceProvider.LazyGetRequiredService<IJobStore>(); |
|||
protected IJobScheduler JobScheduler => LazyServiceProvider.LazyGetRequiredService<IJobScheduler>(); |
|||
protected ICurrentTenant CurrentTenant => LazyServiceProvider.LazyGetRequiredService<ICurrentTenant>(); |
|||
|
|||
private readonly MethodInfo _doWorkAsyncMethod; |
|||
private readonly MethodInfo _doWorkMethod; |
|||
|
|||
public BackgroundWorkerAdapter() |
|||
{ |
|||
_doWorkAsyncMethod = typeof(TWorker).GetMethod("DoWorkAsync", BindingFlags.Instance | BindingFlags.NonPublic); |
|||
_doWorkMethod = typeof(TWorker).GetMethod("DoWork", BindingFlags.Instance | BindingFlags.NonPublic); |
|||
} |
|||
|
|||
#nullable enable |
|||
public JobInfo? BuildWorker(IBackgroundWorker worker) |
|||
{ |
|||
int? period; |
|||
var workerType = ProxyHelper.GetUnProxiedType(worker); |
|||
|
|||
if (worker is AsyncPeriodicBackgroundWorkerBase or PeriodicBackgroundWorkerBase) |
|||
{ |
|||
if (typeof(TWorker) != workerType) |
|||
{ |
|||
throw new ArgumentException($"{nameof(worker)} type is different from the generic type"); |
|||
} |
|||
|
|||
var timer = workerType.GetProperty("Timer", BindingFlags.Instance | BindingFlags.NonPublic)?.GetValue(worker); |
|||
if (timer == null) |
|||
{ |
|||
return null; |
|||
} |
|||
|
|||
if (worker is AsyncPeriodicBackgroundWorkerBase) |
|||
{ |
|||
period = ((AbpAsyncTimer)timer)?.Period; |
|||
} |
|||
else |
|||
{ |
|||
period = ((AbpTimer)timer)?.Period; |
|||
} |
|||
} |
|||
else |
|||
{ |
|||
return null; |
|||
} |
|||
|
|||
if (period == null) |
|||
{ |
|||
return null; |
|||
} |
|||
|
|||
var jobArgs = new Dictionary<string, object> |
|||
{ |
|||
{ "JobType", workerType.AssemblyQualifiedName }, |
|||
}; |
|||
return new JobInfo |
|||
{ |
|||
Id = workerType.FullName, |
|||
TenantId = CurrentTenant.Id, |
|||
Name = workerType.FullName, |
|||
Group = "BackgroundWorkers", |
|||
Priority = JobPriority.Normal, |
|||
BeginTime = Clock.Now, |
|||
Args = jobArgs, |
|||
Description = "From the framework background workers", |
|||
JobType = JobType.Persistent, |
|||
Interval = period.Value / 1000, |
|||
MaxCount = 0, |
|||
// TODO: 可配置
|
|||
MaxTryCount = 10, |
|||
CreationTime = Clock.Now, |
|||
// 确保不会被轮询入队
|
|||
Status = JobStatus.None, |
|||
Type = typeof(BackgroundWorkerAdapter<TWorker>).AssemblyQualifiedName, |
|||
}; |
|||
} |
|||
#nullable disable |
|||
|
|||
public async Task ExecuteAsync(JobRunnableContext context) |
|||
{ |
|||
var worker = (IBackgroundWorker)ServiceProvider.GetService(typeof(TWorker)); |
|||
var workerContext = new PeriodicBackgroundWorkerContext(ServiceProvider); |
|||
|
|||
switch (worker) |
|||
{ |
|||
case AsyncPeriodicBackgroundWorkerBase asyncWorker: |
|||
{ |
|||
if (_doWorkAsyncMethod != null) |
|||
{ |
|||
await(Task) _doWorkAsyncMethod.Invoke(asyncWorker, new object[] { workerContext }); |
|||
} |
|||
|
|||
break; |
|||
} |
|||
case PeriodicBackgroundWorkerBase syncWorker: |
|||
{ |
|||
_doWorkMethod?.Invoke(syncWorker, new object[] { workerContext }); |
|||
|
|||
break; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,55 @@ |
|||
using System; |
|||
using System.Threading; |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp.BackgroundWorkers; |
|||
using Volo.Abp.DependencyInjection; |
|||
using Volo.Abp.DynamicProxy; |
|||
|
|||
namespace LINGYUN.Abp.BackgroundTasks; |
|||
|
|||
[Dependency(ReplaceServices = true)] |
|||
public class BackgroundWorkerManager : IBackgroundWorkerManager, ISingletonDependency |
|||
{ |
|||
protected IJobStore JobStore { get; } |
|||
protected IJobScheduler JobScheduler { get; } |
|||
protected IServiceProvider ServiceProvider { get; } |
|||
|
|||
public BackgroundWorkerManager( |
|||
IJobStore jobStore, |
|||
IJobScheduler jobScheduler, |
|||
IServiceProvider serviceProvider) |
|||
{ |
|||
JobStore = jobStore; |
|||
JobScheduler = jobScheduler; |
|||
ServiceProvider = serviceProvider; |
|||
} |
|||
|
|||
public async Task AddAsync(IBackgroundWorker worker) |
|||
{ |
|||
var adapterType = typeof(BackgroundWorkerAdapter<>).MakeGenericType(ProxyHelper.GetUnProxiedType(worker)); |
|||
|
|||
var workerAdapter = ServiceProvider.GetService(adapterType) as IBackgroundWorkerRunnable; |
|||
|
|||
var jobInfo = workerAdapter?.BuildWorker(worker); |
|||
if (jobInfo == null) |
|||
{ |
|||
return; |
|||
} |
|||
|
|||
// 存储状态
|
|||
await JobStore.StoreAsync(jobInfo); |
|||
|
|||
// 手动入队
|
|||
await JobScheduler.QueueAsync(jobInfo); |
|||
} |
|||
|
|||
public Task StartAsync(CancellationToken cancellationToken = default) |
|||
{ |
|||
return Task.CompletedTask; |
|||
} |
|||
|
|||
public Task StopAsync(CancellationToken cancellationToken = default) |
|||
{ |
|||
return Task.CompletedTask; |
|||
} |
|||
} |
|||
@ -0,0 +1,10 @@ |
|||
using Volo.Abp.BackgroundWorkers; |
|||
|
|||
namespace LINGYUN.Abp.BackgroundTasks; |
|||
|
|||
public interface IBackgroundWorkerRunnable : IJobRunnable |
|||
{ |
|||
#nullable enable |
|||
JobInfo? BuildWorker(IBackgroundWorker worker); |
|||
#nullable disable |
|||
} |
|||
@ -1,30 +0,0 @@ |
|||
using Microsoft.AspNetCore.Builder; |
|||
using Microsoft.Extensions.DependencyInjection; |
|||
using System.IO; |
|||
using Volo.Abp.IO; |
|||
using Volo.Abp.Modularity.PlugIns; |
|||
|
|||
namespace LY.MicroService.BackendAdmin; |
|||
|
|||
public class Startup |
|||
{ |
|||
public void ConfigureServices(IServiceCollection services) |
|||
{ |
|||
services.AddApplication<BackendAdminHttpApiHostModule>(options => |
|||
{ |
|||
// 搜索 Modules 目录下所有文件作为插件
|
|||
// 取消显示引用所有其他项目的模块,改为通过插件的形式引用
|
|||
var pluginFolder = Path.Combine( |
|||
Directory.GetCurrentDirectory(), "Modules"); |
|||
DirectoryHelper.CreateIfNotExists(pluginFolder); |
|||
options.PlugInSources.AddFolder( |
|||
pluginFolder, |
|||
SearchOption.AllDirectories); |
|||
}); |
|||
} |
|||
|
|||
public void Configure(IApplicationBuilder app) |
|||
{ |
|||
app.InitializeApplication(); |
|||
} |
|||
} |
|||
@ -1,30 +0,0 @@ |
|||
using Microsoft.AspNetCore.Builder; |
|||
using Microsoft.Extensions.DependencyInjection; |
|||
using System.IO; |
|||
using Volo.Abp.IO; |
|||
using Volo.Abp.Modularity.PlugIns; |
|||
|
|||
namespace LY.MicroService.LocalizationManagement; |
|||
|
|||
public class Startup |
|||
{ |
|||
public void ConfigureServices(IServiceCollection services) |
|||
{ |
|||
services.AddApplication<LocalizationManagementHttpApiHostModule>(options => |
|||
{ |
|||
// 搜索 Modules 目录下所有文件作为插件
|
|||
// 取消显示引用所有其他项目的模块,改为通过插件的形式引用
|
|||
var pluginFolder = Path.Combine( |
|||
Directory.GetCurrentDirectory(), "Modules"); |
|||
DirectoryHelper.CreateIfNotExists(pluginFolder); |
|||
options.PlugInSources.AddFolder( |
|||
pluginFolder, |
|||
SearchOption.AllDirectories); |
|||
}); |
|||
} |
|||
|
|||
public void Configure(IApplicationBuilder app) |
|||
{ |
|||
app.InitializeApplication(); |
|||
} |
|||
} |
|||
@ -1,30 +0,0 @@ |
|||
using Microsoft.AspNetCore.Builder; |
|||
using Microsoft.Extensions.DependencyInjection; |
|||
using System.IO; |
|||
using Volo.Abp.IO; |
|||
using Volo.Abp.Modularity.PlugIns; |
|||
|
|||
namespace LY.MicroService.PlatformManagement; |
|||
|
|||
public class Startup |
|||
{ |
|||
public void ConfigureServices(IServiceCollection services) |
|||
{ |
|||
services.AddApplication<PlatformManagementHttpApiHostModule>(options => |
|||
{ |
|||
// 搜索 Modules 目录下所有文件作为插件
|
|||
// 取消显示引用所有其他项目的模块,改为通过插件的形式引用
|
|||
var pluginFolder = Path.Combine( |
|||
Directory.GetCurrentDirectory(), "Modules"); |
|||
DirectoryHelper.CreateIfNotExists(pluginFolder); |
|||
options.PlugInSources.AddFolder( |
|||
pluginFolder, |
|||
SearchOption.AllDirectories); |
|||
}); |
|||
} |
|||
|
|||
public void Configure(IApplicationBuilder app) |
|||
{ |
|||
app.InitializeApplication(); |
|||
} |
|||
} |
|||
@ -1,30 +0,0 @@ |
|||
using Microsoft.AspNetCore.Builder; |
|||
using Microsoft.Extensions.DependencyInjection; |
|||
using System.IO; |
|||
using Volo.Abp.IO; |
|||
using Volo.Abp.Modularity.PlugIns; |
|||
|
|||
namespace LY.MicroService.RealtimeMessage; |
|||
|
|||
public class Startup |
|||
{ |
|||
public void ConfigureServices(IServiceCollection services) |
|||
{ |
|||
services.AddApplication<RealtimeMessageHttpApiHostModule>(options => |
|||
{ |
|||
// 搜索 Modules 目录下所有文件作为插件
|
|||
// 取消显示引用所有其他项目的模块,改为通过插件的形式引用
|
|||
var pluginFolder = Path.Combine( |
|||
Directory.GetCurrentDirectory(), "Modules"); |
|||
DirectoryHelper.CreateIfNotExists(pluginFolder); |
|||
options.PlugInSources.AddFolder( |
|||
pluginFolder, |
|||
SearchOption.AllDirectories); |
|||
}); |
|||
} |
|||
|
|||
public void Configure(IApplicationBuilder app) |
|||
{ |
|||
app.InitializeApplication(); |
|||
} |
|||
} |
|||
@ -0,0 +1,202 @@ |
|||
// <auto-generated />
|
|||
using System; |
|||
using LY.MicroService.TaskManagement.EntityFrameworkCore; |
|||
using Microsoft.EntityFrameworkCore; |
|||
using Microsoft.EntityFrameworkCore.Infrastructure; |
|||
using Microsoft.EntityFrameworkCore.Migrations; |
|||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion; |
|||
using Volo.Abp.EntityFrameworkCore; |
|||
|
|||
#nullable disable |
|||
|
|||
namespace LY.MicroService.TaskManagement.Migrations |
|||
{ |
|||
[DbContext(typeof(TaskManagementMigrationsDbContext))] |
|||
[Migration("20220113113020_Change-Background-Job-Info-Key-To-String")] |
|||
partial class ChangeBackgroundJobInfoKeyToString |
|||
{ |
|||
protected override void BuildTargetModel(ModelBuilder modelBuilder) |
|||
{ |
|||
#pragma warning disable 612, 618
|
|||
modelBuilder |
|||
.HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.MySql) |
|||
.HasAnnotation("ProductVersion", "6.0.1") |
|||
.HasAnnotation("Relational:MaxIdentifierLength", 64); |
|||
|
|||
modelBuilder.Entity("LINGYUN.Abp.TaskManagement.BackgroundJobInfo", b => |
|||
{ |
|||
b.Property<string>("Id") |
|||
.HasColumnType("varchar(255)"); |
|||
|
|||
b.Property<string>("Args") |
|||
.HasColumnType("longtext") |
|||
.HasColumnName("Args"); |
|||
|
|||
b.Property<DateTime>("BeginTime") |
|||
.HasColumnType("datetime(6)"); |
|||
|
|||
b.Property<string>("ConcurrencyStamp") |
|||
.IsConcurrencyToken() |
|||
.HasMaxLength(40) |
|||
.HasColumnType("varchar(40)") |
|||
.HasColumnName("ConcurrencyStamp"); |
|||
|
|||
b.Property<DateTime>("CreationTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("CreationTime"); |
|||
|
|||
b.Property<Guid?>("CreatorId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("CreatorId"); |
|||
|
|||
b.Property<string>("Cron") |
|||
.HasMaxLength(50) |
|||
.HasColumnType("varchar(50)") |
|||
.HasColumnName("Cron"); |
|||
|
|||
b.Property<string>("Description") |
|||
.HasMaxLength(255) |
|||
.HasColumnType("varchar(255)") |
|||
.HasColumnName("Description"); |
|||
|
|||
b.Property<DateTime?>("EndTime") |
|||
.HasColumnType("datetime(6)"); |
|||
|
|||
b.Property<string>("ExtraProperties") |
|||
.HasColumnType("longtext") |
|||
.HasColumnName("ExtraProperties"); |
|||
|
|||
b.Property<string>("Group") |
|||
.IsRequired() |
|||
.HasMaxLength(50) |
|||
.HasColumnType("varchar(50)") |
|||
.HasColumnName("Group"); |
|||
|
|||
b.Property<int>("Interval") |
|||
.HasColumnType("int"); |
|||
|
|||
b.Property<bool>("IsAbandoned") |
|||
.HasColumnType("tinyint(1)"); |
|||
|
|||
b.Property<bool>("IsEnabled") |
|||
.HasColumnType("tinyint(1)"); |
|||
|
|||
b.Property<int>("JobType") |
|||
.HasColumnType("int"); |
|||
|
|||
b.Property<DateTime?>("LastModificationTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("LastModificationTime"); |
|||
|
|||
b.Property<Guid?>("LastModifierId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("LastModifierId"); |
|||
|
|||
b.Property<DateTime?>("LastRunTime") |
|||
.HasColumnType("datetime(6)"); |
|||
|
|||
b.Property<int>("LockTimeOut") |
|||
.HasColumnType("int"); |
|||
|
|||
b.Property<int>("MaxCount") |
|||
.HasColumnType("int"); |
|||
|
|||
b.Property<int>("MaxTryCount") |
|||
.HasColumnType("int"); |
|||
|
|||
b.Property<string>("Name") |
|||
.IsRequired() |
|||
.HasMaxLength(100) |
|||
.HasColumnType("varchar(100)") |
|||
.HasColumnName("Name"); |
|||
|
|||
b.Property<DateTime?>("NextRunTime") |
|||
.HasColumnType("datetime(6)"); |
|||
|
|||
b.Property<int>("Priority") |
|||
.HasColumnType("int"); |
|||
|
|||
b.Property<string>("Result") |
|||
.HasMaxLength(1000) |
|||
.HasColumnType("varchar(1000)") |
|||
.HasColumnName("Result"); |
|||
|
|||
b.Property<int>("Status") |
|||
.HasColumnType("int"); |
|||
|
|||
b.Property<Guid?>("TenantId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("TenantId"); |
|||
|
|||
b.Property<int>("TriggerCount") |
|||
.HasColumnType("int"); |
|||
|
|||
b.Property<int>("TryCount") |
|||
.HasColumnType("int"); |
|||
|
|||
b.Property<string>("Type") |
|||
.IsRequired() |
|||
.HasMaxLength(1000) |
|||
.HasColumnType("varchar(1000)") |
|||
.HasColumnName("Type"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("Name", "Group"); |
|||
|
|||
b.ToTable("TK_BackgroundJobs", (string)null); |
|||
}); |
|||
|
|||
modelBuilder.Entity("LINGYUN.Abp.TaskManagement.BackgroundJobLog", b => |
|||
{ |
|||
b.Property<long>("Id") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnType("bigint"); |
|||
|
|||
b.Property<string>("Exception") |
|||
.HasMaxLength(2000) |
|||
.HasColumnType("varchar(2000)") |
|||
.HasColumnName("Exception"); |
|||
|
|||
b.Property<string>("JobGroup") |
|||
.HasMaxLength(50) |
|||
.HasColumnType("varchar(50)") |
|||
.HasColumnName("JobGroup"); |
|||
|
|||
b.Property<string>("JobId") |
|||
.HasMaxLength(255) |
|||
.HasColumnType("varchar(255)") |
|||
.HasColumnName("JobId"); |
|||
|
|||
b.Property<string>("JobName") |
|||
.HasMaxLength(100) |
|||
.HasColumnType("varchar(100)") |
|||
.HasColumnName("JobName"); |
|||
|
|||
b.Property<string>("JobType") |
|||
.HasMaxLength(1000) |
|||
.HasColumnType("varchar(1000)") |
|||
.HasColumnName("JobType"); |
|||
|
|||
b.Property<string>("Message") |
|||
.HasMaxLength(1000) |
|||
.HasColumnType("varchar(1000)") |
|||
.HasColumnName("Message"); |
|||
|
|||
b.Property<DateTime>("RunTime") |
|||
.HasColumnType("datetime(6)"); |
|||
|
|||
b.Property<Guid?>("TenantId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("TenantId"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("JobGroup", "JobName"); |
|||
|
|||
b.ToTable("TK_BackgroundJobLogs", (string)null); |
|||
}); |
|||
#pragma warning restore 612, 618
|
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,60 @@ |
|||
using System; |
|||
using Microsoft.EntityFrameworkCore.Migrations; |
|||
|
|||
#nullable disable |
|||
|
|||
namespace LY.MicroService.TaskManagement.Migrations |
|||
{ |
|||
public partial class ChangeBackgroundJobInfoKeyToString : Migration |
|||
{ |
|||
protected override void Up(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.AlterColumn<string>( |
|||
name: "Id", |
|||
table: "TK_BackgroundJobs", |
|||
type: "varchar(255)", |
|||
nullable: false, |
|||
oldClrType: typeof(Guid), |
|||
oldType: "char(36)") |
|||
.Annotation("MySql:CharSet", "utf8mb4") |
|||
.OldAnnotation("Relational:Collation", "ascii_general_ci"); |
|||
|
|||
migrationBuilder.AlterColumn<string>( |
|||
name: "JobId", |
|||
table: "TK_BackgroundJobLogs", |
|||
type: "varchar(255)", |
|||
maxLength: 255, |
|||
nullable: true, |
|||
oldClrType: typeof(Guid), |
|||
oldType: "char(36)", |
|||
oldNullable: true) |
|||
.Annotation("MySql:CharSet", "utf8mb4") |
|||
.OldAnnotation("Relational:Collation", "ascii_general_ci"); |
|||
} |
|||
|
|||
protected override void Down(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.AlterColumn<Guid>( |
|||
name: "Id", |
|||
table: "TK_BackgroundJobs", |
|||
type: "char(36)", |
|||
nullable: false, |
|||
collation: "ascii_general_ci", |
|||
oldClrType: typeof(string), |
|||
oldType: "varchar(255)") |
|||
.OldAnnotation("MySql:CharSet", "utf8mb4"); |
|||
|
|||
migrationBuilder.AlterColumn<Guid>( |
|||
name: "JobId", |
|||
table: "TK_BackgroundJobLogs", |
|||
type: "char(36)", |
|||
nullable: true, |
|||
collation: "ascii_general_ci", |
|||
oldClrType: typeof(string), |
|||
oldType: "varchar(255)", |
|||
oldMaxLength: 255, |
|||
oldNullable: true) |
|||
.OldAnnotation("MySql:CharSet", "utf8mb4"); |
|||
} |
|||
} |
|||
} |
|||
@ -1,30 +0,0 @@ |
|||
using Microsoft.AspNetCore.Builder; |
|||
using Microsoft.Extensions.DependencyInjection; |
|||
using System.IO; |
|||
using Volo.Abp.IO; |
|||
using Volo.Abp.Modularity.PlugIns; |
|||
|
|||
namespace LY.MicroService.TaskManagement; |
|||
|
|||
public class Startup |
|||
{ |
|||
public void ConfigureServices(IServiceCollection services) |
|||
{ |
|||
services.AddApplication<TaskManagementHttpApiHostModule>(options => |
|||
{ |
|||
// 搜索 Modules 目录下所有文件作为插件
|
|||
// 取消显示引用所有其他项目的模块,改为通过插件的形式引用
|
|||
var pluginFolder = Path.Combine( |
|||
Directory.GetCurrentDirectory(), "Modules"); |
|||
DirectoryHelper.CreateIfNotExists(pluginFolder); |
|||
options.PlugInSources.AddFolder( |
|||
pluginFolder, |
|||
SearchOption.AllDirectories); |
|||
}); |
|||
} |
|||
|
|||
public void Configure(IApplicationBuilder app) |
|||
{ |
|||
app.InitializeApplication(); |
|||
} |
|||
} |
|||
@ -1,30 +0,0 @@ |
|||
using Microsoft.AspNetCore.Builder; |
|||
using Microsoft.Extensions.DependencyInjection; |
|||
using System.IO; |
|||
using Volo.Abp.IO; |
|||
using Volo.Abp.Modularity.PlugIns; |
|||
|
|||
namespace LY.MicroService.WorkflowManagement; |
|||
|
|||
public class Startup |
|||
{ |
|||
public void ConfigureServices(IServiceCollection services) |
|||
{ |
|||
services.AddApplication<WorkflowManagementHttpApiHostModule>(options => |
|||
{ |
|||
// 搜索 Modules 目录下所有文件作为插件
|
|||
// 取消显示引用所有其他项目的模块,改为通过插件的形式引用
|
|||
var pluginFolder = Path.Combine( |
|||
Directory.GetCurrentDirectory(), "Modules"); |
|||
DirectoryHelper.CreateIfNotExists(pluginFolder); |
|||
options.PlugInSources.AddFolder( |
|||
pluginFolder, |
|||
SearchOption.AllDirectories); |
|||
}); |
|||
} |
|||
|
|||
public void Configure(IApplicationBuilder app) |
|||
{ |
|||
app.InitializeApplication(); |
|||
} |
|||
} |
|||
@ -1,30 +0,0 @@ |
|||
using Microsoft.AspNetCore.Builder; |
|||
using Microsoft.Extensions.DependencyInjection; |
|||
using System.IO; |
|||
using Volo.Abp.IO; |
|||
using Volo.Abp.Modularity.PlugIns; |
|||
|
|||
namespace LY.MicroService.IdentityServer; |
|||
|
|||
public class Startup |
|||
{ |
|||
public void ConfigureServices(IServiceCollection services) |
|||
{ |
|||
services.AddApplication<IdentityServerHttpApiHostModule>(options => |
|||
{ |
|||
// 搜索 Modules 目录下所有文件作为插件
|
|||
// 取消显示引用所有其他项目的模块,改为通过插件的形式引用
|
|||
var pluginFolder = Path.Combine( |
|||
Directory.GetCurrentDirectory(), "Modules"); |
|||
DirectoryHelper.CreateIfNotExists(pluginFolder); |
|||
options.PlugInSources.AddFolder( |
|||
pluginFolder, |
|||
SearchOption.AllDirectories); |
|||
}); |
|||
} |
|||
|
|||
public void Configure(IApplicationBuilder app) |
|||
{ |
|||
app.InitializeApplication(); |
|||
} |
|||
} |
|||
@ -1,32 +0,0 @@ |
|||
using Microsoft.AspNetCore.Builder; |
|||
using Microsoft.AspNetCore.Hosting; |
|||
using Microsoft.Extensions.DependencyInjection; |
|||
using Microsoft.Extensions.Logging; |
|||
using System.IO; |
|||
using Volo.Abp.IO; |
|||
using Volo.Abp.Modularity.PlugIns; |
|||
|
|||
namespace LY.MicroService.IdentityServer; |
|||
|
|||
public class Startup |
|||
{ |
|||
public void ConfigureServices(IServiceCollection services) |
|||
{ |
|||
services.AddApplication<IdentityServerModule>(options => |
|||
{ |
|||
// 搜索 Modules 目录下所有文件作为插件
|
|||
// 取消显示引用所有其他项目的模块,改为通过插件的形式引用
|
|||
var pluginFolder = Path.Combine( |
|||
Directory.GetCurrentDirectory(), "Modules"); |
|||
DirectoryHelper.CreateIfNotExists(pluginFolder); |
|||
options.PlugInSources.AddFolder( |
|||
pluginFolder, |
|||
SearchOption.AllDirectories); |
|||
}); |
|||
} |
|||
|
|||
public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerFactory loggerFactory) |
|||
{ |
|||
app.InitializeApplication(); |
|||
} |
|||
} |
|||
@ -1,7 +1,7 @@ |
|||
<Project> |
|||
<PropertyGroup> |
|||
<LangVersion>latest</LangVersion> |
|||
<Version>5.0.0</Version> |
|||
<Version>5.1.1</Version> |
|||
<NoWarn>$(NoWarn);CS1591;CS0436</NoWarn> |
|||
</PropertyGroup> |
|||
</Project> |
|||
Loading…
Reference in new issue