U4-9322 - more fixes
This commit is contained in:
@@ -90,6 +90,7 @@ namespace Umbraco.Core.Scoping
|
||||
var database = ParentScope.Database;
|
||||
if (_isolationLevel > IsolationLevel.Unspecified && database.CurrentTransactionIsolationLevel < _isolationLevel)
|
||||
throw new Exception("Scope requires isolation level " + _isolationLevel + ", but got " + database.CurrentTransactionIsolationLevel + " from parent.");
|
||||
_database = database;
|
||||
}
|
||||
|
||||
if (_database != null)
|
||||
|
||||
@@ -64,7 +64,9 @@ namespace Umbraco.Core
|
||||
// after Umbraco has started there is a scope in "context" and that context is
|
||||
// going to stay there and never get destroyed nor reused, so we have to ensure that
|
||||
// the scope is disposed (along with database etc) - reset it all entirely
|
||||
((ScopeProvider) ApplicationContext.Current.ScopeProvider).Reset();
|
||||
var scopeProvider = ApplicationContext.Current.ScopeProvider as ScopeProvider;
|
||||
if (scopeProvider != null) // can be mocked...
|
||||
scopeProvider.Reset();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -295,7 +295,7 @@ namespace Umbraco.Tests.Scoping
|
||||
using (var nested = scopeProvider.CreateScope())
|
||||
{
|
||||
nested.Database.Execute("INSERT INTO tmp (id, name) VALUES (2, 'b')");
|
||||
var nn = scope.Database.ExecuteScalar<string>("SELECT name FROM tmp WHERE id=2");
|
||||
var nn = nested.Database.ExecuteScalar<string>("SELECT name FROM tmp WHERE id=2");
|
||||
Assert.AreEqual("b", nn);
|
||||
}
|
||||
|
||||
@@ -331,7 +331,7 @@ namespace Umbraco.Tests.Scoping
|
||||
using (var nested = scopeProvider.CreateScope())
|
||||
{
|
||||
nested.Database.Execute("INSERT INTO tmp (id, name) VALUES (2, 'b')");
|
||||
var nn = scope.Database.ExecuteScalar<string>("SELECT name FROM tmp WHERE id=2");
|
||||
var nn = nested.Database.ExecuteScalar<string>("SELECT name FROM tmp WHERE id=2");
|
||||
Assert.AreEqual("b", nn);
|
||||
nested.Complete();
|
||||
}
|
||||
@@ -366,7 +366,7 @@ namespace Umbraco.Tests.Scoping
|
||||
using (var nested = scopeProvider.CreateScope())
|
||||
{
|
||||
nested.Database.Execute("INSERT INTO tmp (id, name) VALUES (2, 'b')");
|
||||
var nn = scope.Database.ExecuteScalar<string>("SELECT name FROM tmp WHERE id=2");
|
||||
var nn = nested.Database.ExecuteScalar<string>("SELECT name FROM tmp WHERE id=2");
|
||||
Assert.AreEqual("b", nn);
|
||||
nested.Complete();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user