post merge fixes

This commit is contained in:
Bjarke Berg
2021-06-30 06:59:47 +02:00
parent 9e4dead0f5
commit f1b91ab35d
17 changed files with 49 additions and 31 deletions

View File

@@ -34,7 +34,6 @@ namespace Umbraco.Cms.Core.DependencyInjection
builder.CacheRefreshers().Add(() => builder.TypeLoader.GetCacheRefreshers());
builder.DataEditors().Add(() => builder.TypeLoader.GetDataEditors());
builder.Actions().Add(() => builder.TypeLoader.GetActions());
builder.PackageMigrationPlans().Add(() => builder.TypeLoader.GetPackageMigrationPlans());
// register known content apps
builder.ContentApps()
@@ -120,13 +119,6 @@ namespace Umbraco.Cms.Core.DependencyInjection
builder.BackOfficeAssets();
}
/// <summary>
/// Gets the package migration plans collection builder.
/// </summary>
/// <param name="builder">The builder.</param>
public static PackageMigrationPlanCollectionBuilder PackageMigrationPlans(this IUmbracoBuilder builder)
=> builder.WithCollectionBuilder<PackageMigrationPlanCollectionBuilder>();
/// <summary>
/// Gets the actions collection builder.
/// </summary>

View File

@@ -1,4 +1,4 @@
// Copyright (c) Umbraco.
// Copyright (c) Umbraco.
// See LICENSE for more details.
using System;
@@ -23,13 +23,6 @@ namespace Umbraco.Extensions
/// </summary>
public static IEnumerable<Type> GetCacheRefreshers(this TypeLoader mgr) => mgr.GetTypes<ICacheRefresher>();
/// <summary>
/// Gets all types implementing <see cref="PackageMigrationPlan"/>
/// </summary>
/// <param name="mgr"></param>
/// <returns></returns>
public static IEnumerable<Type> GetPackageMigrationPlans(this TypeLoader mgr) => mgr.GetTypes<PackageMigrationPlan>();
/// <summary>
/// Gets all types implementing <see cref="IAction"/>
/// </summary>

View File

@@ -1,8 +1,9 @@
using Umbraco.Cms.Core.DependencyInjection;
using Umbraco.Cms.Core.Packaging;
using Umbraco.Cms.Infrastructure.Persistence;
using Umbraco.Cms.Infrastructure.Persistence.Mappers;
namespace Umbraco.Cms.Infrastructure.DependencyInjection
namespace Umbraco.Extensions
{
/// <summary>
/// Provides extension methods to the <see cref="IUmbracoBuilder"/> class.
@@ -18,5 +19,14 @@ namespace Umbraco.Cms.Infrastructure.DependencyInjection
public static NPocoMapperCollectionBuilder NPocoMappers(this IUmbracoBuilder builder)
=> builder.WithCollectionBuilder<NPocoMapperCollectionBuilder>();
/// <summary>
/// Gets the package migration plans collection builder.
/// </summary>
/// <param name="builder">The builder.</param>
public static PackageMigrationPlanCollectionBuilder PackageMigrationPlans(this IUmbracoBuilder builder)
=> builder.WithCollectionBuilder<PackageMigrationPlanCollectionBuilder>();
}
}

View File

@@ -70,6 +70,7 @@ namespace Umbraco.Cms.Infrastructure.DependencyInjection
builder.Services.AddUnique(factory => factory.GetRequiredService<IUmbracoDatabaseFactory>().CreateDatabase());
builder.Services.AddUnique(factory => factory.GetRequiredService<IUmbracoDatabaseFactory>().SqlContext);
builder.NPocoMappers().Add<NullableDateMapper>();
builder.PackageMigrationPlans().Add(() => builder.TypeLoader.GetPackageMigrationPlans());
builder.Services.AddUnique<IRuntimeState, RuntimeState>();
builder.Services.AddUnique<IRuntime, CoreRuntime>();

View File

@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using Umbraco.Cms.Core.Composing;
using Umbraco.Cms.Core.Packaging;
namespace Umbraco.Extensions
{
public static class InfrastuctureTypeLoaderExtensions
{
/// <summary>
/// Gets all types implementing <see cref="PackageMigrationPlan"/>
/// </summary>
/// <param name="mgr"></param>
/// <returns></returns>
public static IEnumerable<Type> GetPackageMigrationPlans(this TypeLoader mgr) => mgr.GetTypes<PackageMigrationPlan>();
}
}

View File

@@ -1,3 +1,5 @@
using Umbraco.Cms.Infrastructure.Migrations;
namespace Umbraco.Cms.Core.Migrations
{
public interface IMigrationPlanExecutor

View File

@@ -1,7 +1,7 @@
using System;
using System;
using System.Collections.Generic;
namespace Umbraco.Cms.Core.Migrations
namespace Umbraco.Cms.Infrastructure.Migrations
{
/// <summary>
/// Represents a migration plan builder for merges.

View File

@@ -1,6 +1,7 @@
using System;
using System;
using System.Collections.Generic;
using Microsoft.Extensions.Logging;
using Umbraco.Cms.Core.Migrations;
using Umbraco.Cms.Infrastructure.Persistence;
namespace Umbraco.Cms.Infrastructure.Migrations

View File

@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Extensions.Logging;
@@ -6,7 +6,7 @@ using Umbraco.Cms.Core.Scoping;
using Umbraco.Extensions;
using Type = System.Type;
namespace Umbraco.Cms.Core.Migrations
namespace Umbraco.Cms.Infrastructure.Migrations
{
/// <summary>
@@ -114,7 +114,7 @@ namespace Umbraco.Cms.Core.Migrations
=> To(targetState, typeof(TMigration));
public MigrationPlan To<TMigration>(Guid targetState)
where TMigration : IMigration
where TMigration : MigrationBase
=> To(targetState, typeof(TMigration));
/// <summary>

View File

@@ -58,7 +58,7 @@ namespace Umbraco.Cms.Infrastructure.Migrations
_logger.LogInformation("Execute {MigrationType}", transition.MigrationType.Name);
var migration = _migrationBuilder.Build(transition.MigrationType, context);
migration.Migrate();
migration.Run();
var nextState = transition.TargetState;
origState = nextState;
@@ -84,7 +84,7 @@ namespace Umbraco.Cms.Infrastructure.Migrations
{
_logger.LogInformation($"PostMigration: {postMigrationType.FullName}.");
var postMigration = _migrationBuilder.Build(postMigrationType, context);
postMigration.Migrate();
postMigration.Run();
}
}

View File

@@ -25,7 +25,7 @@ namespace Umbraco.Cms.Infrastructure.Packaging
protected sealed override void DefinePlan()
{
// calculate the final state based on the hash value of the embedded resource
// calculate the final state based on the hash value of the embedded resource
var finalId = PackageDataManifest.ToString(SaveOptions.DisableFormatting).ToGuid();
To<MigrateToPackageData>(finalId);
}
@@ -55,7 +55,7 @@ namespace Umbraco.Cms.Infrastructure.Packaging
{
}
public override void Migrate()
protected override void Migrate()
{
var plan = (AutomaticPackageMigrationPlan)Context.Plan;
XDocument xml = plan.PackageDataManifest;

View File

@@ -1,7 +1,6 @@
using System;
using Umbraco.Cms.Core.Composing;
using Umbraco.Cms.Core.Migrations;
using Umbraco.Extensions;
using Umbraco.Cms.Infrastructure.Migrations;
namespace Umbraco.Cms.Core.Packaging
{

View File

@@ -12,6 +12,7 @@ using Umbraco.Cms.Infrastructure.Migrations;
using Umbraco.Cms.Infrastructure.Packaging;
using Umbraco.Cms.Tests.Common.Testing;
using Umbraco.Cms.Tests.Integration.Testing;
using Umbraco.Extensions;
namespace Umbraco.Cms.Tests.Integration.Umbraco.Core
{
@@ -93,7 +94,7 @@ namespace Umbraco.Cms.Tests.Integration.Umbraco.Core
{
}
public override void Migrate()
protected override void Migrate()
{
ImportPackage.FromEmbeddedResource<TestMigration>().Do();
}

View File

@@ -1,4 +1,4 @@
// Copyright (c) Umbraco.
// Copyright (c) Umbraco.
// See LICENSE for more details.
using System;
@@ -9,6 +9,7 @@ using Moq;
using NPoco;
using NUnit.Framework;
using Umbraco.Cms.Core.Configuration.Models;
using Umbraco.Cms.Core.Migrations;
using Umbraco.Cms.Core.Scoping;
using Umbraco.Cms.Core.Services;
using Umbraco.Cms.Infrastructure.Migrations;