diff --git a/src/OrchardCore.Modules/OrchardCore.AdminMenu/Startup.cs b/src/OrchardCore.Modules/OrchardCore.AdminMenu/Startup.cs index fa7db0ce51c..dd486e5157d 100644 --- a/src/OrchardCore.Modules/OrchardCore.AdminMenu/Startup.cs +++ b/src/OrchardCore.Modules/OrchardCore.AdminMenu/Startup.cs @@ -39,9 +39,7 @@ public override void ConfigureServices(IServiceCollection services) services.AddRecipeExecutionStep(); - services.AddTransient(); - services.AddSingleton(new DeploymentStepFactory()); - services.AddScoped, AdminMenuDeploymentStepDriver>(); + services.AddDeployment(); // placeholder treeNode services.AddSingleton(new AdminNodeProviderFactory()); diff --git a/src/OrchardCore.Modules/OrchardCore.ContentTypes/Startup.cs b/src/OrchardCore.Modules/OrchardCore.ContentTypes/Startup.cs index 028324999b2..8e4fa07c4a5 100644 --- a/src/OrchardCore.Modules/OrchardCore.ContentTypes/Startup.cs +++ b/src/OrchardCore.Modules/OrchardCore.ContentTypes/Startup.cs @@ -10,7 +10,6 @@ using OrchardCore.ContentTypes.RecipeSteps; using OrchardCore.ContentTypes.Services; using OrchardCore.Deployment; -using OrchardCore.DisplayManagement.Handlers; using OrchardCore.Modules; using OrchardCore.Mvc.Core.Utilities; using OrchardCore.Navigation; @@ -140,17 +139,9 @@ public class DeploymentStartup : StartupBase { public override void ConfigureServices(IServiceCollection services) { - services.AddTransient(); - services.AddSingleton(new DeploymentStepFactory()); - services.AddScoped, ContentDefinitionDeploymentStepDriver>(); - - services.AddTransient(); - services.AddSingleton(new DeploymentStepFactory()); - services.AddScoped, ReplaceContentDefinitionDeploymentStepDriver>(); - - services.AddTransient(); - services.AddSingleton(new DeploymentStepFactory()); - services.AddScoped, DeleteContentDefinitionDeploymentStepDriver>(); + services.AddDeployment(); + services.AddDeployment(); + services.AddDeployment(); } } } diff --git a/src/OrchardCore.Modules/OrchardCore.Contents/Deployment/AddToDeploymentPlan/AddToDeploymentPlanStartup.cs b/src/OrchardCore.Modules/OrchardCore.Contents/Deployment/AddToDeploymentPlan/AddToDeploymentPlanStartup.cs index b8bb2aa85ac..b5cb3d46f5f 100644 --- a/src/OrchardCore.Modules/OrchardCore.Contents/Deployment/AddToDeploymentPlan/AddToDeploymentPlanStartup.cs +++ b/src/OrchardCore.Modules/OrchardCore.Contents/Deployment/AddToDeploymentPlan/AddToDeploymentPlanStartup.cs @@ -25,9 +25,7 @@ public AddToDeploymentPlanStartup(IOptions adminOptions) public override void ConfigureServices(IServiceCollection services) { - services.AddTransient(); - services.AddSingleton(new DeploymentStepFactory()); - services.AddScoped, ContentItemDeploymentStepDriver>(); + services.AddDeployment(); services.AddScoped(); services.AddScoped, AddToDeploymentPlanContentsAdminListDisplayDriver>(); } diff --git a/src/OrchardCore.Modules/OrchardCore.Contents/Deployment/ExportContentToDeploymentTarget/ExportContentToDeploymentTargetStartup.cs b/src/OrchardCore.Modules/OrchardCore.Contents/Deployment/ExportContentToDeploymentTarget/ExportContentToDeploymentTargetStartup.cs index f165863e270..076f02d8972 100644 --- a/src/OrchardCore.Modules/OrchardCore.Contents/Deployment/ExportContentToDeploymentTarget/ExportContentToDeploymentTargetStartup.cs +++ b/src/OrchardCore.Modules/OrchardCore.Contents/Deployment/ExportContentToDeploymentTarget/ExportContentToDeploymentTargetStartup.cs @@ -20,9 +20,7 @@ public override void ConfigureServices(IServiceCollection services) services.AddScoped, ExportContentToDeploymentTargetSettingsDisplayDriver>(); - services.AddTransient(); - services.AddSingleton(new DeploymentStepFactory()); - services.AddScoped, ExportContentToDeploymentTargetDeploymentStepDriver>(); + services.AddDeployment(); services.AddDataMigration(); services.AddScoped(); diff --git a/src/OrchardCore.Modules/OrchardCore.Contents/Startup.cs b/src/OrchardCore.Modules/OrchardCore.Contents/Startup.cs index 5238bdb1e49..95e13f91951 100644 --- a/src/OrchardCore.Modules/OrchardCore.Contents/Startup.cs +++ b/src/OrchardCore.Modules/OrchardCore.Contents/Startup.cs @@ -317,14 +317,8 @@ public class DeploymentStartup : StartupBase { public override void ConfigureServices(IServiceCollection services) { - services.AddTransient(); - services.AddSingleton(new DeploymentStepFactory()); - services.AddScoped, AllContentDeploymentStepDriver>(); - - services.AddTransient(); - services.AddSingleton(new DeploymentStepFactory()); - services.AddScoped, ContentDeploymentStepDriver>(); - + services.AddDeployment(); + services.AddDeployment(); services.AddSiteSettingsPropertyDeploymentStep(S => S["Content Audit Trail settings"], S => S["Exports the content audit trail settings."]); } } diff --git a/src/OrchardCore.Modules/OrchardCore.CustomSettings/Startup.cs b/src/OrchardCore.Modules/OrchardCore.CustomSettings/Startup.cs index 720195e9813..df5eeaf294f 100644 --- a/src/OrchardCore.Modules/OrchardCore.CustomSettings/Startup.cs +++ b/src/OrchardCore.Modules/OrchardCore.CustomSettings/Startup.cs @@ -35,9 +35,7 @@ public class DeploymentStartup : StartupBase { public override void ConfigureServices(IServiceCollection services) { - services.AddTransient(); - services.AddSingleton(new DeploymentStepFactory()); - services.AddScoped, CustomSettingsDeploymentStepDriver>(); + services.AddDeployment(); } } } diff --git a/src/OrchardCore.Modules/OrchardCore.Deployment/Startup.cs b/src/OrchardCore.Modules/OrchardCore.Deployment/Startup.cs index 54f8baafa09..46445fb6812 100644 --- a/src/OrchardCore.Modules/OrchardCore.Deployment/Startup.cs +++ b/src/OrchardCore.Modules/OrchardCore.Deployment/Startup.cs @@ -12,7 +12,6 @@ using OrchardCore.Deployment.Indexes; using OrchardCore.Deployment.Recipes; using OrchardCore.Deployment.Steps; -using OrchardCore.DisplayManagement.Handlers; using OrchardCore.Modules; using OrchardCore.Mvc.Core.Utilities; using OrchardCore.Navigation; @@ -40,13 +39,10 @@ public override void ConfigureServices(IServiceCollection services) services.AddSingleton(); // Custom File deployment step - services.AddTransient(); - services.AddSingleton(new DeploymentStepFactory()); - services.AddScoped, CustomFileDeploymentStepDriver>(); + services.AddDeployment(); // Recipe File deployment step - services.AddSingleton(new DeploymentStepFactory()); - services.AddScoped, RecipeFileDeploymentStepDriver>(); + services.AddDeploymentWithoutSource(); services.AddIndexProvider(); services.AddDataMigration(); @@ -55,13 +51,9 @@ public override void ConfigureServices(IServiceCollection services) services.AddRecipeExecutionStep(); - services.AddTransient(); - services.AddSingleton(new DeploymentStepFactory()); - services.AddScoped, DeploymentPlanDeploymentStepDriver>(); + services.AddDeployment(); - services.AddTransient(); - services.AddSingleton(new DeploymentStepFactory()); - services.AddScoped, JsonRecipeDeploymentStepDriver>(); + services.AddDeployment(); } public override void Configure(IApplicationBuilder app, IEndpointRouteBuilder routes, IServiceProvider serviceProvider) diff --git a/src/OrchardCore.Modules/OrchardCore.Facebook/StartupLogin.cs b/src/OrchardCore.Modules/OrchardCore.Facebook/StartupLogin.cs index 41df5b30c59..9b0edfd0ed2 100644 --- a/src/OrchardCore.Modules/OrchardCore.Facebook/StartupLogin.cs +++ b/src/OrchardCore.Modules/OrchardCore.Facebook/StartupLogin.cs @@ -48,9 +48,7 @@ public class DeploymentStartup : StartupBase { public override void ConfigureServices(IServiceCollection services) { - services.AddScoped, FacebookLoginDeploymentStepDriver>(); - services.AddTransient(); - services.AddSingleton>(); + services.AddDeployment(); } } } diff --git a/src/OrchardCore.Modules/OrchardCore.Features/Startup.cs b/src/OrchardCore.Modules/OrchardCore.Features/Startup.cs index 083f3f683be..b79d9e38b01 100644 --- a/src/OrchardCore.Modules/OrchardCore.Features/Startup.cs +++ b/src/OrchardCore.Modules/OrchardCore.Features/Startup.cs @@ -5,7 +5,6 @@ using Microsoft.Extensions.Options; using OrchardCore.Admin; using OrchardCore.Deployment; -using OrchardCore.DisplayManagement.Handlers; using OrchardCore.Environment.Shell.Configuration; using OrchardCore.Features.Controllers; using OrchardCore.Features.Deployment; @@ -40,9 +39,7 @@ public override void ConfigureServices(IServiceCollection services) services.AddScoped(); services.AddScoped(); - services.AddTransient(); - services.AddSingleton(new DeploymentStepFactory()); - services.AddScoped, AllFeaturesDeploymentStepDriver>(); + services.AddDeployment(); } public override void Configure(IApplicationBuilder builder, IEndpointRouteBuilder routes, IServiceProvider serviceProvider) diff --git a/src/OrchardCore.Modules/OrchardCore.Layers/Startup.cs b/src/OrchardCore.Modules/OrchardCore.Layers/Startup.cs index f6a03486bc5..4d1460d2ab1 100644 --- a/src/OrchardCore.Modules/OrchardCore.Layers/Startup.cs +++ b/src/OrchardCore.Modules/OrchardCore.Layers/Startup.cs @@ -63,10 +63,7 @@ public override void ConfigureServices(IServiceCollection services) services.AddDataMigration(); services.AddScoped(); services.AddRecipeExecutionStep(); - - services.AddTransient(); - services.AddSingleton(new DeploymentStepFactory()); - services.AddScoped, AllLayersDeploymentStepDriver>(); + services.AddDeployment(); services.AddSingleton(); } diff --git a/src/OrchardCore.Modules/OrchardCore.Media/Startup.cs b/src/OrchardCore.Modules/OrchardCore.Media/Startup.cs index 371b73a2542..88ab3d9a4df 100644 --- a/src/OrchardCore.Modules/OrchardCore.Media/Startup.cs +++ b/src/OrchardCore.Modules/OrchardCore.Media/Startup.cs @@ -18,7 +18,6 @@ using OrchardCore.ContentTypes.Editors; using OrchardCore.Data.Migration; using OrchardCore.Deployment; -using OrchardCore.DisplayManagement.Handlers; using OrchardCore.DisplayManagement.Liquid.Tags; using OrchardCore.Environment.Shell; using OrchardCore.FileStorage; @@ -389,13 +388,8 @@ public class DeploymentStartup : StartupBase { public override void ConfigureServices(IServiceCollection services) { - services.AddTransient(); - services.AddSingleton(new DeploymentStepFactory()); - services.AddScoped, MediaDeploymentStepDriver>(); - - services.AddTransient(); - services.AddSingleton(new DeploymentStepFactory()); - services.AddScoped, AllMediaProfilesDeploymentStepDriver>(); + services.AddDeployment(); + services.AddDeployment(); } } diff --git a/src/OrchardCore.Modules/OrchardCore.Microsoft.Authentication/MicrosoftAccountStartup.cs b/src/OrchardCore.Modules/OrchardCore.Microsoft.Authentication/MicrosoftAccountStartup.cs index 10ba110671e..f9cc1326d0b 100644 --- a/src/OrchardCore.Modules/OrchardCore.Microsoft.Authentication/MicrosoftAccountStartup.cs +++ b/src/OrchardCore.Modules/OrchardCore.Microsoft.Authentication/MicrosoftAccountStartup.cs @@ -82,9 +82,7 @@ public class DeploymentStartup : StartupBase { public override void ConfigureServices(IServiceCollection services) { - services.AddScoped, AzureADDeploymentStepDriver>(); - services.AddTransient(); - services.AddSingleton>(); + services.AddDeployment(); } } } diff --git a/src/OrchardCore.Modules/OrchardCore.OpenId/Startup.cs b/src/OrchardCore.Modules/OrchardCore.OpenId/Startup.cs index 582f8cb0faf..9154697ed55 100644 --- a/src/OrchardCore.Modules/OrchardCore.OpenId/Startup.cs +++ b/src/OrchardCore.Modules/OrchardCore.OpenId/Startup.cs @@ -277,9 +277,7 @@ public class ServerDeploymentStartup : StartupBase { public override void ConfigureServices(IServiceCollection services) { - services.AddScoped, OpenIdServerDeploymentStepDriver>(); - services.AddTransient(); - services.AddSingleton>(); + services.AddDeployment(); } } @@ -339,9 +337,7 @@ public class ValidationDeploymentStartup : StartupBase { public override void ConfigureServices(IServiceCollection services) { - services.AddScoped, OpenIdValidationDeploymentStepDriver>(); - services.AddTransient(); - services.AddSingleton>(); + services.AddDeployment(); } } diff --git a/src/OrchardCore.Modules/OrchardCore.Placements/Startup.cs b/src/OrchardCore.Modules/OrchardCore.Placements/Startup.cs index f4d24def9eb..35fd4da19aa 100644 --- a/src/OrchardCore.Modules/OrchardCore.Placements/Startup.cs +++ b/src/OrchardCore.Modules/OrchardCore.Placements/Startup.cs @@ -8,7 +8,6 @@ using OrchardCore.ContentTypes.Editors; using OrchardCore.Deployment; using OrchardCore.DisplayManagement.Descriptors; -using OrchardCore.DisplayManagement.Handlers; using OrchardCore.Modules; using OrchardCore.Mvc.Core.Utilities; using OrchardCore.Navigation; @@ -98,9 +97,7 @@ public class DeploymentStartup : StartupBase { public override void ConfigureServices(IServiceCollection services) { - services.AddTransient(); - services.AddSingleton(new DeploymentStepFactory()); - services.AddScoped, PlacementsDeploymentStepDriver>(); + services.AddDeployment(); } } } diff --git a/src/OrchardCore.Modules/OrchardCore.Queries/Startup.cs b/src/OrchardCore.Modules/OrchardCore.Queries/Startup.cs index 3f255c847ef..bb2995c8e84 100644 --- a/src/OrchardCore.Modules/OrchardCore.Queries/Startup.cs +++ b/src/OrchardCore.Modules/OrchardCore.Queries/Startup.cs @@ -40,14 +40,10 @@ public override void ConfigureServices(IServiceCollection services) { services.AddScoped(); services.AddScoped(); - services.AddScoped, QueryDisplayDriver>(); services.AddRecipeExecutionStep(); services.AddScoped(); - - services.AddTransient(); - services.AddSingleton(new DeploymentStepFactory()); - services.AddScoped, AllQueriesDeploymentStepDriver>(); + services.AddDeployment(); services.AddSingleton(); services.Configure(o => @@ -110,9 +106,7 @@ public class DeploymentStartup : StartupBase { public override void ConfigureServices(IServiceCollection services) { - services.AddTransient(); - services.AddSingleton(new DeploymentStepFactory()); - services.AddScoped, QueryBasedContentDeploymentStepDriver>(); + services.AddDeployment(); } } } diff --git a/src/OrchardCore.Modules/OrchardCore.Roles/Startup.cs b/src/OrchardCore.Modules/OrchardCore.Roles/Startup.cs index 5e3f33507c0..09d03bb2a29 100644 --- a/src/OrchardCore.Modules/OrchardCore.Roles/Startup.cs +++ b/src/OrchardCore.Modules/OrchardCore.Roles/Startup.cs @@ -8,7 +8,6 @@ using Microsoft.Extensions.Options; using OrchardCore.Admin; using OrchardCore.Deployment; -using OrchardCore.DisplayManagement.Handlers; using OrchardCore.Environment.Shell; using OrchardCore.Modules; using OrchardCore.Mvc.Core.Utilities; @@ -81,9 +80,7 @@ public class DeploymentStartup : StartupBase { public override void ConfigureServices(IServiceCollection services) { - services.AddTransient(); - services.AddSingleton(new DeploymentStepFactory()); - services.AddScoped, AllRolesDeploymentStepDriver>(); + services.AddDeployment(); } } diff --git a/src/OrchardCore.Modules/OrchardCore.Search.AzureAI/Startup.cs b/src/OrchardCore.Modules/OrchardCore.Search.AzureAI/Startup.cs index c5239451c84..b3e0f95aa8d 100644 --- a/src/OrchardCore.Modules/OrchardCore.Search.AzureAI/Startup.cs +++ b/src/OrchardCore.Modules/OrchardCore.Search.AzureAI/Startup.cs @@ -112,20 +112,9 @@ public class DeploymentStartup : StartupBase { public override void ConfigureServices(IServiceCollection services) { - services.AddTransient(); - services.AddSingleton(new DeploymentStepFactory()); - services.AddScoped, AzureAISearchIndexDeploymentStepDriver>(); - - services.AddTransient(); - services.AddSingleton(new DeploymentStepFactory()); - services.AddScoped, AzureAISearchSettingsDeploymentStepDriver>(); - - services.AddTransient(); - services.AddSingleton(new DeploymentStepFactory()); - services.AddScoped, AzureAISearchIndexRebuildDeploymentStepDriver>(); - - services.AddTransient(); - services.AddSingleton(new DeploymentStepFactory()); - services.AddScoped, AzureAISearchIndexResetDeploymentStepDriver>(); + services.AddDeployment(); + services.AddDeployment(); + services.AddDeployment(); + services.AddDeployment(); } } diff --git a/src/OrchardCore.Modules/OrchardCore.Search.Elasticsearch/Startup.cs b/src/OrchardCore.Modules/OrchardCore.Search.Elasticsearch/Startup.cs index 8a508259bd3..d928a152f0b 100644 --- a/src/OrchardCore.Modules/OrchardCore.Search.Elasticsearch/Startup.cs +++ b/src/OrchardCore.Modules/OrchardCore.Search.Elasticsearch/Startup.cs @@ -260,21 +260,10 @@ public class DeploymentStartup : StartupBase { public override void ConfigureServices(IServiceCollection services) { - services.AddTransient(); - services.AddSingleton(new DeploymentStepFactory()); - services.AddScoped, ElasticIndexDeploymentStepDriver>(); - - services.AddTransient(); - services.AddSingleton(new DeploymentStepFactory()); - services.AddScoped, ElasticSettingsDeploymentStepDriver>(); - - services.AddTransient(); - services.AddSingleton(new DeploymentStepFactory()); - services.AddScoped, ElasticIndexRebuildDeploymentStepDriver>(); - - services.AddTransient(); - services.AddSingleton(new DeploymentStepFactory()); - services.AddScoped, ElasticIndexResetDeploymentStepDriver>(); + services.AddDeployment(); + services.AddDeployment(); + services.AddDeployment(); + services.AddDeployment(); } } diff --git a/src/OrchardCore.Modules/OrchardCore.Search.Lucene/Startup.cs b/src/OrchardCore.Modules/OrchardCore.Search.Lucene/Startup.cs index 05c8758fa7a..61a50f827e7 100644 --- a/src/OrchardCore.Modules/OrchardCore.Search.Lucene/Startup.cs +++ b/src/OrchardCore.Modules/OrchardCore.Search.Lucene/Startup.cs @@ -130,21 +130,10 @@ public class DeploymentStartup : StartupBase { public override void ConfigureServices(IServiceCollection services) { - services.AddTransient(); - services.AddSingleton(new DeploymentStepFactory()); - services.AddScoped, LuceneIndexDeploymentStepDriver>(); - - services.AddTransient(); - services.AddSingleton(new DeploymentStepFactory()); - services.AddScoped, LuceneSettingsDeploymentStepDriver>(); - - services.AddTransient(); - services.AddSingleton(new DeploymentStepFactory()); - services.AddScoped, LuceneIndexRebuildDeploymentStepDriver>(); - - services.AddTransient(); - services.AddSingleton(new DeploymentStepFactory()); - services.AddScoped, LuceneIndexResetDeploymentStepDriver>(); + services.AddDeployment(); + services.AddDeployment(); + services.AddDeployment(); + services.AddDeployment(); } } diff --git a/src/OrchardCore.Modules/OrchardCore.Search/Startup.cs b/src/OrchardCore.Modules/OrchardCore.Search/Startup.cs index 1ab112ecf53..89151ad533f 100644 --- a/src/OrchardCore.Modules/OrchardCore.Search/Startup.cs +++ b/src/OrchardCore.Modules/OrchardCore.Search/Startup.cs @@ -57,9 +57,7 @@ public class DeploymentStartup : StartupBase { public override void ConfigureServices(IServiceCollection services) { - services.AddTransient(); - services.AddSingleton(new DeploymentStepFactory()); - services.AddScoped, SearchSettingsDeploymentStepDriver>(); + services.AddDeployment(); } } diff --git a/src/OrchardCore.Modules/OrchardCore.Settings/Startup.cs b/src/OrchardCore.Modules/OrchardCore.Settings/Startup.cs index c2b6fb5644e..ec655b50be4 100644 --- a/src/OrchardCore.Modules/OrchardCore.Settings/Startup.cs +++ b/src/OrchardCore.Modules/OrchardCore.Settings/Startup.cs @@ -88,9 +88,7 @@ public override void ConfigureServices(IServiceCollection services) services.AddScoped(); - services.AddTransient(); - services.AddSingleton(new DeploymentStepFactory()); - services.AddScoped, SiteSettingsDeploymentStepDriver>(); + services.AddDeployment(); services.AddScoped(); diff --git a/src/OrchardCore.Modules/OrchardCore.Shortcodes/Startup.cs b/src/OrchardCore.Modules/OrchardCore.Shortcodes/Startup.cs index b3c15eb5683..3d8f77cd9b2 100644 --- a/src/OrchardCore.Modules/OrchardCore.Shortcodes/Startup.cs +++ b/src/OrchardCore.Modules/OrchardCore.Shortcodes/Startup.cs @@ -130,19 +130,17 @@ public override void ConfigureServices(IServiceCollection services) lang, fallback "; - d.Categories = new string[] { "Localization" }; + d.Categories = ["Localization"]; }); } } [RequireFeatures("OrchardCore.Deployment", "OrchardCore.Shortcodes.Templates")] - public class ShortcodeTemplatesDeployementStartup : StartupBase + public class ShortcodeTemplatesDeploymentStartup : StartupBase { public override void ConfigureServices(IServiceCollection services) { - services.AddTransient(); - services.AddSingleton(new DeploymentStepFactory()); - services.AddScoped, AllShortcodeTemplatesDeploymentStepDriver>(); + services.AddDeployment(); } } } diff --git a/src/OrchardCore.Modules/OrchardCore.Sitemaps/Startup.cs b/src/OrchardCore.Modules/OrchardCore.Sitemaps/Startup.cs index 09999edb4ef..5fb0753847e 100644 --- a/src/OrchardCore.Modules/OrchardCore.Sitemaps/Startup.cs +++ b/src/OrchardCore.Modules/OrchardCore.Sitemaps/Startup.cs @@ -247,13 +247,11 @@ public override void ConfigureServices(IServiceCollection services) } [RequireFeatures("OrchardCore.Deployment", "OrchardCore.Sitemaps")] - public class SitemapsDeployementStartup : StartupBase + public class SitemapsDeploymentStartup : StartupBase { public override void ConfigureServices(IServiceCollection services) { - services.AddTransient(); - services.AddSingleton(new DeploymentStepFactory()); - services.AddScoped, AllSitemapsDeploymentStepDriver>(); + services.AddDeployment(); } } diff --git a/src/OrchardCore.Modules/OrchardCore.Templates/Startup.cs b/src/OrchardCore.Modules/OrchardCore.Templates/Startup.cs index 776c706b3eb..1a8d4e99a35 100644 --- a/src/OrchardCore.Modules/OrchardCore.Templates/Startup.cs +++ b/src/OrchardCore.Modules/OrchardCore.Templates/Startup.cs @@ -7,7 +7,6 @@ using OrchardCore.ContentTypes.Editors; using OrchardCore.Deployment; using OrchardCore.DisplayManagement; -using OrchardCore.DisplayManagement.Handlers; using OrchardCore.Modules; using OrchardCore.Mvc.Core.Utilities; using OrchardCore.Navigation; @@ -47,9 +46,7 @@ public override void ConfigureServices(IServiceCollection services) services.AddScoped(); services.AddScoped(); - services.AddTransient(); - services.AddSingleton(new DeploymentStepFactory()); - services.AddScoped, AllTemplatesDeploymentStepDriver>(); + services.AddDeployment(); services.AddScoped(); services.AddScoped(); @@ -105,10 +102,7 @@ public override void ConfigureServices(IServiceCollection services) services.AddScoped(); services.AddScoped(); services.AddRecipeExecutionStep(); - - services.AddTransient(); - services.AddSingleton(new DeploymentStepFactory()); - services.AddScoped, AllAdminTemplatesDeploymentStepDriver>(); + services.AddDeployment(); } public override void Configure(IApplicationBuilder builder, IEndpointRouteBuilder routes, IServiceProvider serviceProvider) diff --git a/src/OrchardCore.Modules/OrchardCore.Tenants/Startup.cs b/src/OrchardCore.Modules/OrchardCore.Tenants/Startup.cs index 3ff1fc049ab..8af7bf11f76 100644 --- a/src/OrchardCore.Modules/OrchardCore.Tenants/Startup.cs +++ b/src/OrchardCore.Modules/OrchardCore.Tenants/Startup.cs @@ -8,7 +8,6 @@ using OrchardCore.Admin; using OrchardCore.Deployment; using OrchardCore.DisplayManagement.Descriptors; -using OrchardCore.DisplayManagement.Handlers; using OrchardCore.Environment.Shell; using OrchardCore.Environment.Shell.Configuration; using OrchardCore.Environment.Shell.Distributed; @@ -205,13 +204,11 @@ public override void Configure(IApplicationBuilder builder, IEndpointRouteBuilde } [RequireFeatures("OrchardCore.Deployment", "OrchardCore.Tenants.FeatureProfiles")] - public class FeatureProfilesDeployementStartup : StartupBase + public class FeatureProfilesDeploymentStartup : StartupBase { public override void ConfigureServices(IServiceCollection services) { - services.AddTransient(); - services.AddSingleton(new DeploymentStepFactory()); - services.AddScoped, AllFeatureProfilesDeploymentStepDriver>(); + services.AddDeployment(); } } diff --git a/src/OrchardCore.Modules/OrchardCore.Themes/Startup.cs b/src/OrchardCore.Modules/OrchardCore.Themes/Startup.cs index 44fdb42a83a..c0ffbf920cf 100644 --- a/src/OrchardCore.Modules/OrchardCore.Themes/Startup.cs +++ b/src/OrchardCore.Modules/OrchardCore.Themes/Startup.cs @@ -45,9 +45,7 @@ public override void ConfigureServices(IServiceCollection services) services.AddScoped(); #pragma warning restore CS0618 // Type or member is obsolete services.AddScoped(); - services.AddTransient(); - services.AddSingleton(new DeploymentStepFactory()); - services.AddScoped, ThemesDeploymentStepDriver>(); + services.AddDeployment(); services.AddScoped, ToggleThemeNavbarDisplayDriver>(); } diff --git a/src/OrchardCore.Modules/OrchardCore.Users/Startup.cs b/src/OrchardCore.Modules/OrchardCore.Users/Startup.cs index 06a547db5ca..fe4ee8e8c45 100644 --- a/src/OrchardCore.Modules/OrchardCore.Users/Startup.cs +++ b/src/OrchardCore.Modules/OrchardCore.Users/Startup.cs @@ -505,10 +505,7 @@ public override void ConfigureServices(IServiceCollection services) { services.AddScoped, CustomUserSettingsDisplayDriver>(); services.AddScoped(); - - services.AddTransient(); - services.AddSingleton>(); - services.AddScoped, CustomUserSettingsDeploymentStepDriver>(); + services.AddDeployment(); } } @@ -516,9 +513,7 @@ public class UserDeploymentStartup : StartupBase { public override void ConfigureServices(IServiceCollection services) { - services.AddTransient(); - services.AddSingleton>(); - services.AddScoped, AllUsersDeploymentStepDriver>(); + services.AddDeployment(); } } } diff --git a/src/OrchardCore.Modules/OrchardCore.Workflows/Startup.cs b/src/OrchardCore.Modules/OrchardCore.Workflows/Startup.cs index 970c6a36ba2..373f2c73491 100644 --- a/src/OrchardCore.Modules/OrchardCore.Workflows/Startup.cs +++ b/src/OrchardCore.Modules/OrchardCore.Workflows/Startup.cs @@ -133,9 +133,7 @@ public class DeploymentStartup : StartupBase { public override void ConfigureServices(IServiceCollection services) { - services.AddTransient(); - services.AddSingleton(new DeploymentStepFactory()); - services.AddScoped, AllWorkflowTypeDeploymentStepDriver>(); + services.AddDeployment(); } } diff --git a/src/OrchardCore/OrchardCore.Deployment.Abstractions/ServiceCollectionExtensions.cs b/src/OrchardCore/OrchardCore.Deployment.Abstractions/ServiceCollectionExtensions.cs index e134adc383a..3329293e4e6 100644 --- a/src/OrchardCore/OrchardCore.Deployment.Abstractions/ServiceCollectionExtensions.cs +++ b/src/OrchardCore/OrchardCore.Deployment.Abstractions/ServiceCollectionExtensions.cs @@ -1,16 +1,71 @@ using Microsoft.Extensions.DependencyInjection; +using OrchardCore.DisplayManagement.Handlers; -namespace OrchardCore.Deployment +namespace OrchardCore.Deployment; + +public static class ServiceCollectionExtensions { - public static class ServiceCollectionExtensions + public static IServiceCollection AddDeploymentTargetHandler(this IServiceCollection services) + where TImplementation : class, IDeploymentTargetHandler + { + services.AddScoped(); + + return services; + } + + public static IServiceCollection AddDeployment(this IServiceCollection services) + where TSource : IDeploymentSource + where TStep : DeploymentStep, new() + { + services.AddDeploymentSource() + .AddDeploymentStep(); + + return services; + } + + public static IServiceCollection AddDeployment(this IServiceCollection services) + where TSource : IDeploymentSource + where TStep : DeploymentStep, new() + where TDisplayDriver : DisplayDriver + { + services.AddDeployment() + .AddDeploymentStepDisplayDriver(); + + return services; + } + + public static IServiceCollection AddDeploymentWithoutSource(this IServiceCollection services) + where TStep : DeploymentStep, new() + where TDisplayDriver : DisplayDriver { - public static IServiceCollection AddDeploymentTargetHandler( - this IServiceCollection serviceCollection) - where TImplementation : class, IDeploymentTargetHandler - { - serviceCollection.AddScoped(); - - return serviceCollection; - } + services.AddDeploymentStep() + .AddDeploymentStepDisplayDriver(); + + return services; + } + + private static IServiceCollection AddDeploymentSource(this IServiceCollection services) + where TSource : IDeploymentSource + { + services.AddTransient(typeof(IDeploymentSource), typeof(TSource)); + + return services; + } + + private static IServiceCollection AddDeploymentStep(this IServiceCollection services) + where TStep : DeploymentStep, new() + { + services.AddSingleton(new DeploymentStepFactory()); + + return services; + } + + private static IServiceCollection AddDeploymentStepDisplayDriver(this IServiceCollection services) + where TDisplayDriver : DisplayDriver + where TStep : DeploymentStep, new() + { + services.AddScoped, TDisplayDriver>(); + + return services; } } diff --git a/src/docs/releases/1.9.0.md b/src/docs/releases/1.9.0.md index 36fe171d5a2..0a3dcf025b5 100644 --- a/src/docs/releases/1.9.0.md +++ b/src/docs/releases/1.9.0.md @@ -14,6 +14,14 @@ If you needed to enable indexing for other extensions like (`.docx`, or `.pptx`) ## Change Logs -### Azure AI Search module +### Azure AI Search Module Introducing a new "Azure AI Search" module, designed to empower you in the administration of Azure AI Search indices. When enabled with the "Search" module, it facilitates frontend full-text search capabilities through Azure AI Search. For more info read the [Azure AI Search](../reference/modules/AzureAISearch/README.md) docs. + +## Deployment Module + +Added new extensions to make registering custom deployment step easier + + - services.AddDeployment(); + - services.AddDeployment(); + - services.AddDeploymentWithoutSource(); diff --git a/test/OrchardCore.Tests/Apis/ContentManagement/ContentApiController/BlogPostApiControllerTests.cs b/test/OrchardCore.Tests/Apis/ContentManagement/ContentApiController/BlogPostApiControllerTests.cs index e03bf8dd10a..ca0181cb5f0 100644 --- a/test/OrchardCore.Tests/Apis/ContentManagement/ContentApiController/BlogPostApiControllerTests.cs +++ b/test/OrchardCore.Tests/Apis/ContentManagement/ContentApiController/BlogPostApiControllerTests.cs @@ -5,7 +5,6 @@ using OrchardCore.Lists.Models; using OrchardCore.Taxonomies.Fields; using OrchardCore.Tests.Apis.Context; -using YesSql; using ISession = YesSql.ISession; namespace OrchardCore.Tests.Apis.ContentManagement.ContentApiController