Abp模块
abp
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

32 lines
1.0 KiB

using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;
using System;
using System.Collections.Generic;
using System.Linq;
using Volo.Abp.DependencyInjection;
namespace Sanhe.Abp.Notifications;
public class NotificationPublishProviderManager : INotificationPublishProviderManager, ISingletonDependency
{
public List<INotificationPublishProvider> Providers => _lazyProviders.Value;
protected AbpNotificationsOptions Options { get; }
private readonly Lazy<List<INotificationPublishProvider>> _lazyProviders;
public NotificationPublishProviderManager(
IServiceProvider serviceProvider,
IOptions<AbpNotificationsOptions> optionsAccessor)
{
Options = optionsAccessor.Value;
_lazyProviders = new Lazy<List<INotificationPublishProvider>>(
() => Options
.PublishProviders
.Select(type => serviceProvider.GetRequiredService(type) as INotificationPublishProvider)
.ToList(),
true
);
}
}