Creating the service interfaces and their implementations. Registering them in CoreInitialComposer. These services delegate the work to repositories
This commit is contained in:
@@ -18,6 +18,7 @@ using Umbraco.Core.PropertyEditors;
|
||||
using Umbraco.Core.PropertyEditors.Validators;
|
||||
using Umbraco.Core.Scoping;
|
||||
using Umbraco.Core.Services;
|
||||
using Umbraco.Core.Services.Implement;
|
||||
using Umbraco.Core.Strings;
|
||||
using Umbraco.Core.Sync;
|
||||
using IntegerValidator = Umbraco.Core.PropertyEditors.Validators.IntegerValidator;
|
||||
@@ -129,6 +130,10 @@ namespace Umbraco.Core.Runtime
|
||||
|
||||
// by default, register a noop rebuilder
|
||||
composition.RegisterUnique<IPublishedSnapshotRebuilder, PublishedSnapshotRebuilder>();
|
||||
|
||||
// will be injected in controllers when needed to invoke rest endpoints on Our
|
||||
composition.RegisterUnique<IInstallationService, InstallationService>();
|
||||
composition.RegisterUnique<IUpgradeService, UpgradeService>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
10
src/Umbraco.Core/Services/IInstallationService.cs
Normal file
10
src/Umbraco.Core/Services/IInstallationService.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
using System.Threading.Tasks;
|
||||
using Umbraco.Core.Models;
|
||||
|
||||
namespace Umbraco.Core.Services
|
||||
{
|
||||
public interface IInstallationService
|
||||
{
|
||||
Task Install(InstallLog installLog);
|
||||
}
|
||||
}
|
||||
11
src/Umbraco.Core/Services/IUpgradeService.cs
Normal file
11
src/Umbraco.Core/Services/IUpgradeService.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
using System.Threading.Tasks;
|
||||
using Semver;
|
||||
using Umbraco.Core.Models;
|
||||
|
||||
namespace Umbraco.Core.Services
|
||||
{
|
||||
public interface IUpgradeService
|
||||
{
|
||||
Task<UpgradeResult> CheckUpgrade(SemVersion version);
|
||||
}
|
||||
}
|
||||
21
src/Umbraco.Core/Services/Implement/InstallationService.cs
Normal file
21
src/Umbraco.Core/Services/Implement/InstallationService.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using System.Threading.Tasks;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Core.Persistence.Repositories;
|
||||
|
||||
namespace Umbraco.Core.Services.Implement
|
||||
{
|
||||
public class InstallationService : IInstallationService
|
||||
{
|
||||
private readonly IInstallationRepository _installationRepository;
|
||||
|
||||
public InstallationService(IInstallationRepository installationRepository)
|
||||
{
|
||||
_installationRepository = installationRepository;
|
||||
}
|
||||
|
||||
public async Task Install(InstallLog installLog)
|
||||
{
|
||||
await _installationRepository.SaveInstall(installLog);
|
||||
}
|
||||
}
|
||||
}
|
||||
23
src/Umbraco.Core/UpgradeService.cs
Normal file
23
src/Umbraco.Core/UpgradeService.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using System.Threading.Tasks;
|
||||
using Semver;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Core.Persistence.Repositories;
|
||||
using Umbraco.Core.Services;
|
||||
|
||||
namespace Umbraco.Core
|
||||
{
|
||||
internal class UpgradeService : IUpgradeService
|
||||
{
|
||||
private readonly IUpgradeCheckRepository _upgradeCheckRepository;
|
||||
|
||||
public UpgradeService(IUpgradeCheckRepository upgradeCheckRepository)
|
||||
{
|
||||
_upgradeCheckRepository = upgradeCheckRepository;
|
||||
}
|
||||
|
||||
public async Task<UpgradeResult> CheckUpgrade(SemVersion version)
|
||||
{
|
||||
return await _upgradeCheckRepository.CheckUpgrade(version);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user