/// <summary> /// /// </summary> /// <typeparam name="TData"></typeparam> /// <param name="bus"></param> /// <param name="handler">处理器</param> public static void Unsubscribe <TData>(this IMessageBus bus, Func <TData, object> handler) { Guard.NotNull(bus, "bus"); Guard.NotNull(handler, "handler"); bus.Unsubscribe(null, typeof(TData), ObserverHandler.CreateB <TData, object>(handler)); }
/// <summary> /// /// </summary> /// <typeparam name="TData"></typeparam> /// <typeparam name="TResult"></typeparam> /// <param name="bus"></param> /// <param name="topic">消息主题</param> /// <param name="handler">处理器</param> public static void Unsubscribe <TData, TResult>(this IMessageBus bus, string topic, Func <TData, TResult> handler) { Guard.NotNull(bus, "bus"); Guard.NotNull(handler, "handler"); bus.Unsubscribe(topic, typeof(TData), ObserverHandler.CreateB <TData, TResult>(handler)); }