using Volo.Abp.BackgroundWorkers.Hangfire;
using Volo.Abp.DependencyInjection;
namespace Yi.Framework.BackgroundWorkers.Hangfire;
///
/// Hangfire 后台任务约定注册器
///
public sealed class YiHangfireConventionalRegistrar : DefaultConventionalRegistrar
{
///
/// 检查类型是否禁用约定注册
///
/// 要检查的类型
/// 如果类型不是 IHangfireBackgroundWorker 或已被禁用则返回 true
protected override bool IsConventionalRegistrationDisabled(Type type)
{
return !typeof(IHangfireBackgroundWorker).IsAssignableFrom(type) ||
base.IsConventionalRegistrationDisabled(type);
}
///
/// 获取要暴露的服务类型列表
///
/// 实现类型
/// 服务类型列表
protected override List GetExposedServiceTypes(Type type)
{
return new List
{
typeof(IHangfireBackgroundWorker)
};
}
}