• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# TransactionState类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中TransactionState的典型用法代码示例。如果您正苦于以下问题:C# TransactionState类的具体用法?C# TransactionState怎么用?C# TransactionState使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



TransactionState类属于命名空间,在下文中一共展示了TransactionState类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: CqlBatchTransaction

 /// <summary>
 /// Initializes a new instance of the <see cref="CqlBatchTransaction" /> class.
 /// </summary>
 public CqlBatchTransaction()
 {
     _batchCommand = new CqlCommand {Transaction = this};
     _commands = new List<BatchFrame.BatchedCommand>();
     _batchType = CqlBatchType.Logged;
     _state = TransactionState.Pending;
 }
开发者ID:reuzel,项目名称:CqlSharp,代码行数:10,代码来源:CqlBatchTransaction.cs


示例2: Begin

 internal void Begin()
 {
     try
     {
         if (_state == TransactionState.Active)
         {
             throw new InvalidOperationException("Transaction is already active");
         }
         CheckThread();
         if (_threadFlag != null)
         {
             throw new InvalidOperationException("Nested transactions are not allowed!");
         }
         _threadFlag = true;
         _startTime = Clock.CurrentTimeMillis();
         var request = TransactionCreateCodec.EncodeRequest(GetTimeoutMillis(), _options.GetDurability(),
             (int) _options.GetTransactionType(), _threadId);
         var response = Invoke(request);
         _txnId = TransactionCreateCodec.DecodeResponse(response).response;
         _state = TransactionState.Active;
     }
     catch (Exception e)
     {
         _threadFlag = null;
         throw ExceptionUtil.Rethrow(e);
     }
 }
开发者ID:ihsandemir,项目名称:hazelcast-csharp-client,代码行数:27,代码来源:TransactionProxy.cs


示例3: EquityTransaction

 private EquityTransaction(int shares, double priceBuy, double priceSell, DateTime dateBuy, DateTime dateSell, TransactionState state)
 {
     Shares = shares;
     PriceBuy = priceBuy;
     PriceSell = priceSell;
     DateBuy = dateBuy;
     DateSell = dateSell;
     State = state;
 }
开发者ID:nickkfwong,项目名称:ManagePortfolio,代码行数:9,代码来源:EquityTransaction.cs


示例4: GetOutsideTransferBySequenceNo

        public OutboundTransferModel GetOutsideTransferBySequenceNo(string seqNo, TransactionState txstate)
        {
            Check.Argument.IsNotEmpty(seqNo, "seqNo");

            return this.Context.Sql(getOutboundTransferBySequenceNo_Sql)
                               .Parameter("@seqNo", seqNo)
                               .Parameter("@state", txstate)
                               .QuerySingle<OutboundTransferModel>();
        }
开发者ID:timfun,项目名称:DotPay,代码行数:9,代码来源:OutboundTransferQuery.cs


示例5: GetInsideTransferBySequenceNo

        public InsideTransferModel GetInsideTransferBySequenceNo(string seqNo, TransactionState txstate, CurrencyType currency)
        {
            Check.Argument.IsNotEmpty(seqNo, "seqNo");

            return this.Context.Sql(getInsideTransferBySequenceNo_Sql.FormatWith(currency.ToString()))
                               .Parameter("@seqNo", seqNo)
                               .Parameter("@state", txstate)
                               .QuerySingle<InsideTransferModel>();
        }
开发者ID:timfun,项目名称:DotPay,代码行数:9,代码来源:InsideTransferQuery.cs


示例6: TransactionCookie

 public TransactionCookie(int _transactionId, ILogger logImplement)
 {
     this._transactionId = _transactionId;
     _keyResults = new Dictionary<string, string>();
     _state = TransactionState._Unknown;
     _transactionCompletedEvent = new ManualResetEvent(false);
     _request = null;
     _response = null;
     _logger = logImplement;
 }
开发者ID:Ravikumar108,项目名称:ImageList,代码行数:10,代码来源:DataSource.cs


示例7: GdsTransaction

		public GdsTransaction(IDatabase db)
			: this()
		{
			if (!(db is GdsDatabase))
			{
				throw new ArgumentException("Specified argument is not of GdsDatabase type.");
			}

			_database = (GdsDatabase)db;
			_state = TransactionState.NoTransaction;
		}
开发者ID:mrgleba,项目名称:FirebirdSql.Data.FirebirdClient,代码行数:11,代码来源:GdsTransaction.cs


示例8: ExtTransaction

		public ExtTransaction(IDatabase db)
		{
			if (!(db is ExtDatabase))
			{
				throw new ArgumentException("Specified argument is not of FesDatabase type.");
			}

			_db = (ExtDatabase)db;
			_state = TransactionState.NoTransaction;
			_statusVector = new int[IscCodes.ISC_STATUS_LENGTH];
		}
开发者ID:fishcodelib,项目名称:FirebirdSql.Data.FirebirdClient,代码行数:11,代码来源:ExtTransaction.cs


示例9: FesTransaction

		public FesTransaction(IDatabase db)
		{
			if (!(db is FesDatabase))
			{
				throw new ArgumentException("Specified argument is not of FesDatabase type.");
			}

			this.db		= (FesDatabase)db;
			this.state	= TransactionState.NoTransaction;

			GC.SuppressFinalize(this);
		}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:12,代码来源:FesTransaction.cs


示例10: FesTransaction

        public FesTransaction(IDatabase db)
        {
            if (!(db is FesDatabase))
            {
                throw new ArgumentException("Specified argument is not of FesDatabase type.");
            }

            this.db = (FesDatabase)db;
            this.state = TransactionState.NoTransaction;
            this.statusVector = new IntPtr[IscCodes.ISC_STATUS_LENGTH];

            GC.SuppressFinalize(this);
        }
开发者ID:Orvid,项目名称:SQLInterfaceCollection,代码行数:13,代码来源:FesTransaction.cs


示例11: DataServiceTransaction

		private DataServiceTransaction(DataService dataService) {
			_transactionState = TransactionState.Active;
			_dataService = dataService;
			_sendMessagesToPeers = true;
			_rollbackOnly = false;
			_outgoingMessages = new ArrayList();
			_processedMessageBatches = new ArrayList(1);
#if (NET_1_1)
			_updateCollectionMessages = new Hashtable(new ListHashCodeProvider(), new ListComparer());
			_clientUpdateCollectionMessages =  new Hashtable(new ListHashCodeProvider(), new ListComparer());
#else
			_updateCollectionMessages = new Hashtable(new ListHashCodeProvider());
			_clientUpdateCollectionMessages = new Hashtable(new ListHashCodeProvider());
#endif
		}
开发者ID:GodLesZ,项目名称:svn-dump,代码行数:15,代码来源:DataServiceTransaction.cs


示例12: ATransaction

        /// <summary>
        /// Creates a new transaction having the given parameters.
        /// </summary>
        /// <param name="myDistributed">Indicates that this transaction should synched within the entire cluster.</param>
        /// <param name="myLongRunning">Indicates that this transaction is a long-running transaction.</param>
        /// <param name="myIsolationLevel">The isolation level of this transaction.</param>
        /// <param name="myName">A name or identification for this transaction.</param>
        /// <param name="myCreated"></param>
        /// <param name="myTransactionUUID"></param>
        public ATransaction(Boolean myDistributed = false, Boolean myLongRunning = false, IsolationLevel myIsolationLevel = IsolationLevel.Serializable, String myName = "", DateTime? myCreated = null, TransactionUUID myTransactionUUID = null)
        {
            UUID            = TransactionUUID.NewUUID;
            _State          = TransactionState.Running;

            if (myCreated.HasValue)
                Created     = myCreated.Value;
            else
                Created     = TimestampNonce.Now;

            IsolationLevel  = myIsolationLevel;
            Distributed     = myDistributed;
            LongRunning     = myLongRunning;
            Name            = myName;
        }
开发者ID:TheByte,项目名称:sones,代码行数:24,代码来源:ATransaction.cs


示例13: Delete

 public bool Delete(AccountClass account)
 {
     bool bResult = false;
     try
     {
         using (DbManager db = new DbManager())
         {
             Accessor.Query.Delete(db, account);
         }
         bResult = true;
     }
     catch (Exception except)
     {
         throw new System.ArgumentException(except.Message);
     }
     TransState = TransactionState.Default;
     return bResult;
 }
开发者ID:DennisPitallano,项目名称:IRMS-MARKETING,代码行数:18,代码来源:AccountsManager.cs


示例14: DB2Transaction

		internal DB2Transaction(DB2Connection con, IsolationLevel isoL)
		{
			long db2IsoL;
			db2Conn = con;
			short sqlRet;

			isolationLevel = isoL;

			switch (isoL) 
			{
				default:
				case System.Data.IsolationLevel.Chaos:				//No DB2equivalent, default to SQL_TXN_READ_COMMITTED
				case System.Data.IsolationLevel.ReadCommitted:		//SQL_TXN_READ_COMMITTED
					db2IsoL = DB2Constants.SQL_TXN_READ_COMMITTED;
					break;
				case System.Data.IsolationLevel.ReadUncommitted:	//SQL_TXN_READ_UNCOMMITTED
					db2IsoL = DB2Constants.SQL_TXN_READ_UNCOMMITTED;
					break;
				case System.Data.IsolationLevel.RepeatableRead:		//SQL_TXN_REPEATABLE_READ
					db2IsoL = DB2Constants.SQL_TXN_REPEATABLE_READ;
					break;
				case System.Data.IsolationLevel.Serializable:		//SQL_TXN_SERIALIZABLE_READ
					db2IsoL = DB2Constants.SQL_TXN_SERIALIZABLE_READ;
					break;
			}

			if(db2Conn.openConnection.autoCommit)
			{
				sqlRet = DB2CLIWrapper.SQLSetConnectAttr(db2Conn.DBHandle, DB2Constants.SQL_ATTR_AUTOCOMMIT, new IntPtr(DB2Constants.SQL_AUTOCOMMIT_OFF), 0);
				DB2ClientUtils.DB2CheckReturn(sqlRet, DB2Constants.SQL_HANDLE_DBC, db2Conn.DBHandle, "Error setting AUTOCOMMIT OFF in transaction CTOR.", db2Conn);
				db2Conn.openConnection.autoCommit = false;
			}
			sqlRet = DB2CLIWrapper.SQLSetConnectAttr(db2Conn.DBHandle, DB2Constants.SQL_ATTR_TXN_ISOLATION, new IntPtr(db2IsoL), 0);
			DB2ClientUtils.DB2CheckReturn(sqlRet, DB2Constants.SQL_HANDLE_DBC, db2Conn.DBHandle, "Error setting isolation level.", db2Conn);

			state = TransactionState.Open;
		}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:37,代码来源:DB2Transaction.cs


示例15: Commit

		/// <summary>
		/// Clients can call this method to commit the transaction. You should only use this method if 
		/// you used the begin method to create the DataServiceTransaction. 
		/// Otherwise, the gateway will commit or rollback the transaction as necessary.
		/// </summary>
		public void Commit()
		{
			if( _rollbackOnly )
			{
				Rollback();
				return;
			}

			try
			{
                ProcessRefreshFills();

				_pushMessages = new ArrayList();
				for(int i = 0; i < _processedMessageBatches.Count; i++)
				{
					MessageBatch messageBatch = _processedMessageBatches[i] as MessageBatch;
					if( messageBatch.Messages != null && messageBatch.Messages.Count > 0 )
					{
						DataDestination dataDestination = _dataService.GetDestination(messageBatch.IncomingMessage) as DataDestination;
						try
						{
                            dataDestination.SequenceManager.ManageMessageBatch(messageBatch, this);
						}
						catch(Exception ex)
						{
							MessageException messageException = new MessageException(ex);
							ErrorMessage errorMessage = messageException.GetErrorMessage();
							errorMessage.correlationId = messageBatch.IncomingMessage.messageId;
							errorMessage.destination = messageBatch.IncomingMessage.destination;
							messageBatch.Messages.Clear();
							messageBatch.Messages.Add(errorMessage);
						}
						for(int j = 0; j < messageBatch.Messages.Count; j++)
						{
							IMessage message = messageBatch.Messages[j] as IMessage;

							if( !(message is ErrorMessage) )
								_pushMessages.Add(message);
						}
					}
					_outgoingMessages.AddRange(messageBatch.Messages);
				}
			
				for(int i = 0; i < _pushMessages.Count; i++)
				{
					IMessage message = _pushMessages[i] as IMessage;
					DataMessage dataMessage = message as DataMessage;
					if( dataMessage != null )
						PushMessage(GetSubscribers(message), message);
				}
				foreach(DictionaryEntry entry in _clientUpdateCollectionMessages)
				{
					UpdateCollectionMessage updateCollectionMessage = entry.Value as UpdateCollectionMessage;
					_outgoingMessages.Add(updateCollectionMessage);
					PushMessage(GetSubscribers(updateCollectionMessage), updateCollectionMessage);
				}
				foreach(DictionaryEntry entry in _updateCollectionMessages)
				{
					UpdateCollectionMessage updateCollectionMessage = entry.Value as UpdateCollectionMessage;
					_outgoingMessages.Add(updateCollectionMessage);
					PushMessage(GetSubscribers(updateCollectionMessage), updateCollectionMessage);
				}
			}
			finally
			{
				_transactionState = TransactionState.Committed;
			}
		}
开发者ID:ByteSempai,项目名称:Ubiquitous,代码行数:73,代码来源:DataServiceTransaction.cs


示例16: Dispose

		private void Dispose(bool disposing)
		{
			lock (_stateSyncRoot)
			{
				if (!_disposed)
				{
					try
					{
						Rollback();
					}
					catch
					{ }
					finally
					{
						if (disposing)
						{
							_database = null;
							_handle = 0;
							_state = TransactionState.NoTransaction;
						}

						_disposed = true;
					}
				}
			}
		}
开发者ID:mrgleba,项目名称:FirebirdSql.Data.FirebirdClient,代码行数:26,代码来源:GdsTransaction.cs


示例17: Prepare

		public void Prepare(byte[] buffer)
		{
			lock (_stateSyncRoot)
			{
				CheckTransactionState();

				try
				{
					_state = TransactionState.NoTransaction;

					lock (_database.SyncObject)
					{
						_database.XdrStream.Write(IscCodes.op_prepare2);
						_database.XdrStream.Write(_handle);
						_database.XdrStream.WriteBuffer(buffer, buffer.Length);
						_database.XdrStream.Flush();

						_database.ReadResponse();
					}

					_state = TransactionState.Prepared;
				}
				catch (IOException ex)
				{
					throw IscException.ForErrorCode(IscCodes.isc_net_read_err, ex);
				}
			}
		}
开发者ID:mrgleba,项目名称:FirebirdSql.Data.FirebirdClient,代码行数:28,代码来源:GdsTransaction.cs


示例18: RollbackRetaining

		public void RollbackRetaining()
		{
			lock (_stateSyncRoot)
			{
				CheckTransactionState();

				try
				{
					lock (_database.SyncObject)
					{
						_database.XdrStream.Write(IscCodes.op_rollback_retaining);
						_database.XdrStream.Write(_handle);
						_database.XdrStream.Flush();

						_database.ReadResponse();
					}

					_state = TransactionState.Active;
				}
				catch (IOException ex)
				{
					throw IscException.ForErrorCode(IscCodes.isc_net_read_err, ex);
				}
			}
		}
开发者ID:mrgleba,项目名称:FirebirdSql.Data.FirebirdClient,代码行数:25,代码来源:GdsTransaction.cs


示例19: Rollback

		public void Rollback()
		{
			lock (_stateSyncRoot)
			{
				CheckTransactionState();

				try
				{
					lock (_database.SyncObject)
					{
						_database.XdrStream.Write(IscCodes.op_rollback);
						_database.XdrStream.Write(_handle);
						_database.XdrStream.Flush();

						_database.ReadResponse();

						_database.TransactionCount--;
					}

					if (Update != null)
					{
						Update(this, new EventArgs());
					}

					_state = TransactionState.NoTransaction;
				}
				catch (IOException ex)
				{
					throw IscException.ForErrorCode(IscCodes.isc_net_read_err, ex);
				}
			}
		}
开发者ID:mrgleba,项目名称:FirebirdSql.Data.FirebirdClient,代码行数:32,代码来源:GdsTransaction.cs


示例20: BeginTransaction

		public void BeginTransaction(TransactionParameterBuffer tpb)
		{
			lock (_stateSyncRoot)
			{
				if (_state != TransactionState.NoTransaction)
				{
					throw GetNoValidTransactionException();
				}

				try
				{
					GenericResponse response;
					lock (_database.SyncObject)
					{
						_database.XdrStream.Write(IscCodes.op_transaction);
						_database.XdrStream.Write(_database.Handle);
						_database.XdrStream.WriteBuffer(tpb.ToArray());
						_database.XdrStream.Flush();

						response = _database.ReadGenericResponse();

						_database.TransactionCount++;
					}

					_handle = response.ObjectHandle;
					_state = TransactionState.Active;
				}
				catch (IOException ex)
				{
					throw IscException.ForErrorCode(IscCodes.isc_net_read_err, ex);
				}
			}
		}
开发者ID:mrgleba,项目名称:FirebirdSql.Data.FirebirdClient,代码行数:33,代码来源:GdsTransaction.cs



注:本文中的TransactionState类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# TransactionStatus类代码示例发布时间:2022-05-24
下一篇:
C# TransactionScopeOption类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap