本文整理汇总了C#中TransactionScopeOption类的典型用法代码示例。如果您正苦于以下问题:C# TransactionScopeOption类的具体用法?C# TransactionScopeOption怎么用?C# TransactionScopeOption使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TransactionScopeOption类属于命名空间,在下文中一共展示了TransactionScopeOption类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: CreateTransactionScope
public static TransactionScope CreateTransactionScope(TransactionScopeOption scopeOpion, IsolationLevel level)
{
if (Transaction.Current != null)
{
level = Transaction.Current.IsolationLevel;
}
return new TransactionScope(scopeOpion, new TransactionOptions { IsolationLevel = level });
}
开发者ID:jeanmahai,项目名称:PublicTools,代码行数:8,代码来源:TransactionScopeFactory.cs
示例17: CustomSqlPersistenceFactory
public CustomSqlPersistenceFactory(IConnectionFactory factory, ISerialize serializer, ISqlDialect dialect, TransactionScopeOption scopeOption, int pageSize) : base(factory, serializer, dialect, scopeOption, pageSize)
{
this.factory = factory;
this.serializer = serializer;
this.dialect = dialect;
this.scopeOption = scopeOption;
this.pageSize = pageSize;
}
开发者ID:raghur,项目名称:Eventstore.Utils,代码行数:8,代码来源:CustomSqlPersistenceFactory.cs
示例18: DbTransactionScope
/// <summary>
/// Initializes a new instance of the <see cref="DbTransactionScope"/> class.
/// </summary>
/// <param name="scopeOption">
/// An instance of the System.Transactions.TransactionScopeOption enumeration
/// that describes the transaction requirements associated with this transaction
/// scope.
/// </param>
public DbTransactionScope(TransactionScopeOption scopeOption)
{
if (Log.Enabled) Log.Entry("DbTransactionScope", Transaction.Current);
m_scope = new TransactionScope(scopeOption);
Initialize();
if (Log.Enabled) Log.Exit("DbTransactionScope", Transaction.Current);
}
开发者ID:Yitzchok,项目名称:PublicDomain,代码行数:17,代码来源:DbTransactionScope.cs
示例19: PostgreSqlDbTransaction
public PostgreSqlDbTransaction(IsolationLevel isolationLevel,
TimeSpan? timeout,
Func<IDbConnection> connectionFactory,
TransactionScopeOption transactionScopeOption = TransactionScopeOption.Required,
TransactionScopeAsyncFlowOption transactionScopeAsyncFlowOption = TransactionScopeAsyncFlowOption.Enabled) :
base(isolationLevel, timeout, connectionFactory, transactionScopeOption, transactionScopeAsyncFlowOption)
{
_isolationLevel = isolationLevel;
}
开发者ID:mantasaudickas,项目名称:fat-queue,代码行数:9,代码来源:PostgreSqlDbTransaction.cs
示例20: CreateTransactionScope
/// <summary>
/// 새로운 TransactionScope 를 생성한다.
/// </summary>
/// <param name="scopeOption">TransactionScopeOption 값</param>
/// <param name="isolationLevel">Transaction 격리수준</param>
/// <returns>Instance of new <see cref="System.Transactions.TransactionScope"/></returns>
/// <example>
/// <code>
/// using(TransactionScope txScope = AdoTool.CreateTransactionScope(TransactionScopeOption.Required, System.Transactions.IsolationLevel.ReadCommitted))
/// {
/// // database operations...
///
/// txScope.Commit();
/// }
/// </code>
/// </example>
public static TransactionScope CreateTransactionScope(TransactionScopeOption scopeOption = TransactionScopeOption.Required,
IsolationLevel isolationLevel = IsolationLevel.ReadCommitted) {
if(IsDebugEnabled)
log.Debug("새로운 TransactionScope를 생성합니다... TransactionScopeOption=[{0}], IsolationLevel=[{1}]", scopeOption,
isolationLevel);
var txOptions = new TransactionOptions { IsolationLevel = isolationLevel };
return new TransactionScope(scopeOption, txOptions);
}
开发者ID:debop,项目名称:NFramework,代码行数:25,代码来源:AdoTool.Transactions.cs
注:本文中的TransactionScopeOption类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论