示例#1
0
        /// <summary>
        /// Static constructor.
        /// </summary>
        static SessionBase()
        {
            MsgSessionAttribute attr;

            attr           = new MsgSessionAttribute();
            attr.Type      = SessionTypeID.Unknown;
            defSessionInfo = new SessionHandlerInfo(attr);
        }
示例#2
0
 /// <summary>
 /// Copies the fields from the attribute instance passed to this instance.
 /// </summary>
 /// <param name="attr">The [MsgSession] attribute instance.</param>
 public SessionHandlerInfo(MsgSessionAttribute attr)
 {
     this.Idempotent            = attr.Idempotent;
     this.KeepAliveTime         = attr.KeepAliveTime;
     this.IsAsync               = attr.IsAsync;
     this.MaxAsyncKeepAliveTime = attr.MaxAsyncKeepAliveTime;
     this.SessionTimeoutTime    = attr.SessionTimeoutTime;
     this.SessionType           = attr.SessionType;
     this.Parameters            = ArgCollection.Parse(attr.Parameters);
 }
示例#3
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);
            }
        }