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


C# IsolationLevel类代码示例

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


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

示例1: OleDbTransaction

		internal OleDbTransaction (OleDbConnection connection, int depth, IsolationLevel isolevel) 
		{
			this.connection = connection;

			gdaTransaction = libgda.gda_transaction_new (depth.ToString ());
			
			switch (isolevel) {
			case IsolationLevel.ReadCommitted :
				libgda.gda_transaction_set_isolation_level (gdaTransaction,
									    GdaTransactionIsolation.ReadCommitted);
				break;
			case IsolationLevel.ReadUncommitted :
				libgda.gda_transaction_set_isolation_level (gdaTransaction,
									    GdaTransactionIsolation.ReadUncommitted);
				break;
			case IsolationLevel.RepeatableRead :
				libgda.gda_transaction_set_isolation_level (gdaTransaction,
									    GdaTransactionIsolation.RepeatableRead);
				break;
			case IsolationLevel.Serializable :
				libgda.gda_transaction_set_isolation_level (gdaTransaction,
									    GdaTransactionIsolation.Serializable);
				break;
			}
			
			libgda.gda_connection_begin_transaction (connection.GdaConnection, gdaTransaction);
		}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:27,代码来源:OleDbTransaction.cs

示例2: SqlServerConnection

 public SqlServerConnection(
     SqlConnection connection,
     IsolationLevel? isolationLevel,
     PersistentJobQueueProviderCollection queueProviders)
     : this(connection, isolationLevel, queueProviders, true)
 {
 }
开发者ID:vip32,项目名称:Hangfire.SQLite,代码行数:7,代码来源:SqlServerConnection.cs

示例3: Transaction

 public static void Transaction(IsolationLevel level, Action transactional)
 {
     using (UnitOfWork.Start())
     {
         // If we are already in a transaction, don't start a new one
         if (UnitOfWork.Current.IsInActiveTransaction)
         {
             transactional();
         }
         else
         {
             IGenericTransaction tx = UnitOfWork.Current.BeginTransaction(level);
             try
             {
                 transactional();
                 tx.Commit();
             }
             catch
             {
                 tx.Rollback();
                 throw;
             }
             finally
             {
                 tx.Dispose();
             }
         }
     }
 }
开发者ID:OneByteataTime,项目名称:Pinewood-Race-Command,代码行数:29,代码来源:With.Transaction.cs

示例4: BeginTransaction

 public IDbTransaction BeginTransaction(IsolationLevel il)
 {
     using (ExecuteHelper.Begin(dur => context.FireExecuteEvent(this, String.Format("BeginTransaction({0})", il), dur)))
     {
         return new DbTransactionProxy(connection.BeginTransaction(il), context);
     }
 }
开发者ID:haoasqui,项目名称:ONLYOFFICE-Server,代码行数:7,代码来源:DbConnectionProxy.cs

示例5: MsmqScopeOptions

        public MsmqScopeOptions(TimeSpan? requestedTimeout = null, IsolationLevel? requestedIsolationLevel = null)
        {
            var timeout = TransactionManager.DefaultTimeout;
            var isolationLevel = IsolationLevel.ReadCommitted;
            if (requestedTimeout.HasValue)
            {
                var maxTimeout = GetMaxTimeout();

                if (requestedTimeout.Value > maxTimeout)
                {
                    throw new ConfigurationErrorsException(
                        "Timeout requested is longer than the maximum value for this machine. Override using the maxTimeout setting of the system.transactions section in machine.config");
                }

                timeout = requestedTimeout.Value;
            }

            if (requestedIsolationLevel.HasValue)
            {
                isolationLevel = requestedIsolationLevel.Value;
            }

            TransactionOptions = new TransactionOptions
            {
                IsolationLevel = isolationLevel,
                Timeout = timeout
            };
        }
开发者ID:Particular,项目名称:NServiceBus,代码行数:28,代码来源:MsmqScopeOptions.cs

示例6: BeginTransaction

        public IDbTransaction BeginTransaction(IsolationLevel isolationLevel)
        {
            if (factory.AlwaysReturnTransaction != null)
                return factory.AlwaysReturnTransaction;

            return DbConnection.BeginTransaction(isolationLevel);
        }
开发者ID:hellboy81,项目名称:ormsimple,代码行数:7,代码来源:Connection.cs

示例7: AutoRollbackTransaction

 public static void AutoRollbackTransaction(IsolationLevel level, Proc transactional, UnitOfWorkNestingOptions nestingOptions)
 {
     using (UnitOfWork.Start(nestingOptions))
     {
         // If we are already in a transaction, don't start a new one
         if (UnitOfWork.Current.IsInActiveTransaction)
         {
             transactional();
         }
         else
         {
             RhinoTransaction tx = UnitOfWork.Current.BeginTransaction(level);
             try
             {
                 transactional();
                 tx.Rollback();
             }
             catch
             {
                 tx.Rollback();
                 throw;
             }
             finally
             {
                 tx.Dispose();
             }
         }
     }
 }
开发者ID:janlimpens,项目名称:rhino-commons,代码行数:29,代码来源:With.AutoRollbackTransaction.cs

示例8: executeNonQuery

        public Int32 executeNonQuery(MySqlCommand mySqlCommand, IsolationLevel isolationLevel)
        {
            using (MySqlTransaction transaccion = conexion.BeginTransaction(isolationLevel))
            {
                Int32 safectados = 0;
                try
                {

                    mySqlCommand.Connection = conexion;
                    mySqlCommand.Transaction = transaccion;
                    safectados = mySqlCommand.ExecuteNonQuery();

                    // Commit a la transacción
                    transaccion.Commit();

                }

                catch (Exception ex)
                {
                    ex.Source += " SQL: " + mySqlCommand.CommandText.ToString();
                    Log.Write(MethodBase.GetCurrentMethod().Name, ex);
                    throw ex;
                }
                return safectados;

            }
        }
开发者ID:jupmasalamanca,项目名称:idisa,代码行数:27,代码来源:Database.cs

示例9: CreateSession

        public static ISession CreateSession(this IDatabase database, string userName, string password, IsolationLevel isolation)
        {
            if (!database.Authenticate(userName, password))
                throw new InvalidOperationException(String.Format("Unable to create a session for user '{0}': not authenticated.", userName));

            return database.CreateSession(userName, isolation);
        }
开发者ID:deveel,项目名称:deveeldb,代码行数:7,代码来源:DatabaseExtensions.cs

示例10: ServiceBusTransactionScope

        public ServiceBusTransactionScope(string name, IsolationLevel isolationLevel, TimeSpan timeout)
        {
            this.name = name;
            log = Log.For(this);

            ignore = Transaction.Current != null;

            if (ignore)
            {
                if (log.IsVerboseEnabled)
                {
                    log.Verbose(string.Format(ESBResources.QueueTransactionScopeAmbient, name,
                                              Thread.CurrentThread.ManagedThreadId));
                }

                return;
            }

            scope = new TransactionScope(TransactionScopeOption.RequiresNew,
                                             new TransactionOptions
                                             	{
                                             		IsolationLevel = isolationLevel,
                                             		Timeout = timeout
                                             	});

            if (log.IsVerboseEnabled)
            {
                log.Verbose(string.Format(ESBResources.QueueTransactionScopeCreated, name, isolationLevel, timeout,
                                          Thread.CurrentThread.ManagedThreadId));
            }
        }
开发者ID:nnyamhon,项目名称:shuttle-esb,代码行数:31,代码来源:ServiceBusTransactionScope.cs

示例11: SqlTransaction

		internal SqlTransaction (SqlConnection connection, IsolationLevel isolevel)
		{
			this.connection = connection;
			this.isolationLevel = isolevel;
			isOpen = true;
			isRolledBack = false;
		}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:7,代码来源:SqlTransaction.cs

示例12: BeginTransaction

        public void BeginTransaction(IsolationLevel level)
        {
            if (mConnection.State == ConnectionState.Closed)
                mConnection.Open();

            mTransaction = mConnection.BeginTransaction(level);
        }
开发者ID:ramosrenato,项目名称:CDA,代码行数:7,代码来源:BaseDataAccess.cs

示例13: NpgsqlTransaction

        internal NpgsqlTransaction(NpgsqlConnection conn, IsolationLevel isolationLevel)
        {
            Contract.Requires(conn != null);
            Contract.Requires(isolationLevel != IsolationLevel.Chaos);

            Connection = conn;
            Connector.Transaction = this;
            Connector.TransactionStatus = TransactionStatus.Pending;

            switch (isolationLevel) {
                case IsolationLevel.RepeatableRead:
                    Connector.PrependInternalMessage(PregeneratedMessage.BeginTransRepeatableRead);
                    break;
                case IsolationLevel.Serializable:
                case IsolationLevel.Snapshot:
                    Connector.PrependInternalMessage(PregeneratedMessage.BeginTransSerializable);
                    break;
                case IsolationLevel.ReadUncommitted:
                    // PG doesn't really support ReadUncommitted, it's the same as ReadCommitted. But we still
                    // send as if.
                    Connector.PrependInternalMessage(PregeneratedMessage.BeginTransReadUncommitted);
                    break;
                case IsolationLevel.ReadCommitted:
                    Connector.PrependInternalMessage(PregeneratedMessage.BeginTransReadCommitted);
                    break;
                case IsolationLevel.Unspecified:
                    isolationLevel = DefaultIsolationLevel;
                    goto case DefaultIsolationLevel;
                default:
                    throw PGUtil.ThrowIfReached("Isolation level not supported: " + isolationLevel);
            }

            _isolationLevel = isolationLevel;
        }
开发者ID:dougdelabrida,项目名称:npgsql,代码行数:34,代码来源:NpgsqlTransaction.cs

示例14: GetUnitOfWork

		public override IUnitOfWork GetUnitOfWork(IsolationLevel isolationLevel = IsolationLevel.Unspecified)
		{
			if ((object)this.DictionaryUnitOfWorkCallback != null)
				return this.DictionaryUnitOfWorkCallback();
			else
				return null;
		}
开发者ID:textmetal,项目名称:main,代码行数:7,代码来源:DtsAdoNetAdapterConfiguration.cs

示例15: TestAdapterService

        private TestAdapterService(IsolationLevel isolationLevelToUse, Func<IDataAccessAdapter> adapterFunc)
        {
            _AdapterFunc = adapterFunc;
            _IsolationLevel = isolationLevelToUse;

            ResetActionsOnceCalled = true;
        }
开发者ID:cohero,项目名称:Ravendb-SupportLibraries,代码行数:7,代码来源:TestAdapterService.cs


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