当前位置: 首页>>代码示例>>C#>>正文


C# IsolationLevel.ToString方法代码示例

本文整理汇总了C#中IsolationLevel.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# IsolationLevel.ToString方法的具体用法?C# IsolationLevel.ToString怎么用?C# IsolationLevel.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IsolationLevel的用法示例。


在下文中一共展示了IsolationLevel.ToString方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: NotSupportedIsolationLevel

        static internal ArgumentOutOfRangeException NotSupportedIsolationLevel(IsolationLevel value) {
#if DEBUG
            switch(value) {
            case IsolationLevel.Unspecified:
            case IsolationLevel.ReadUncommitted:
            case IsolationLevel.ReadCommitted:
            case IsolationLevel.RepeatableRead:
            case IsolationLevel.Serializable:
            case IsolationLevel.Snapshot:
                Debug.Assert(false, "valid IsolationLevel " + value.ToString());
                break;
            case IsolationLevel.Chaos:
                break;
            default:
                Debug.Assert(false, "invalid IsolationLevel " + value.ToString());
                break;
            }
#endif
            return ODBC.NotSupportedEnumerationValue(typeof(IsolationLevel), (int)value);
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:20,代码来源:Odbc32.cs

示例2: Transaction

        /// <summary>
        /// Initialises a new instance of the <see cref="Transaction" /> class.
        /// </summary>
        /// <param name="sessionBase">The session that the transaction is being created for.</param>
        /// <param name="isolationLevel">The isolation level.</param>
        internal Transaction(ISessionBase sessionBase, IsolationLevel isolationLevel)
        {
            this.sessionBase = sessionBase;

            if (log.IsDebug)
            {
                log.Debug(LogMessages.Transaction_BeginTransactionWithIsolationLevel, isolationLevel.ToString());
            }

            this.transaction = this.sessionBase.Connection.BeginTransaction(isolationLevel);
        }
开发者ID:natarajanmca11,项目名称:MicroLite,代码行数:16,代码来源:Transaction.cs

示例3: IngresTransaction

	internal IngresTransaction(IngresConnection conn, IsolationLevel level)
	{
		switch(level)
		{
			case IsolationLevel.ReadUncommitted: 
			case IsolationLevel.ReadCommitted: 
			case IsolationLevel.RepeatableRead: 
			case IsolationLevel.Serializable: 
				break;
			case IsolationLevel.Unspecified:
				level = IsolationLevel.ReadCommitted;  // default
				break;
			default: 
				throw new NotSupportedException(
					"IngresTransaction(IsolationLevel."+level.ToString()+")");
		}

		_connection     = conn;
		_isolationLevel = level;
	}
开发者ID:JordanChin,项目名称:Ingres,代码行数:20,代码来源:transact.cs

示例4: InvalidIsolationLevel

        // IDbConnection.BeginTransaction, OleDbTransaction.Begin
        static internal ArgumentOutOfRangeException InvalidIsolationLevel(IsolationLevel value)
        {
#if DEBUG
            switch (value)
            {
                case IsolationLevel.Unspecified:
                case IsolationLevel.Chaos:
                case IsolationLevel.ReadUncommitted:
                case IsolationLevel.ReadCommitted:
                case IsolationLevel.RepeatableRead:
                case IsolationLevel.Serializable:
                case IsolationLevel.Snapshot:
                    Debug.Fail("valid IsolationLevel " + value.ToString());
                    break;
            }
#endif
            return InvalidEnumerationValue(typeof(IsolationLevel), (int)value);
        }
开发者ID:dotnet,项目名称:corefx,代码行数:19,代码来源:AdapterUtil.cs

示例5: TransactionScope

        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="transactionScopeOption">An instance of the System.Transactions.TransactionScopeOption enumeration that describes the transaction requirements associated with this transaction scope.</param>
        /// <param name="isolationLevel">the isolation level of the transaction.</param>
        /// <param name="timeout">the timeout period for the transaction.</param>
        public TransactionScope(TransactionScopeOption transactionScopeOption, IsolationLevel isolationLevel, TimeSpan timeout)
        {
            TransactionOptions options = new TransactionOptions();
            options.IsolationLevel = (System.Transactions.IsolationLevel)Enum.Parse(typeof(System.Transactions.IsolationLevel), isolationLevel.ToString());
            options.Timeout = timeout;

            System.Transactions.TransactionScopeOption transactionScopeOptionValue = (System.Transactions.TransactionScopeOption)Enum.Parse(typeof(System.Transactions.TransactionScopeOption), transactionScopeOption.ToString());
            this.transactionScope = new System.Transactions.TransactionScope(transactionScopeOptionValue, options);
            TransactionScopeContext.Increase();
        }
开发者ID:TatumAndBell,项目名称:RapidWebDev-Enterprise-CMS,代码行数:16,代码来源:TransactionScope.cs

示例6: ExecuteTransaction

        override internal void ExecuteTransaction(
                    TransactionRequest      transactionRequest, 
                    string                  transactionName, 
                    IsolationLevel          iso, 
                    SqlInternalTransaction  internalTransaction, 
                    bool                    isDelegateControlRequest) {
            if (Bid.AdvancedOn) {
                Bid.Trace("<sc.SqlInternalConnectionSmi.ExecuteTransaction|ADV> %d#, transactionRequest=%ls, transactionName='%ls', isolationLevel=%ls, internalTransaction=#%d transactionId=0x%I64x.\n", 
                                                        base.ObjectID, 
                                                        transactionRequest.ToString(), 
                                                        (null != transactionName) ? transactionName : "null", 
                                                        iso.ToString(), 
                                                        (null != internalTransaction) ? internalTransaction.ObjectID : 0,
                                                        (null != internalTransaction) ? internalTransaction.TransactionId : SqlInternalTransaction.NullTransactionId
                                                        );
            }
            switch (transactionRequest) {
                case TransactionRequest.Begin:
                    try {
                        _pendingTransaction = internalTransaction; // store this for the time being.

                        _smiConnection.BeginTransaction(transactionName, iso, _smiEventSink);
                    }
                    finally {
                        _pendingTransaction = null;
                    }
                    
                    Debug.Assert(_smiEventSink.HasMessages || null != _currentTransaction, "begin transaction without TransactionStarted event?");
                    break;

                case TransactionRequest.Commit:
                    Debug.Assert(null != _currentTransaction, "commit transaction without TransactionStarted event?");
                    
                    _smiConnection.CommitTransaction(_currentTransaction.TransactionId, _smiEventSink);
                    break;

                case TransactionRequest.Promote:
                    Debug.Assert(null != _currentTransaction, "promote transaction without TransactionStarted event?");
                    PromotedDTCToken = _smiConnection.PromoteTransaction(_currentTransaction.TransactionId, _smiEventSink);
                    break;

                case TransactionRequest.Rollback:
                case TransactionRequest.IfRollback:
                    Debug.Assert(null != _currentTransaction, "rollback/ifrollback transaction without TransactionStarted event?");
                    _smiConnection.RollbackTransaction(_currentTransaction.TransactionId, transactionName, _smiEventSink);
                    break;

                case TransactionRequest.Save:
                    Debug.Assert(null != _currentTransaction, "save transaction without TransactionStarted event?");
                    _smiConnection.CreateTransactionSavePoint(_currentTransaction.TransactionId, transactionName, _smiEventSink);
                    break;

                default:
                    Debug.Assert (false, "unhandled case for TransactionRequest");
                    break;
            }

            _smiEventSink.ProcessMessagesAndThrow();
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:59,代码来源:SqlInternalConnectionSmi.cs

示例7: SetIsolationLevel

        public static void SetIsolationLevel(this System.Data.SqlClient.SqlConnection connection, IsolationLevel isolationLevel)
        {
            if (isolationLevel == IsolationLevel.Unspecified || isolationLevel == IsolationLevel.Chaos)
            {
                throw new Exception(string.Format("Isolation Level '{0}' can not be set.", isolationLevel.ToString()));
            }

            string isolationLevelSqlName;
            switch (isolationLevel)
            {
                case IsolationLevel.Chaos: isolationLevelSqlName = "CHAOS"; break;
                case IsolationLevel.ReadCommitted: isolationLevelSqlName = "READ COMMITTED"; break;
                case IsolationLevel.ReadUncommitted: isolationLevelSqlName = "READ UNCOMMITTED"; break;
                case IsolationLevel.RepeatableRead: isolationLevelSqlName = "REPEATABLE READ"; break;
                case IsolationLevel.Serializable: isolationLevelSqlName = "SERIALIZABLE"; break;
                case IsolationLevel.Snapshot: isolationLevelSqlName = "SNAPSHOT"; break;
                default: isolationLevelSqlName = "UNSPECIFIED"; break;
            }

            IDbCommand command = connection.CreateCommand();
            command.CommandText = "SET TRANSACTION ISOLATION LEVEL " + isolationLevelSqlName;
            command.ExecuteNonQuery();
        }
开发者ID:codetuner,项目名称:Arebis.Common,代码行数:23,代码来源:DbExtensions.cs

示例8: SetIsolationLevel

        public void SetIsolationLevel(string typePart, IsolationLevel expected)
        {
            var sql = String.Format("SET TRANSACTION ISOLATION LEVEL {0}", typePart);

            var result = Compile(sql);

            Assert.IsNotNull(result);
            Assert.IsFalse(result.HasErrors);

            Assert.AreEqual(1, result.Statements.Count);

            var statement = result.Statements.ElementAt(0);

            Assert.IsNotNull(statement);
            Assert.IsInstanceOf<SetStatement>(statement);

            var set = (SetStatement)statement;
            Assert.AreEqual(TransactionSettingKeys.IsolationLevel, set.SettingName);
            Assert.IsInstanceOf<SqlConstantExpression>(set.ValueExpression);

            var value = (SqlConstantExpression)set.ValueExpression;
            var field = value.Value;

            Assert.IsInstanceOf<StringType>(field.Type);

            var s = (SqlString) field.Value;

            Assert.AreEqual(expected.ToString(), s.ToString());
        }
开发者ID:deveel,项目名称:deveeldb,代码行数:29,代码来源:SetTransactionTests.cs


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