Removes more unecessary singletons and simplifies/refactors some internal parts like the ctors for the ServiceContext, DatabaseContext. No more RepositoryResolver or SqlSyntaxProvidersResolver these are entirely uncessary and complicate things.
This commit is contained in:
@@ -2,9 +2,11 @@
|
||||
using System.Diagnostics;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Cache;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Logging;
|
||||
using Umbraco.Core.Persistence;
|
||||
using Umbraco.Core.Persistence.Mappers;
|
||||
using Umbraco.Core.Persistence.SqlSyntax;
|
||||
using Umbraco.Core.Persistence.UnitOfWork;
|
||||
using Umbraco.Core.Publishing;
|
||||
using Umbraco.Core.Services;
|
||||
@@ -18,14 +20,16 @@ namespace Umbraco.Web.Standalone
|
||||
private readonly string _connectionString;
|
||||
private readonly string _providerName;
|
||||
private readonly ILogger _logger;
|
||||
private readonly ISqlSyntaxProvider _syntaxProvider;
|
||||
private ServiceContext _serviceContext;
|
||||
private readonly StandaloneApplication _application;
|
||||
|
||||
public ServiceContextManager(string connectionString, string providerName, string baseDirectory, ILogger logger)
|
||||
public ServiceContextManager(string connectionString, string providerName, string baseDirectory, ILogger logger, ISqlSyntaxProvider syntaxProvider)
|
||||
{
|
||||
_connectionString = connectionString;
|
||||
_providerName = providerName;
|
||||
_logger = logger;
|
||||
_syntaxProvider = syntaxProvider;
|
||||
|
||||
Trace.WriteLine("Current AppDomain: " + AppDomain.CurrentDomain.FriendlyName);
|
||||
Trace.WriteLine("Current AppDomain: " + AppDomain.CurrentDomain.BaseDirectory);
|
||||
@@ -50,9 +54,10 @@ namespace Umbraco.Web.Standalone
|
||||
new NullCacheProvider());
|
||||
|
||||
var dbFactory = new DefaultDatabaseFactory(_connectionString, _providerName, _logger);
|
||||
var dbContext = new DatabaseContext(dbFactory, _logger);
|
||||
var dbContext = new DatabaseContext(dbFactory, _logger, _syntaxProvider, _providerName);
|
||||
Database.Mapper = new PetaPocoMapper();
|
||||
_serviceContext = new ServiceContext(
|
||||
new RepositoryFactory(cacheHelper, _logger, dbContext.SqlSyntax, UmbracoConfig.For.UmbracoSettings()),
|
||||
new PetaPocoUnitOfWorkProvider(dbFactory),
|
||||
new FileUnitOfWorkProvider(),
|
||||
new PublishingStrategy(),
|
||||
|
||||
Reference in New Issue
Block a user