This commit is contained in:
Stephan
2017-07-11 19:41:28 +02:00
parent 291b4364c3
commit f668c25346
3 changed files with 5 additions and 12 deletions

View File

@@ -10,17 +10,13 @@ namespace Umbraco.Core.Persistence
{
public SqlContext(ISqlSyntaxProvider sqlSyntax, IPocoDataFactory pocoDataFactory, DatabaseType databaseType, IMapperCollection mappers = null)
{
if (sqlSyntax == null) throw new ArgumentNullException(nameof(sqlSyntax));
if (pocoDataFactory == null) throw new ArgumentNullException(nameof(pocoDataFactory));
if (databaseType == null) throw new ArgumentNullException(nameof(databaseType));
// for tests
if (mappers == null) mappers = new Mappers.MapperCollection(Enumerable.Empty<BaseMapper>());
SqlSyntax = sqlSyntax;
PocoDataFactory = pocoDataFactory;
DatabaseType = databaseType;
Mappers = mappers;
SqlSyntax = sqlSyntax ?? throw new ArgumentNullException(nameof(sqlSyntax));
PocoDataFactory = pocoDataFactory ?? throw new ArgumentNullException(nameof(pocoDataFactory));
DatabaseType = databaseType ?? throw new ArgumentNullException(nameof(databaseType));
}
public ISqlSyntaxProvider SqlSyntax { get; }

View File

@@ -192,7 +192,7 @@ namespace Umbraco.Core.Persistence
// these are created here because it is the UmbracoDatabaseFactory that determines
// the sql syntax, poco data factory, and database type - so it "owns" the context
// and the query factory
_sqlContext = new SqlContext(_sqlSyntax, _pocoDataFactory, _databaseType, _mappers);
_sqlContext = new SqlContext(_sqlSyntax, _pocoDataFactory, _databaseType, _mappers);
_logger.Debug<UmbracoDatabaseFactory>("Configured.");
Configured = true;

View File

@@ -80,9 +80,6 @@ namespace Umbraco.Core.Scoping
// and we can retrieve the actual objects from the table.
// only issue: how are we supposed to clear the table? we can't, really. objects should take
// care of de-registering themselves from context.
// everything we use does, except the NoScope scope, which just stays there
//
// during tests, NoScope can to into call context... nothing much we can do about it
private static readonly object StaticCallContextObjectsLock = new object();
private static readonly Dictionary<Guid, object> StaticCallContextObjects