/// <summary> /// 获取一个新的token,并设定隔离级别 /// </summary> /// <param name="level"></param> /// <returns></returns> public static TransactionToken NewToken(FrameIsolationLevel level) { TransactionToken rtn = new TransactionToken(); rtn._isolevel = level; return(rtn); }
/// <summary> /// 获取一个新的token,并设定失效时间 /// </summary> /// <param name="expiredminutes"></param> /// <returns></returns> public static TransactionToken NewToken(int expiredminutes) { TransactionToken rtn = new TransactionToken(); rtn._expired = expiredminutes; return(rtn); }
/// <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); }
public void Add(TransactionToken token) { if (!_d.ContainsKey(token.UniqueID)) { _d.Add(token.UniqueID, token); } else { throw new ItemExistsException("Token added exists"); } }
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."); } }
/// <summary> /// 获取一个新的Token /// </summary> /// <returns></returns> public static TransactionToken NewToken() { TransactionToken rtn = new TransactionToken(); return(rtn); }