Пример #1
0
        /// <summary>
        /// Constructs a MsgHandler instance mapped to a reflected
        /// message handler method.
        /// </summary>
        /// <param name="target">The target object instance.</param>
        /// <param name="method">Information about the instance method that will actually handle the message.</param>
        /// <param name="msgType">The message type accepted by the handler.</param>
        /// <param name="handlerAttr">The [MsgHandler] instance for the handler (or <c>null</c>).</param>
        /// <param name="sessionInfo">The session information for the handler (or <c>null</c>).</param>
        public MsgHandler(object target, MethodInfo method, System.Type msgType, MsgHandlerAttribute handlerAttr, SessionHandlerInfo sessionInfo)
        {
            if (sessionInfo == null)
            {
                sessionInfo = SessionHandlerInfo.Default;
            }

            this.Target       = target;
            this.Method       = method;
            this.MsgType      = msgType;
            this.DynamicScope = handlerAttr == null ? null : handlerAttr.DynamicScope;
            this.SessionInfo  = sessionInfo;
        }
Пример #2
0
        /// <summary>
        /// Constructs a MsgHandler instance mapped to a reflected
        /// message handler method.
        /// </summary>
        /// <param name="target">The target object instance.</param>
        /// <param name="method">Information about the instance method that will actually handle the message.</param>
        /// <param name="msgType">The message type accepted by the handler.</param>
        /// <param name="handlerAttr">The [MsgHandler] instance for the handler (or <c>null</c>).</param>
        /// <param name="sessionAttr">The [MsgSession] instance for the handler (or <c>null</c>).</param>
        public MsgHandler(object target, MethodInfo method, System.Type msgType, MsgHandlerAttribute handlerAttr, MsgSessionAttribute sessionAttr)
        {
            this.Target       = target;
            this.Method       = method;
            this.MsgType      = msgType;
            this.DynamicScope = handlerAttr == null ? null : handlerAttr.DynamicScope;

            if (sessionAttr == null)
            {
                this.SessionInfo = SessionHandlerInfo.Default;
            }
            else
            {
                this.SessionInfo = new SessionHandlerInfo(sessionAttr);
            }
        }