using Microsoft.Extensions.DependencyInjection; using Sanhe.Abp.IdGenerator; using Sanhe.Abp.RealTime; using System; using System.Collections.Generic; using Volo.Abp.BackgroundJobs; using Volo.Abp.BackgroundWorkers; using Volo.Abp.Json; using Volo.Abp.Modularity; namespace Sanhe.Abp.Notifications; // TODO: 需要重命名 AbpNotificationsModule [DependsOn( typeof(AbpBackgroundWorkersModule), typeof(AbpBackgroundJobsAbstractionsModule), typeof(AbpIdGeneratorModule), typeof(AbpJsonModule), typeof(AbpRealTimeModule))] public class AbpNotificationsModule : AbpModule { public override void PreConfigureServices(ServiceConfigurationContext context) { AutoAddDefinitionProviders(context.Services); } private void AutoAddDefinitionProviders(IServiceCollection services) { var definitionProviders = new List(); services.OnRegistred(context => { if (typeof(INotificationDefinitionProvider).IsAssignableFrom(context.ImplementationType)) { definitionProviders.Add(context.ImplementationType); } }); var preActions = services.GetPreConfigureActions(); Configure(options => { preActions.Configure(options); options.DefinitionProviders.AddIfNotContains(definitionProviders); }); } }