Yuebon.NetCore/Yuebon.Commons/EventBus/IEventBusSubscriptionsManager.cs

(开头部分) 2KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。


using Yuebon.Commons.EventBus.Abstractions;
using Yuebon.Commons.EventBus.Events;
using static Yuebon.Commons.EventBus.InMemoryEventBusSubscriptionsManager;

namespace Yuebon.Commons.EventBus;

/// <summary>
/// 事件总线订阅管理器
/// 接口
/// </summary>
public interface IEventBusSubscriptionsManager
{
    /// <summary>
    /// 是否为空
    /// </summary>
    bool IsEmpty { get; }
    /// <summary>
    /// 移除事件
    /// </summary>
    event EventHandler<string> OnEventRemoved;
    /// <summary>
    /// 添加订阅
    /// </summary>
    /// <typeparam name="TH"></typeparam>
    /// <param name="eventName"></param>
    void AddDynamicSubscription<TH>(string eventName)
        where TH : IDynamicIntegrationEventHandler;
    /// <summary>
    /// 添加订阅
    /// </summary>
    /// <typeparam name="T"></typeparam>
    /// <typeparam name="TH"></typeparam>
    void AddSubscription<T, TH>()
        where T : IntegrationEvent
        where TH : IIntegrationEventHandler<T>;
    /// <summary>
    /// 移除订阅
    /// </summary>
    /// <typeparam name="T"></typeparam>
    /// <typeparam name="TH"></typeparam>
    void RemoveSubscription<T, TH>()
            where TH : IIntegrationEventHandler<T>
            where T : IntegrationEvent;
    /// <summary>
    /// 移除订阅
    /// </summary>
    /// <typeparam name="TH"></typeparam>
    /// <param name="eventName">事件名称</param>
    void RemoveDynamicSubscription<TH>(string eventName)
        where TH : IDynamicIntegrationEventHandler;
    /// <summary>
    /// 是否存在订阅
    /// </summary>
    /// <typeparam name="T"></typeparam>
    /// <returns></returns>
    bool HasSubscriptionsForEvent<T>() where T : IntegrationEvent;
    /// <summary>
    /// 通过事件名称判断是否存在订阅
    /// </summary>
后面还有 32 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。