From a54d2a5d0d310fd7e44d2ab6a85ec5d7776f570f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zolt=C3=A1n=20M=C3=A1t=C3=A9?= Date: Sat, 11 Feb 2023 18:20:14 +0100 Subject: [PATCH 1/2] Adding MigrationServiceCollectionExtensions so we don't have to upgrade to nightly version --- .../MigrationServiceCollectionExtensions.cs | 16 ++++++++++++++++ Lombiq.BaseTheme/Startup.cs | 2 +- 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 Lombiq.BaseTheme/Extensions/MigrationServiceCollectionExtensions.cs diff --git a/Lombiq.BaseTheme/Extensions/MigrationServiceCollectionExtensions.cs b/Lombiq.BaseTheme/Extensions/MigrationServiceCollectionExtensions.cs new file mode 100644 index 0000000..4023c91 --- /dev/null +++ b/Lombiq.BaseTheme/Extensions/MigrationServiceCollectionExtensions.cs @@ -0,0 +1,16 @@ +using Microsoft.Extensions.DependencyInjection; +using OrchardCore.Data.Migration; + +namespace Lombiq.BaseTheme.Extensions; + +/// We need to use this until the Orchard Core 1.6 upgrade so we don't have to upgrade submodules to +/// to nightly versions. This is the same method as what is in the 1.6 nightly version of Orchard Core. +/// During the upgrade, this can be removed and use the Orchard Core method for data migrations. +/// +/// Provides extension methods for to add YesSql migration . +/// +public static class MigrationServiceCollectionExtensions +{ + public static IServiceCollection AddDataMigration(this IServiceCollection services) + where TDataMigration : class, IDataMigration => services.AddScoped(); +} diff --git a/Lombiq.BaseTheme/Startup.cs b/Lombiq.BaseTheme/Startup.cs index 47326de..d48a1be 100644 --- a/Lombiq.BaseTheme/Startup.cs +++ b/Lombiq.BaseTheme/Startup.cs @@ -1,3 +1,4 @@ +using Lombiq.BaseTheme.Extensions; using Lombiq.BaseTheme.Middlewares; using Lombiq.BaseTheme.Migrations; using Lombiq.BaseTheme.Services; @@ -8,7 +9,6 @@ using Microsoft.AspNetCore.Routing; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Options; -using OrchardCore.Data.Migration; using OrchardCore.Modules; using OrchardCore.ResourceManagement; using System; From a687f013ffdbe450880ae2491c0fd1e2bc925912 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zolt=C3=A1n=20Leh=C3=B3czky?= Date: Mon, 20 Feb 2023 18:34:05 +0100 Subject: [PATCH 2/2] Code styling --- .../Extensions/MigrationServiceCollectionExtensions.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Lombiq.BaseTheme/Extensions/MigrationServiceCollectionExtensions.cs b/Lombiq.BaseTheme/Extensions/MigrationServiceCollectionExtensions.cs index 4023c91..8f450d9 100644 --- a/Lombiq.BaseTheme/Extensions/MigrationServiceCollectionExtensions.cs +++ b/Lombiq.BaseTheme/Extensions/MigrationServiceCollectionExtensions.cs @@ -3,9 +3,10 @@ namespace Lombiq.BaseTheme.Extensions; -/// We need to use this until the Orchard Core 1.6 upgrade so we don't have to upgrade submodules to -/// to nightly versions. This is the same method as what is in the 1.6 nightly version of Orchard Core. -/// During the upgrade, this can be removed and use the Orchard Core method for data migrations. +// We need to use this until the Orchard Core upgrade so we don't have to upgrade submodules to nightly versions. This +// is the same method as what is in the 1.6 nightly version of Orchard Core. During the upgrade, this can be removed and +// use the Orchard Core method for data migrations. + /// /// Provides extension methods for to add YesSql migration . ///