18 changed files with 161 additions and 75 deletions
@ -1,22 +1,15 @@ |
|||||
using Microsoft.Extensions.DependencyInjection; |
using LY.MicroService.BackendAdmin.DataSeeder; |
||||
using Microsoft.Extensions.Hosting; |
using Microsoft.Extensions.DependencyInjection; |
||||
using Volo.Abp; |
|
||||
using Volo.Abp.Data; |
|
||||
using Volo.Abp.Threading; |
|
||||
|
|
||||
namespace LY.MicroService.BackendAdmin; |
namespace LY.MicroService.BackendAdmin; |
||||
|
|
||||
public partial class BackendAdminHttpApiHostModule |
public partial class BackendAdminHttpApiHostModule |
||||
{ |
{ |
||||
private static void SeedData(ApplicationInitializationContext context) |
private static void ConfigureSeedWorker(IServiceCollection services, bool isDevelopment = false) |
||||
{ |
{ |
||||
if (context.GetEnvironment().IsDevelopment()) |
if (isDevelopment) |
||||
{ |
{ |
||||
AsyncHelper.RunSync(async () => |
services.AddHostedService<BackendAdminDataSeederWorker>(); |
||||
{ |
|
||||
using var scope = context.ServiceProvider.CreateScope(); |
|
||||
await scope.ServiceProvider.GetRequiredService<IDataSeeder>().SeedAsync(); |
|
||||
}); |
|
||||
} |
} |
||||
} |
} |
||||
} |
} |
||||
|
|||||
@ -0,0 +1,21 @@ |
|||||
|
using Microsoft.Extensions.Hosting; |
||||
|
using System.Threading; |
||||
|
using System.Threading.Tasks; |
||||
|
using Volo.Abp.Data; |
||||
|
|
||||
|
namespace LY.MicroService.BackendAdmin.DataSeeder; |
||||
|
|
||||
|
public class BackendAdminDataSeederWorker : BackgroundService |
||||
|
{ |
||||
|
protected IDataSeeder DataSeeder { get; } |
||||
|
|
||||
|
public BackendAdminDataSeederWorker(IDataSeeder dataSeeder) |
||||
|
{ |
||||
|
DataSeeder = dataSeeder; |
||||
|
} |
||||
|
|
||||
|
protected async override Task ExecuteAsync(CancellationToken stoppingToken) |
||||
|
{ |
||||
|
await DataSeeder.SeedAsync(); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,21 @@ |
|||||
|
using Microsoft.Extensions.Hosting; |
||||
|
using System.Threading; |
||||
|
using System.Threading.Tasks; |
||||
|
using Volo.Abp.Data; |
||||
|
|
||||
|
namespace LY.MicroService.LocalizationManagement.DataSeeder; |
||||
|
|
||||
|
public class LocalizationManagementDataSeederWorker : BackgroundService |
||||
|
{ |
||||
|
protected IDataSeeder DataSeeder { get; } |
||||
|
|
||||
|
public LocalizationManagementDataSeederWorker(IDataSeeder dataSeeder) |
||||
|
{ |
||||
|
DataSeeder = dataSeeder; |
||||
|
} |
||||
|
|
||||
|
protected async override Task ExecuteAsync(CancellationToken stoppingToken) |
||||
|
{ |
||||
|
await DataSeeder.SeedAsync(); |
||||
|
} |
||||
|
} |
||||
@ -1,20 +1,15 @@ |
|||||
using Microsoft.Extensions.DependencyInjection; |
using LY.MicroService.LocalizationManagement.DataSeeder; |
||||
using Microsoft.Extensions.Hosting; |
using Microsoft.Extensions.DependencyInjection; |
||||
using Volo.Abp; |
|
||||
using Volo.Abp.Data; |
|
||||
using Volo.Abp.Threading; |
|
||||
|
|
||||
namespace LY.MicroService.LocalizationManagement; |
namespace LY.MicroService.LocalizationManagement; |
||||
|
|
||||
public partial class LocalizationManagementHttpApiHostModule |
public partial class LocalizationManagementHttpApiHostModule |
||||
{ |
{ |
||||
private void SeedData(ApplicationInitializationContext context) |
private static void ConfigureSeedWorker(IServiceCollection services, bool isDevelopment = false) |
||||
{ |
{ |
||||
if (context.GetEnvironment().IsDevelopment()) |
if (isDevelopment) |
||||
{ |
{ |
||||
AsyncHelper.RunSync(async () => |
services.AddHostedService<LocalizationManagementDataSeederWorker>(); |
||||
await context.ServiceProvider.GetRequiredService<IDataSeeder>() |
|
||||
.SeedAsync()); |
|
||||
} |
} |
||||
} |
} |
||||
} |
} |
||||
|
|||||
@ -0,0 +1,21 @@ |
|||||
|
using Microsoft.Extensions.Hosting; |
||||
|
using System.Threading; |
||||
|
using System.Threading.Tasks; |
||||
|
using Volo.Abp.Data; |
||||
|
|
||||
|
namespace LY.MicroService.PlatformManagement.DataSeeder; |
||||
|
|
||||
|
public class PlatformManagementDataSeederWorker : BackgroundService |
||||
|
{ |
||||
|
protected IDataSeeder DataSeeder { get; } |
||||
|
|
||||
|
public PlatformManagementDataSeederWorker(IDataSeeder dataSeeder) |
||||
|
{ |
||||
|
DataSeeder = dataSeeder; |
||||
|
} |
||||
|
|
||||
|
protected async override Task ExecuteAsync(CancellationToken stoppingToken) |
||||
|
{ |
||||
|
await DataSeeder.SeedAsync(); |
||||
|
} |
||||
|
} |
||||
@ -1,20 +1,15 @@ |
|||||
using Microsoft.Extensions.DependencyInjection; |
using LY.MicroService.PlatformManagement.DataSeeder; |
||||
using Microsoft.Extensions.Hosting; |
using Microsoft.Extensions.DependencyInjection; |
||||
using Volo.Abp; |
|
||||
using Volo.Abp.Data; |
|
||||
using Volo.Abp.Threading; |
|
||||
|
|
||||
namespace LY.MicroService.PlatformManagement; |
namespace LY.MicroService.PlatformManagement; |
||||
|
|
||||
public partial class PlatformManagementHttpApiHostModule |
public partial class PlatformManagementHttpApiHostModule |
||||
{ |
{ |
||||
private void SeedData(ApplicationInitializationContext context) |
private static void ConfigureSeedWorker(IServiceCollection services, bool isDevelopment = false) |
||||
{ |
{ |
||||
if (context.GetEnvironment().IsDevelopment()) |
if (isDevelopment) |
||||
{ |
{ |
||||
AsyncHelper.RunSync(async () => |
services.AddHostedService<PlatformManagementDataSeederWorker>(); |
||||
await context.ServiceProvider.GetRequiredService<IDataSeeder>() |
|
||||
.SeedAsync()); |
|
||||
} |
} |
||||
} |
} |
||||
} |
} |
||||
|
|||||
@ -0,0 +1,21 @@ |
|||||
|
using Microsoft.Extensions.Hosting; |
||||
|
using System.Threading; |
||||
|
using System.Threading.Tasks; |
||||
|
using Volo.Abp.Data; |
||||
|
|
||||
|
namespace LY.MicroService.RealtimeMessage.DataSeeder; |
||||
|
|
||||
|
public class RealtimeMessageDataSeederWorker : BackgroundService |
||||
|
{ |
||||
|
protected IDataSeeder DataSeeder { get; } |
||||
|
|
||||
|
public RealtimeMessageDataSeederWorker(IDataSeeder dataSeeder) |
||||
|
{ |
||||
|
DataSeeder = dataSeeder; |
||||
|
} |
||||
|
|
||||
|
protected async override Task ExecuteAsync(CancellationToken stoppingToken) |
||||
|
{ |
||||
|
await DataSeeder.SeedAsync(); |
||||
|
} |
||||
|
} |
||||
@ -1,20 +1,15 @@ |
|||||
using LINGYUN.Abp.MessageService; |
using LY.MicroService.RealtimeMessage.DataSeeder; |
||||
using Microsoft.Extensions.DependencyInjection; |
using Microsoft.Extensions.DependencyInjection; |
||||
using Microsoft.Extensions.Hosting; |
|
||||
using Volo.Abp; |
|
||||
using Volo.Abp.Threading; |
|
||||
|
|
||||
namespace LY.MicroService.RealtimeMessage; |
namespace LY.MicroService.RealtimeMessage; |
||||
|
|
||||
public partial class RealtimeMessageHttpApiHostModule |
public partial class RealtimeMessageHttpApiHostModule |
||||
{ |
{ |
||||
private void SeedData(ApplicationInitializationContext context) |
private static void ConfigureSeedWorker(IServiceCollection services, bool isDevelopment = false) |
||||
{ |
{ |
||||
if (context.GetEnvironment().IsDevelopment()) |
if (isDevelopment) |
||||
{ |
{ |
||||
AsyncHelper.RunSync(async () => |
services.AddHostedService<RealtimeMessageDataSeederWorker>(); |
||||
await context.ServiceProvider.GetRequiredService<IMessageDataSeeder>() |
|
||||
.SeedAsync()); |
|
||||
} |
} |
||||
} |
} |
||||
} |
} |
||||
|
|||||
@ -0,0 +1,21 @@ |
|||||
|
using Microsoft.Extensions.Hosting; |
||||
|
using System.Threading; |
||||
|
using System.Threading.Tasks; |
||||
|
using Volo.Abp.Data; |
||||
|
|
||||
|
namespace LY.MicroService.WorkflowManagement.DataSeeder; |
||||
|
|
||||
|
public class WorkflowManagementDataSeederWorker : BackgroundService |
||||
|
{ |
||||
|
protected IDataSeeder DataSeeder { get; } |
||||
|
|
||||
|
public WorkflowManagementDataSeederWorker(IDataSeeder dataSeeder) |
||||
|
{ |
||||
|
DataSeeder = dataSeeder; |
||||
|
} |
||||
|
|
||||
|
protected async override Task ExecuteAsync(CancellationToken stoppingToken) |
||||
|
{ |
||||
|
await DataSeeder.SeedAsync(); |
||||
|
} |
||||
|
} |
||||
@ -1,20 +1,15 @@ |
|||||
using Microsoft.Extensions.DependencyInjection; |
using LY.MicroService.WorkflowManagement.DataSeeder; |
||||
using Microsoft.Extensions.Hosting; |
using Microsoft.Extensions.DependencyInjection; |
||||
using Volo.Abp; |
|
||||
using Volo.Abp.Data; |
|
||||
using Volo.Abp.Threading; |
|
||||
|
|
||||
namespace LY.MicroService.WorkflowManagement; |
namespace LY.MicroService.WorkflowManagement; |
||||
|
|
||||
public partial class WorkflowManagementHttpApiHostModule |
public partial class WorkflowManagementHttpApiHostModule |
||||
{ |
{ |
||||
private void SeedData(ApplicationInitializationContext context) |
private static void ConfigureSeedWorker(IServiceCollection services, bool isDevelopment = false) |
||||
{ |
{ |
||||
if (context.GetEnvironment().IsDevelopment()) |
if (isDevelopment) |
||||
{ |
{ |
||||
AsyncHelper.RunSync(async () => |
services.AddHostedService<WorkflowManagementDataSeederWorker>(); |
||||
await context.ServiceProvider.GetRequiredService<IDataSeeder>() |
|
||||
.SeedAsync()); |
|
||||
} |
} |
||||
} |
} |
||||
} |
} |
||||
|
|||||
@ -0,0 +1,21 @@ |
|||||
|
using Microsoft.Extensions.Hosting; |
||||
|
using System.Threading; |
||||
|
using System.Threading.Tasks; |
||||
|
using Volo.Abp.Data; |
||||
|
|
||||
|
namespace LY.MicroService.IdentityServer.DataSeeder; |
||||
|
|
||||
|
public class IdentityServerDataSeederWorker : BackgroundService |
||||
|
{ |
||||
|
protected IDataSeeder DataSeeder { get; } |
||||
|
|
||||
|
public IdentityServerDataSeederWorker(IDataSeeder dataSeeder) |
||||
|
{ |
||||
|
DataSeeder = dataSeeder; |
||||
|
} |
||||
|
|
||||
|
protected async override Task ExecuteAsync(CancellationToken stoppingToken) |
||||
|
{ |
||||
|
await DataSeeder.SeedAsync(); |
||||
|
} |
||||
|
} |
||||
@ -1,22 +1,15 @@ |
|||||
using Microsoft.Extensions.DependencyInjection; |
using LY.MicroService.IdentityServer.DataSeeder; |
||||
using Microsoft.Extensions.Hosting; |
using Microsoft.Extensions.DependencyInjection; |
||||
using Volo.Abp; |
|
||||
using Volo.Abp.Data; |
|
||||
using Volo.Abp.Threading; |
|
||||
|
|
||||
namespace LY.MicroService.IdentityServer; |
namespace LY.MicroService.IdentityServer; |
||||
|
|
||||
public partial class IdentityServerModule |
public partial class IdentityServerModule |
||||
{ |
{ |
||||
private void SeedData(ApplicationInitializationContext context) |
private static void ConfigureSeedWorker(IServiceCollection services, bool isDevelopment = false) |
||||
{ |
{ |
||||
if (context.GetEnvironment().IsDevelopment()) |
if (isDevelopment) |
||||
{ |
{ |
||||
AsyncHelper.RunSync(async () => |
services.AddHostedService<IdentityServerDataSeederWorker>(); |
||||
{ |
|
||||
using var scope = context.ServiceProvider.CreateScope(); |
|
||||
await scope.ServiceProvider.GetRequiredService<IDataSeeder>().SeedAsync(); |
|
||||
}); |
|
||||
} |
} |
||||
} |
} |
||||
} |
} |
||||
|
|||||
Loading…
Reference in new issue