You've already forked linux-packaging-mono
Imported Upstream version 6.6.0.89
Former-commit-id: b39a328747c2f3414dc52e009fb6f0aa80ca2492
This commit is contained in:
parent
cf815e07e0
commit
95fdb59ea6
@@ -31,12 +31,14 @@ namespace System.Transactions
|
||||
}
|
||||
|
||||
public CommittableTransaction (TimeSpan timeout)
|
||||
: base (IsolationLevel.Serializable)
|
||||
{
|
||||
options = new TransactionOptions ();
|
||||
options.Timeout = timeout;
|
||||
}
|
||||
|
||||
public CommittableTransaction (TransactionOptions options)
|
||||
: base (options.IsolationLevel)
|
||||
{
|
||||
this.options = options;
|
||||
}
|
||||
|
@@ -21,6 +21,7 @@ namespace System.Transactions
|
||||
|
||||
internal DependentTransaction (Transaction parent,
|
||||
DependentCloneOption option)
|
||||
: base(parent.IsolationLevel)
|
||||
{
|
||||
// this.parent = parent;
|
||||
// this.option = option;
|
||||
|
@@ -16,6 +16,7 @@ namespace System.Transactions
|
||||
{
|
||||
public SubordinateTransaction (IsolationLevel isoLevel,
|
||||
ISimpleTransactionSuperior superior)
|
||||
: base (isoLevel)
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
|
@@ -69,10 +69,10 @@ namespace System.Transactions
|
||||
|
||||
internal IPromotableSinglePhaseNotification Pspe { get { return pspe; } }
|
||||
|
||||
internal Transaction ()
|
||||
internal Transaction (IsolationLevel isolationLevel)
|
||||
{
|
||||
info = new TransactionInformation ();
|
||||
level = IsolationLevel.Serializable;
|
||||
level = isolationLevel;
|
||||
}
|
||||
|
||||
internal Transaction (Transaction other)
|
||||
|
@@ -138,14 +138,14 @@ namespace System.Transactions
|
||||
|
||||
oldTransaction = Transaction.CurrentInternal;
|
||||
|
||||
Transaction.CurrentInternal = transaction = InitTransaction (tx, scopeOption);
|
||||
Transaction.CurrentInternal = transaction = InitTransaction (tx, scopeOption, options);
|
||||
if (transaction != null)
|
||||
transaction.InitScope (this);
|
||||
if (parentScope != null)
|
||||
parentScope.nested ++;
|
||||
}
|
||||
|
||||
Transaction InitTransaction (Transaction tx, TransactionScopeOption scopeOption)
|
||||
Transaction InitTransaction (Transaction tx, TransactionScopeOption scopeOption, TransactionOptions options)
|
||||
{
|
||||
if (tx != null)
|
||||
return tx;
|
||||
@@ -159,7 +159,7 @@ namespace System.Transactions
|
||||
if (scopeOption == TransactionScopeOption.Required) {
|
||||
if (Transaction.CurrentInternal == null) {
|
||||
isRoot = true;
|
||||
return new Transaction ();
|
||||
return new Transaction (options.IsolationLevel);
|
||||
}
|
||||
|
||||
parentScope = Transaction.CurrentInternal.Scope;
|
||||
@@ -170,8 +170,8 @@ namespace System.Transactions
|
||||
if (Transaction.CurrentInternal != null)
|
||||
parentScope = Transaction.CurrentInternal.Scope;
|
||||
isRoot = true;
|
||||
return new Transaction ();
|
||||
}
|
||||
return new Transaction (options.IsolationLevel);
|
||||
}
|
||||
|
||||
public void Complete ()
|
||||
{
|
||||
|
@@ -1094,6 +1094,26 @@ namespace MonoTests.System.Transactions
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
[Test]
|
||||
public void DefaultIsolationLevel()
|
||||
{
|
||||
using (TransactionScope transactionScope = new TransactionScope(TransactionScopeOption.Required))
|
||||
{
|
||||
Assert.AreEqual(IsolationLevel.Serializable, Transaction.Current.IsolationLevel);
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ExplicitIsolationLevel()
|
||||
{
|
||||
TransactionOptions transactionOptions = new TransactionOptions();
|
||||
transactionOptions.IsolationLevel = IsolationLevel.ReadCommitted;
|
||||
using (TransactionScope transactionScope = new TransactionScope(TransactionScopeOption.Required, transactionOptions))
|
||||
{
|
||||
Assert.AreEqual(IsolationLevel.ReadCommitted, Transaction.Current.IsolationLevel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user