Some adjustments for U4-9477

This commit is contained in:
Shannon
2017-02-07 13:36:32 +11:00
parent 145ca54dcf
commit e7e6ad6d0b
2 changed files with 27 additions and 7 deletions

View File

@@ -76,7 +76,11 @@ namespace Umbraco.Core
if (logger == null) throw new ArgumentNullException("logger");
if (syntaxProviders == null) throw new ArgumentNullException("syntaxProviders");
ScopeProvider = new ScopeProvider(new DatabaseFactoryWrapper(factory));
var asDbFactory2 = factory as IDatabaseFactory2;
ScopeProvider = asDbFactory2 == null
? new ScopeProvider(new DatabaseFactoryWrapper(factory))
: new ScopeProvider(asDbFactory2);
_logger = logger;
_syntaxProviders = syntaxProviders;
}
@@ -93,7 +97,12 @@ namespace Umbraco.Core
_providerName = providerName;
SqlSyntax = sqlSyntax;
SqlSyntaxContext.SqlSyntaxProvider = SqlSyntax;
ScopeProvider = new ScopeProvider(new DatabaseFactoryWrapper(factory));
var asDbFactory2 = factory as IDatabaseFactory2;
ScopeProvider = asDbFactory2 == null
? new ScopeProvider(new DatabaseFactoryWrapper(factory))
: new ScopeProvider(asDbFactory2);
_logger = logger;
_configured = true;
}

View File

@@ -1,19 +1,30 @@
using System;
using System.ComponentModel;
namespace Umbraco.Core.Persistence
{
/// <summary>
/// Used to create the UmbracoDatabase for use in the DatabaseContext
/// </summary>
[Obsolete("Use IDatabaseFactory2 instead")]
[EditorBrowsable(EditorBrowsableState.Never)]
public interface IDatabaseFactory : IDisposable
{
// gets or creates the ambient database
/// <summary>
/// gets or creates the ambient database
/// </summary>
/// <returns></returns>
UmbracoDatabase CreateDatabase();
}
/// <summary>
/// Used to create the UmbracoDatabase for use in the DatabaseContext
/// </summary>
#pragma warning disable 618
public interface IDatabaseFactory2 : IDatabaseFactory
#pragma warning restore 618
{
// creates a new database
/// <summary>
/// creates a new database
/// </summary>
/// <returns></returns>
UmbracoDatabase CreateNewDatabase();
}
}