コード例 #1
0
        /// <summary>
        /// 获取一个新的token,并设定隔离级别
        /// </summary>
        /// <param name="level"></param>
        /// <returns></returns>
        public static TransactionToken NewToken(FrameIsolationLevel level)
        {
            TransactionToken rtn = new TransactionToken();

            rtn._isolevel = level;
            return(rtn);
        }
コード例 #2
0
        /// <summary>
        /// 获取一个新的token,并设定失效时间
        /// </summary>
        /// <param name="expiredminutes"></param>
        /// <returns></returns>
        public static TransactionToken NewToken(int expiredminutes)
        {
            TransactionToken rtn = new TransactionToken();

            rtn._expired = expiredminutes;
            return(rtn);
        }
コード例 #3
0
        /// <summary>
        /// 获取一个新的token,并设定隔离级别和失效时间
        /// </summary>
        /// <param name="level"></param>
        /// <param name="expiredminutes"></param>
        /// <returns></returns>
        public static TransactionToken NewToken(FrameIsolationLevel level, int expiredminutes)
        {
            TransactionToken rtn = new TransactionToken();

            rtn._isolevel = level;
            rtn._expired  = expiredminutes;
            return(rtn);
        }
コード例 #4
0
 public void Add(TransactionToken token)
 {
     if (!_d.ContainsKey(token.UniqueID))
     {
         _d.Add(token.UniqueID, token);
     }
     else
     {
         throw new ItemExistsException("Token added exists");
     }
 }
コード例 #5
0
 public void Remove(TransactionToken token)
 {
     if (token.CurrentStatus == TransactionToken.TransStatus.None)
     {
         _d.Remove(token.UniqueID);
         token.Release();
     }
     else
     {
         throw new FrameException("The token can't be removed because it's in using.");
     }
 }
コード例 #6
0
        /// <summary>
        /// 获取一个新的Token
        /// </summary>
        /// <returns></returns>
        public static TransactionToken NewToken()
        {
            TransactionToken rtn = new TransactionToken();

            return(rtn);
        }