Reducing the usage of the DatabaseFactory
This commit is contained in:
@@ -16,7 +16,7 @@ namespace Umbraco.Core.Auditing
|
||||
/// <param name="comment">Audit comment</param>
|
||||
public void WriteEntry(int objectId, int userId, DateTime date, string header, string comment)
|
||||
{
|
||||
DatabaseFactory.Current.Database.Insert(new LogDto
|
||||
DatabaseContext.Current.Database.Insert(new LogDto
|
||||
{
|
||||
Comment = comment,
|
||||
Datestamp = date,
|
||||
|
||||
@@ -6,8 +6,12 @@ namespace Umbraco.Core.Persistence
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides access to the PetaPoco database as Singleton, so the database is created once in app lifetime.
|
||||
/// This is necessary for transactions to work properly
|
||||
/// This is necessary for transactions to work properly.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Because the Database is created static, the configuration has to be checked and set in
|
||||
/// another class, which is where the DatabaseContext comes in.
|
||||
/// </remarks>
|
||||
public sealed class DatabaseFactory
|
||||
{
|
||||
#region Singleton
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace Umbraco.Core.Persistence.Repositories
|
||||
|
||||
protected Database Database
|
||||
{
|
||||
get { return DatabaseFactory.Current.Database; }
|
||||
get { return DatabaseContext.Current.Database; }
|
||||
}
|
||||
|
||||
#region Abstract Methods
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace Umbraco.Core.Services
|
||||
if(HttpRuntime.Cache[cacheKey] == null)
|
||||
{
|
||||
userId =
|
||||
DatabaseFactory.Current.Database.ExecuteScalar<int>(
|
||||
DatabaseContext.Current.Database.ExecuteScalar<int>(
|
||||
"select userID from umbracoUserLogins where contextID = @ContextId",
|
||||
new {ContextId = new Guid(contextId)});
|
||||
|
||||
|
||||
@@ -112,7 +112,7 @@ namespace Umbraco.Tests.CodeFirst.Definitions
|
||||
Value = value
|
||||
};
|
||||
|
||||
DatabaseFactory.Current.Database.Insert(poco);
|
||||
DatabaseContext.Current.Database.Insert(poco);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user