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

C# IsolationLevel类代码示例

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

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



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


示例16: NpgsqlTransaction

        internal NpgsqlTransaction(NpgsqlConnection conn, IsolationLevel isolation)
        {
            NpgsqlEventLog.LogMethodEnter(LogLevel.Debug, CLASSNAME, CLASSNAME);

            _conn = conn;
            _isolation = isolation;

            StringBuilder commandText = new StringBuilder("BEGIN; SET TRANSACTION ISOLATION LEVEL ");

            if ((isolation == IsolationLevel.RepeatableRead) ||
                (isolation == IsolationLevel.Serializable) ||
                (isolation == IsolationLevel.Snapshot))
            {
                commandText.Append("SERIALIZABLE");
            }
            else
            {
                // Set isolation level default to read committed.
                _isolation = IsolationLevel.ReadCommitted;
                commandText.Append("READ COMMITTED");
            }

            commandText.Append(";");

            NpgsqlCommand command = new NpgsqlCommand(commandText.ToString(), conn.Connector);
            command.ExecuteBlind();
            _conn.Connector.Transaction = this;
        }
开发者ID:seeseekey,项目名称:CSCL,代码行数:28,代码来源:NpgsqlTransaction.cs


示例17: CreateReadOnlyWithTransaction

 public IDataContextReadOnlyScope CreateReadOnlyWithTransaction(IsolationLevel isolationLevel)
 {
     return new DataContextReadOnlyScope(
       joiningOption: DataContextScopeOption.ForceCreateNew,
       isolationLevel: isolationLevel,
       dataContextFactory: _dataContextFactory);
 }
开发者ID:wintouch,项目名称:DataContextScope,代码行数:7,代码来源:DataContextScopeFactory.cs


示例18: CreateTransaction

        public static ITransaction CreateTransaction(this IDatabase database, IsolationLevel isolation)
        {
            if (!database.IsOpen)
                throw new InvalidOperationException(String.Format("Database '{0}' is not open.", database.Name));

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


示例19: BeginIsolationScope

        /// <summary>
        /// Begins a new, nested, isolation scope
        /// </summary>
        /// <param name="isolationScopeName">The name of the new isolation scope</param>
        /// <param name="initialize">A delegate to an action that is performed on initialization. If an exception occurs inside this 
        /// method, then the scope is automatically destroyed, calling any cleanup actions that were added during this method</param>
        public IDisposable BeginIsolationScope(string isolationScopeName, Action<IIsolationScope> initialize)
        {
            if (initialize == null)
                initialize = Functions.EmptyAction<IIsolationScope>();

            _currentState = State.Initialize;
            var lastIsolationLevel = _currentIsolationLevel;
            _currentIsolationLevel = new IsolationLevel(isolationScopeName);

            Logger.WriteLine("***************************** Initializing " + isolationScopeName + " *****************************");
            try
            {
                initialize(this);
                Logger.WriteLine("***************************** Initializing " + isolationScopeName + " Completed succesfully *****************************");
            }
            catch
            {
                _currentIsolationLevel.Cleanup();
                _currentIsolationLevel = lastIsolationLevel;
                throw;
            }

            _isolationLevels.Push(lastIsolationLevel);

            _currentState = State.Normal;

            return new IsolationScopeDisposer(this);
        }
开发者ID:arnonax,项目名称:TestEssentials,代码行数:34,代码来源:TestExecutionScopesManager.cs


示例20: AddWorkspace

 /// <summary>
 /// Registers openning of a workspace
 /// </summary>
 /// <param name="workspaceId">Workspace ID</param>
 /// <param name="snapshotId">Opened snapshot ID</param>
 /// <param name="isolationLevel">Isolation level</param>
 /// <param name="timeout">Workspace timeout</param>
 public void AddWorkspace(Guid workspaceId, Guid snapshotId, IsolationLevel isolationLevel, TimeSpan timeout)
 {
     lock (workspaceStates)
     {
         workspaceStates.Add(workspaceId, new WorkspaceStateElement(snapshotId, isolationLevel, DateTime.UtcNow, timeout));
     }
 }
开发者ID:nemanjazz,项目名称:iog,代码行数:14,代码来源:TrackingWorkspaceStateProvider.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# Issue类代码示例发布时间:2022-05-24
下一篇:
C# Isolation类代码示例发布时间: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