示例#1
0
        private void init(params string[] args)
        {
            object obj = CallContext.GetData("___Ticket");

            if (obj != null)
            {
                LogicalTicket lt = obj as LogicalTicket;
                for (int ii = 0; ii < lt.Count; ii++)
                {
                    base[lt.GetKey(ii)] = lt.Get(ii);
                }
            }
            if (args != null)
            {
                foreach (string s in args)
                {
                    string[] nv = s.Split(new char[] { '=' }, 2);
                    if (nv.Length != 2)
                    {
                        throw new Exception(string.Format("Wrong name/value pattern in the Ticket, arg={0}", s));
                    }
                    base[nv[0].Trim()] = nv[1].Trim();
                }
            }
        }
示例#2
0
 public LogicalTicket(IMessage imsg)
 {
     if (imsg != null)
     {
         object obj = imsg.Properties["__CallContext"];
         if (obj != null && obj is LogicalCallContext)
         {
             LogicalCallContext lcc    = obj as LogicalCallContext;
             object             ticket = lcc.GetData("___Ticket");
             if (ticket != null && ticket is LogicalTicket)
             {
                 LogicalTicket lt = ticket as LogicalTicket;
                 for (int ii = 0; ii < lt.Count; ii++)
                 {
                     base[lt.GetKey(ii)] = lt.Get(ii);
                 }
             }
         }
     }
 }