committed by
GitHub
2 changed files with 75 additions and 70 deletions
@ -1,10 +1,13 @@ |
|||||
using Volo.Abp.EventBus; |
using LINGYUN.Abp.RealTime; |
||||
using Volo.Abp.Modularity; |
using Volo.Abp.EventBus; |
||||
|
using Volo.Abp.Modularity; |
||||
namespace LINGYUN.Abp.IM |
|
||||
{ |
namespace LINGYUN.Abp.IM |
||||
[DependsOn(typeof(AbpEventBusModule))] |
{ |
||||
public class AbpIMModule : AbpModule |
[DependsOn( |
||||
{ |
typeof(AbpEventBusModule), |
||||
} |
typeof(AbpRealTimeModule))] |
||||
} |
public class AbpIMModule : AbpModule |
||||
|
{ |
||||
|
} |
||||
|
} |
||||
|
|||||
@ -1,60 +1,62 @@ |
|||||
using LINGYUN.Abp.Notifications.Internal; |
using LINGYUN.Abp.Notifications.Internal; |
||||
using Microsoft.Extensions.DependencyInjection; |
using LINGYUN.Abp.RealTime; |
||||
using Microsoft.Extensions.Options; |
using Microsoft.Extensions.DependencyInjection; |
||||
using System; |
using Microsoft.Extensions.Options; |
||||
using System.Collections.Generic; |
using System; |
||||
using Volo.Abp; |
using System.Collections.Generic; |
||||
using Volo.Abp.BackgroundJobs; |
using Volo.Abp; |
||||
using Volo.Abp.BackgroundWorkers; |
using Volo.Abp.BackgroundJobs; |
||||
using Volo.Abp.Json; |
using Volo.Abp.BackgroundWorkers; |
||||
using Volo.Abp.Modularity; |
using Volo.Abp.Json; |
||||
|
using Volo.Abp.Modularity; |
||||
namespace LINGYUN.Abp.Notifications |
|
||||
{ |
namespace LINGYUN.Abp.Notifications |
||||
// TODO: 需要重命名 AbpNotificationsModule
|
{ |
||||
[DependsOn( |
// TODO: 需要重命名 AbpNotificationsModule
|
||||
typeof(AbpBackgroundWorkersModule), |
[DependsOn( |
||||
typeof(AbpBackgroundJobsAbstractionsModule), |
typeof(AbpBackgroundWorkersModule), |
||||
typeof(AbpJsonModule))] |
typeof(AbpBackgroundJobsAbstractionsModule), |
||||
public class AbpNotificationModule : AbpModule |
typeof(AbpJsonModule), |
||||
{ |
typeof(AbpRealTimeModule))] |
||||
|
public class AbpNotificationModule : AbpModule |
||||
public override void PreConfigureServices(ServiceConfigurationContext context) |
{ |
||||
{ |
|
||||
AutoAddDefinitionProviders(context.Services); |
public override void PreConfigureServices(ServiceConfigurationContext context) |
||||
} |
{ |
||||
|
AutoAddDefinitionProviders(context.Services); |
||||
public override void OnPostApplicationInitialization(ApplicationInitializationContext context) |
} |
||||
{ |
|
||||
var options = context.ServiceProvider.GetRequiredService<IOptions<AbpNotificationCleanupOptions>>().Value; |
public override void OnPostApplicationInitialization(ApplicationInitializationContext context) |
||||
if (options.IsEnabled) |
{ |
||||
{ |
var options = context.ServiceProvider.GetRequiredService<IOptions<AbpNotificationCleanupOptions>>().Value; |
||||
context.ServiceProvider |
if (options.IsEnabled) |
||||
.GetRequiredService<IBackgroundWorkerManager>() |
{ |
||||
.Add( |
context.ServiceProvider |
||||
context.ServiceProvider |
.GetRequiredService<IBackgroundWorkerManager>() |
||||
.GetRequiredService<NotificationCleanupBackgroundWorker>() |
.Add( |
||||
); |
context.ServiceProvider |
||||
} |
.GetRequiredService<NotificationCleanupBackgroundWorker>() |
||||
} |
); |
||||
|
} |
||||
private static void AutoAddDefinitionProviders(IServiceCollection services) |
} |
||||
{ |
|
||||
var definitionProviders = new List<Type>(); |
private static void AutoAddDefinitionProviders(IServiceCollection services) |
||||
|
{ |
||||
services.OnRegistred(context => |
var definitionProviders = new List<Type>(); |
||||
{ |
|
||||
if (typeof(INotificationDefinitionProvider).IsAssignableFrom(context.ImplementationType)) |
services.OnRegistred(context => |
||||
{ |
{ |
||||
definitionProviders.Add(context.ImplementationType); |
if (typeof(INotificationDefinitionProvider).IsAssignableFrom(context.ImplementationType)) |
||||
} |
{ |
||||
}); |
definitionProviders.Add(context.ImplementationType); |
||||
|
} |
||||
services.Configure<AbpNotificationOptions>(options => |
}); |
||||
{ |
|
||||
services.ExecutePreConfiguredActions(options); |
services.Configure<AbpNotificationOptions>(options => |
||||
options.DefinitionProviders.AddIfNotContains(definitionProviders); |
{ |
||||
}); |
services.ExecutePreConfiguredActions(options); |
||||
} |
options.DefinitionProviders.AddIfNotContains(definitionProviders); |
||||
} |
}); |
||||
} |
} |
||||
|
} |
||||
|
} |
||||
|
|||||
Loading…
Reference in new issue