diff --git a/src/Umbraco.Core/DatabaseContext.cs b/src/Umbraco.Core/DatabaseContext.cs
index c705be17bc..34ab126d2b 100644
--- a/src/Umbraco.Core/DatabaseContext.cs
+++ b/src/Umbraco.Core/DatabaseContext.cs
@@ -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;
}
diff --git a/src/Umbraco.Core/Persistence/IDatabaseFactory.cs b/src/Umbraco.Core/Persistence/IDatabaseFactory.cs
index 3a80739ec7..8def46b0fb 100644
--- a/src/Umbraco.Core/Persistence/IDatabaseFactory.cs
+++ b/src/Umbraco.Core/Persistence/IDatabaseFactory.cs
@@ -1,19 +1,30 @@
using System;
+using System.ComponentModel;
namespace Umbraco.Core.Persistence
{
- ///
- /// Used to create the UmbracoDatabase for use in the DatabaseContext
- ///
+ [Obsolete("Use IDatabaseFactory2 instead")]
+ [EditorBrowsable(EditorBrowsableState.Never)]
public interface IDatabaseFactory : IDisposable
{
- // gets or creates the ambient database
+ ///
+ /// gets or creates the ambient database
+ ///
+ ///
UmbracoDatabase CreateDatabase();
}
+ ///
+ /// Used to create the UmbracoDatabase for use in the DatabaseContext
+ ///
+#pragma warning disable 618
public interface IDatabaseFactory2 : IDatabaseFactory
+#pragma warning restore 618
{
- // creates a new database
+ ///
+ /// creates a new database
+ ///
+ ///
UmbracoDatabase CreateNewDatabase();
}
}
\ No newline at end of file