コード例 #1
0
 /// <summary>
 /// 获取已存在实例
 /// </summary>
 /// <returns></returns>
 public static Import3rdDataHelper GetInstance()
 {
     if (CreateTime.AddMinutes(5).CompareTo(DateTime.Now) <= 0)
     {
         lock (lockHelper)
         {
             instance = null;
         }
     }
     return(instance);
 }
コード例 #2
0
        /// <summary>
        /// 创建实例,如果存在实例则返回现有实例,否则创建。
        /// </summary>
        /// <returns></returns>
        public static Import3rdDataHelper CreateInstance(string accountID)
        {
            lock (lockHelper)
            {
                if (instance != null)
                {
                    instance = null;
                }

                instance          = new Import3rdDataHelper();
                instanceAccountID = accountID;
                createTime        = Convert.ToString(DateTime.Now);
                instanceID        = HttpContext.Current.Session.SessionID;
            }
            return(instance);
        }