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


C# TransactionScopeOption类代码示例

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


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

示例1: SafeTransaction

 public SafeTransaction(TransactionScopeOption scopeOption = TransactionScopeOption.RequiresNew)
 {
     if (Database.DefaultConnectionFactory is SqlCeConnectionFactory)
         _transaction = null;
     else
         _transaction = new TransactionScope(scopeOption);
 }
开发者ID:kamaelyoung,项目名称:Carcass,代码行数:7,代码来源:SafeTransaction.cs

示例2: TransactionalOperationAttribute

 public TransactionalOperationAttribute(TransactionScopeOption option)
     : base(false)
 {
     this.Option = option;
     this.IsolationLevel = DefaultIsolationLevel;
     this.TimeoutMs = DefaultTimeoutMs;
 }
开发者ID:codetuner,项目名称:Arebis.Common,代码行数:7,代码来源:TransactionalOperationAttribute.cs

示例3: TransactionScope

        public TransactionScope(
            TransactionScopeOption scopeOption,
            TransactionScopeAsyncFlowOption asyncFlowOption
            )
        {
            if ( !TransactionManager._platformValidated ) TransactionManager.ValidatePlatform();

            if ( DiagnosticTrace.Verbose )
            {
                MethodEnteredTraceRecord.Trace( SR.GetString( SR.TraceSourceBase ),
                    "TransactionScope.ctor( TransactionScopeOption )"
                    );
            }

            ValidateAndSetAsyncFlowOption(asyncFlowOption);
            
            if ( NeedToCreateTransaction( scopeOption ) )
            {
                committableTransaction = new CommittableTransaction();
                expectedCurrent = committableTransaction.Clone();
            }

            if ( DiagnosticTrace.Information )
            {
                if ( null == expectedCurrent )
                {
                    TransactionScopeCreatedTraceRecord.Trace( SR.GetString( SR.TraceSourceBase ),
                        TransactionTraceIdentifier.Empty,
                        TransactionScopeResult.NoTransaction
                        );
                }
                else
                {
                    TransactionScopeResult scopeResult;

                    if ( null == committableTransaction )
                    {
                        scopeResult = TransactionScopeResult.UsingExistingCurrent;
                    }
                    else
                    {
                        scopeResult = TransactionScopeResult.CreatedTransaction;
                    }

                    TransactionScopeCreatedTraceRecord.Trace( SR.GetString( SR.TraceSourceBase ),
                        expectedCurrent.TransactionTraceId,
                        scopeResult
                        );
                }
            }

            PushScope();
            
            if ( DiagnosticTrace.Verbose )
            {
                MethodExitedTraceRecord.Trace( SR.GetString( SR.TraceSourceBase ),
                    "TransactionScope.ctor( TransactionScopeOption )"
                    );
            }
        }
开发者ID:mind0n,项目名称:hive,代码行数:60,代码来源:TransactionScope.cs

示例4: TransactionAttribute

		public TransactionAttribute(TransactionScopeOption mode, IsolationLevel isolationLevel)
		{
			Timeout = TimeSpan.MaxValue;
			Mode = mode;
			IsolationLevel = isolationLevel;
			_CustomContext = new Dictionary<string, object>();
		}
开发者ID:spiderjoe02,项目名称:Castle.Transactions,代码行数:7,代码来源:TransactionAttribute.cs

示例5: Commit

 public void Commit(TransactionScopeOption scopeOption, TransactionOptions transactionOptions)
 {
     using (TransactionScope scope = new TransactionScope(scopeOption, transactionOptions))
     {
         foreach (UnitOfWork.Operation operation2 in from o in this.operations
                                                     orderby o.ProcessDate
                                                     select o)
         {
             switch (operation2.Type)
             {
                 case UnitOfWork.OperationType.Insert:
                     operation2.Repository.PersistNewItem(operation2.Entity);
                     break;
                 case UnitOfWork.OperationType.Update:
                     operation2.Repository.PersistUpdatedItem(operation2.Entity);
                     break;
                 case UnitOfWork.OperationType.Delete:
                     operation2.Repository.PersistDeletedItem(operation2.Entity);
                     break;
             }
         }
         scope.Complete();
     }
     foreach (EntityBase entityBase in (from operation in this.operations
                                        select operation.Entity).OfType<EntityBase>())
     {
         entityBase.ClearChangedProperties();
     }
     this.Reset();
 }
开发者ID:wesleyzen,项目名称:UserSystem,代码行数:30,代码来源:UnitOfWork.cs

示例6: InheritedSqlPersistenceEngine

 public InheritedSqlPersistenceEngine(
     IConnectionFactory connectionFactory,
     ISqlDialect dialect,
     ISerialize serializer,
     TransactionScopeOption scopeOption, int pageSize) 
     : base(connectionFactory, dialect, serializer, scopeOption, pageSize)
 {}
开发者ID:hawkins6423,项目名称:NEventStore,代码行数:7,代码来源:SqlPersistenceEngineTests.cs

示例7: Init

 private void Init(TransactionScopeOption option, IsolationLevel isolationLevel)
 {
     _scope = new TransactionScope(option, new TransactionOptions()
     {
         IsolationLevel = isolationLevel
     });
 }
开发者ID:sreenandini,项目名称:test_buildscripts,代码行数:7,代码来源:TransactionHelper.cs

示例8: SqlPersistenceFactory

 private SqlPersistenceFactory(ISerialize serializer, TransactionScopeOption scopeOption,  IStreamIdHasher streamIdHasher, int pageSize)
 {
     _serializer = serializer;
     _scopeOption = scopeOption;
     _streamIdHasher = streamIdHasher ?? new Sha1StreamIdHasher();
     PageSize = pageSize;
 }
开发者ID:duncanbrown,项目名称:NEventStore.Persistence.SQL,代码行数:7,代码来源:SqlPersistenceFactory.cs

示例9: CreateRepeatableRead

        //TransactionScopeAsyncFlowOption transactionScopeAsyncFlowOption = TransactionScopeAsyncFlowOption.Suppress) // .NET 4.5.1 feature
        public static TransactionScope CreateRepeatableRead(
            TransactionScopeOption transactionScopeOption = TransactionScopeOption.Required,
            TimeSpan? timeout = null)
        {
            var transactionOptions = new TransactionOptions
            {
                IsolationLevel = IsolationLevel.RepeatableRead,
            };

            // Upgrade isolation level if necessary
            if (transactionScopeOption == TransactionScopeOption.Required)
            {
                var currentTransaction = Transaction.Current;
                if (currentTransaction != null && currentTransaction.IsolationLevel == IsolationLevel.Serializable)
                {
                    transactionOptions.IsolationLevel = currentTransaction.IsolationLevel;
                }
            }

            if (timeout.HasValue)
            {
                transactionOptions.Timeout = timeout.Value;
            }

            return new TransactionScope(transactionScopeOption, transactionOptions/*, transactionScopeAsyncFlowOption*/);
        }
开发者ID:ciker,项目名称:Shaolinq,代码行数:27,代码来源:TransactionScopeFactory.cs

示例10: FatQueueTransaction

        public FatQueueTransaction(
            IsolationLevel isolationLevel, 
            TimeSpan? timeout,
            Func<IDbConnection> connectionFactory,
            TransactionScopeOption transactionScopeOption = TransactionScopeOption.Required, 
            TransactionScopeAsyncFlowOption transactionScopeAsyncFlowOption = TransactionScopeAsyncFlowOption.Enabled)
        {
            _connectionFactory = connectionFactory;

            var transactionOptions = new TransactionOptions
            {
                IsolationLevel = isolationLevel,
            };

            if (timeout != null)
            {
                transactionOptions.Timeout = timeout.Value;
            }

            if (System.Transactions.Transaction.Current == null || transactionScopeOption == TransactionScopeOption.RequiresNew)
            {
                _transaction = new CommittableTransaction(transactionOptions);
                _transactionScope = new TransactionScope(_transaction, transactionScopeAsyncFlowOption);
            }
        }
开发者ID:mantasaudickas,项目名称:fat-queue,代码行数:25,代码来源:FatQueueTransaction.cs

示例11: StartTransaction

 public static TransactionScope StartTransaction(this IMessageContext messageContext,
     TransactionScopeOption option = TransactionScopeOption.Required)
 {
     var scope = new TransactionScope(option);
     messageContext.EnlistInCurrentTransaction();
     return scope;
 }
开发者ID:tdbrian,项目名称:Platibus,代码行数:7,代码来源:MessageContextExtensions.cs

示例12: SqlPersistenceFactory

        private SqlPersistenceFactory(ISerialize serializer, TransactionScopeOption scopeOption, int pageSize)
        {
            this.serializer = serializer;
            this.scopeOption = scopeOption;

            this.PageSize = pageSize;
        }
开发者ID:StasPerekrestov,项目名称:EventStore,代码行数:7,代码来源:SqlPersistenceFactory.cs

示例13: TransactionScope

		public TransactionScope (TransactionScopeOption scopeOption,
			TransactionOptions options,
			DTCOption opt)
		{
			Initialize (scopeOption, null, options, opt,
				TransactionManager.DefaultTimeout);
		}
开发者ID:Profit0004,项目名称:mono,代码行数:7,代码来源:TransactionScope.cs

示例14: CreateTransactionScopeWithNoLock

        public static TransactionScope CreateTransactionScopeWithNoLock(TransactionScopeOption option)
        {
            TransactionOptions options = new TransactionOptions();
            options.IsolationLevel = IsolationLevel.ReadUncommitted;

            return new TransactionScope(option, options);
        }
开发者ID:lzhaofu,项目名称:OSS,代码行数:7,代码来源:TransactionUtilities.cs

示例15: Acquire

 public static TransactionScope Acquire(TransactionScopeOption scope,
     IsolationLevel isolationLevel, TimeSpan timeout,
     TransactionScopeAsyncFlowOption asyncFlowOption)
 {
     TransactionOptions options = new TransactionOptions {IsolationLevel = isolationLevel, Timeout = timeout};
     TransactionScope result = new TransactionScope(scope, options, asyncFlowOption);
     return result;
 }
开发者ID:yaoyel,项目名称:Finework,代码行数:8,代码来源:TxManager.cs


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