示例#1
0
        public TransactionToken BeginTrans(FrameIsolationLevel level)
        {
            TransactionToken newtoken = TransactionToken.NewToken();

            newtoken.Begin();
            _p.TransTokenList.Add(newtoken);
            return(newtoken);
        }
示例#2
0
        public void BeginTransaction(TransactionToken token)
        {
            if (token.IsExpired)
            {
                throw new Exception("当前Token已经过期,无法使用事务");
            }

            if (token.CurrentStatus == TransactionToken.TransStatus.Begin)
            {
                throw new Exception("当前事务已经开启");
            }
            if (_transd.ContainsKey(token.UniqueID))
            {
                foreach (IResourceEntity e in _transd[token.UniqueID].Values)
                {
                    if (e is ITransaction)
                    {
                        ((ITransaction)e).BeginTransaction(token.IsolationLevel);
                    }
                }
            }
            token.Begin();
        }