public static DelegateHandler <TMessage> Access <TMessage>( Guid id, string description, LogEnum logType, Action <TMessage> action) { StackTrace ss = new StackTrace(false); Type location = ss.GetFrame(1).GetMethod().DeclaringType; IHandlerId handlerId = HandlerId.Create(typeof(TMessage), location, id, description, logType); return(MessageDispatcher.Register(handlerId, action)); }
// 修建消息(命令或事件)的运动路径 public static DelegateHandler <TMessage> Path <TMessage>(string description, LogEnum logType, Action <TMessage> action) { StackTrace ss = new StackTrace(false); // 0是Path,1是Accpt或On,2是当地 Type location = ss.GetFrame(2).GetMethod().DeclaringType; IHandlerId handlerId = HandlerId.Create(typeof(TMessage), location, description, logType); return(SMessageDispatcher.Register(handlerId, action)); }