From 522493427f6b542c744d80cbe2670043ad2b4e5d Mon Sep 17 00:00:00 2001 From: ns8482e <23270244+ns8482e@users.noreply.github.com> Date: Mon, 23 May 2022 12:18:49 -0500 Subject: [PATCH] Auto register IDisplayManager for T on AddTheming Fixes: #11547 --- src/OrchardCore.Modules/OrchardCore.AdminMenu/Startup.cs | 2 -- src/OrchardCore.Modules/OrchardCore.AuditTrail/Startup.cs | 4 +--- src/OrchardCore.Modules/OrchardCore.Contents/Startup.cs | 1 - src/OrchardCore.Modules/OrchardCore.Deployment/Startup.cs | 1 - src/OrchardCore.Modules/OrchardCore.OpenId/Startup.cs | 2 -- src/OrchardCore.Modules/OrchardCore.Queries/Startup.cs | 1 - src/OrchardCore.Modules/OrchardCore.Rules/Startup.cs | 3 +-- src/OrchardCore.Modules/OrchardCore.Settings/Startup.cs | 1 - src/OrchardCore.Modules/OrchardCore.Shortcodes/Startup.cs | 1 - src/OrchardCore.Modules/OrchardCore.Sitemaps/Startup.cs | 1 - src/OrchardCore.Modules/OrchardCore.Users/Startup.cs | 2 -- .../OrchardCoreBuilderExtensions.cs | 1 + 12 files changed, 3 insertions(+), 17 deletions(-) diff --git a/src/OrchardCore.Modules/OrchardCore.AdminMenu/Startup.cs b/src/OrchardCore.Modules/OrchardCore.AdminMenu/Startup.cs index 1e87e805590..9fbf2c48664 100644 --- a/src/OrchardCore.Modules/OrchardCore.AdminMenu/Startup.cs +++ b/src/OrchardCore.Modules/OrchardCore.AdminMenu/Startup.cs @@ -38,8 +38,6 @@ public override void ConfigureServices(IServiceCollection services) services.AddScoped(); services.AddScoped(); - services.AddScoped, DisplayManager>(); - services.AddRecipeExecutionStep(); services.AddTransient(); diff --git a/src/OrchardCore.Modules/OrchardCore.AuditTrail/Startup.cs b/src/OrchardCore.Modules/OrchardCore.AuditTrail/Startup.cs index 8b4df9bfc08..cdafba2d486 100644 --- a/src/OrchardCore.Modules/OrchardCore.AuditTrail/Startup.cs +++ b/src/OrchardCore.Modules/OrchardCore.AuditTrail/Startup.cs @@ -49,7 +49,6 @@ public override void ConfigureServices(IServiceCollection services) services.AddScoped(); services - .AddScoped, DisplayManager>() .AddScoped, AuditTrailEventDisplayDriver>(); services.AddSingleton(); @@ -67,8 +66,7 @@ public override void ConfigureServices(IServiceCollection services) services.AddScoped, AuditTrailSettingsDisplayDriver>(); services.AddScoped, AuditTrailTrimmingSettingsDisplayDriver>(); - services.AddScoped, DisplayManager>() - .AddScoped, AuditTrailOptionsDisplayDriver>(); + services.AddScoped, AuditTrailOptionsDisplayDriver>(); services.AddScoped(); diff --git a/src/OrchardCore.Modules/OrchardCore.Contents/Startup.cs b/src/OrchardCore.Modules/OrchardCore.Contents/Startup.cs index 7d9f0c337a8..987d3e401bc 100644 --- a/src/OrchardCore.Modules/OrchardCore.Contents/Startup.cs +++ b/src/OrchardCore.Modules/OrchardCore.Contents/Startup.cs @@ -199,7 +199,6 @@ async Task GetContentByHandleAsync(LiquidTemplateContext context, st services.AddScoped(); - services.AddScoped, DisplayManager>(); services.AddScoped, ContentOptionsDisplayDriver>(); services.AddScoped(typeof(IContentItemRecursionHelper<>), typeof(ContentItemRecursionHelper<>)); diff --git a/src/OrchardCore.Modules/OrchardCore.Deployment/Startup.cs b/src/OrchardCore.Modules/OrchardCore.Deployment/Startup.cs index 6d06e265cdf..5eb9f5809ed 100644 --- a/src/OrchardCore.Modules/OrchardCore.Deployment/Startup.cs +++ b/src/OrchardCore.Modules/OrchardCore.Deployment/Startup.cs @@ -38,7 +38,6 @@ public override void ConfigureServices(IServiceCollection services) services.AddScoped(); services.AddScoped(); - services.AddScoped, DisplayManager>(); services.AddSingleton(); // Custom File deployment step diff --git a/src/OrchardCore.Modules/OrchardCore.OpenId/Startup.cs b/src/OrchardCore.Modules/OrchardCore.OpenId/Startup.cs index 9ea40d53832..20b96f083f4 100644 --- a/src/OrchardCore.Modules/OrchardCore.OpenId/Startup.cs +++ b/src/OrchardCore.Modules/OrchardCore.OpenId/Startup.cs @@ -175,7 +175,6 @@ public override void ConfigureServices(IServiceCollection services) { ServiceDescriptor.Scoped(), ServiceDescriptor.Scoped, OpenIdServerSettingsDisplayDriver>(), - ServiceDescriptor.Scoped, DisplayManager>(), ServiceDescriptor.Scoped(), ServiceDescriptor.Scoped(), ServiceDescriptor.Scoped(), @@ -303,7 +302,6 @@ public override void ConfigureServices(IServiceCollection services) services.TryAddEnumerable(new[] { ServiceDescriptor.Scoped, OpenIdValidationSettingsDisplayDriver>(), - ServiceDescriptor.Scoped, DisplayManager>(), ServiceDescriptor.Scoped() }); diff --git a/src/OrchardCore.Modules/OrchardCore.Queries/Startup.cs b/src/OrchardCore.Modules/OrchardCore.Queries/Startup.cs index ea0e291c917..327957b65b9 100644 --- a/src/OrchardCore.Modules/OrchardCore.Queries/Startup.cs +++ b/src/OrchardCore.Modules/OrchardCore.Queries/Startup.cs @@ -41,7 +41,6 @@ public override void ConfigureServices(IServiceCollection services) { services.AddScoped(); services.AddScoped(); - services.AddScoped, DisplayManager>(); services.AddScoped, QueryDisplayDriver>(); services.AddRecipeExecutionStep(); diff --git a/src/OrchardCore.Modules/OrchardCore.Rules/Startup.cs b/src/OrchardCore.Modules/OrchardCore.Rules/Startup.cs index 55123641543..32130d80391 100644 --- a/src/OrchardCore.Modules/OrchardCore.Rules/Startup.cs +++ b/src/OrchardCore.Modules/OrchardCore.Rules/Startup.cs @@ -17,8 +17,7 @@ public override void ConfigureServices(IServiceCollection services) services.AddOptions(); // Rule services. - services.AddScoped, DisplayManager>() - .AddScoped, DisplayManager>() + services .AddScoped, RuleDisplayDriver>() .AddSingleton() .AddTransient, ConditionOperatorConfigureOptions>() diff --git a/src/OrchardCore.Modules/OrchardCore.Settings/Startup.cs b/src/OrchardCore.Modules/OrchardCore.Settings/Startup.cs index 20e33c736e3..1bdd6da0ec4 100644 --- a/src/OrchardCore.Modules/OrchardCore.Settings/Startup.cs +++ b/src/OrchardCore.Modules/OrchardCore.Settings/Startup.cs @@ -82,7 +82,6 @@ public override void ConfigureServices(IServiceCollection services) services.AddSingleton(); // Site Settings editor - services.AddScoped, DisplayManager>(); services.AddScoped, DefaultSiteSettingsDisplayDriver>(); services.AddScoped, ButtonsSettingsDisplayDriver>(); services.AddScoped(); diff --git a/src/OrchardCore.Modules/OrchardCore.Shortcodes/Startup.cs b/src/OrchardCore.Modules/OrchardCore.Shortcodes/Startup.cs index 4f4ee72043a..0161485664c 100644 --- a/src/OrchardCore.Modules/OrchardCore.Shortcodes/Startup.cs +++ b/src/OrchardCore.Modules/OrchardCore.Shortcodes/Startup.cs @@ -58,7 +58,6 @@ public override void ConfigureServices(IServiceCollection services) services.AddOptions(); services.AddScoped(); - services.AddScoped, DisplayManager>(); services.AddScoped, ShortcodeDescriptorDisplayDriver>(); } } diff --git a/src/OrchardCore.Modules/OrchardCore.Sitemaps/Startup.cs b/src/OrchardCore.Modules/OrchardCore.Sitemaps/Startup.cs index 9d7a8b67ca7..0fc4c1c0b0f 100644 --- a/src/OrchardCore.Modules/OrchardCore.Sitemaps/Startup.cs +++ b/src/OrchardCore.Modules/OrchardCore.Sitemaps/Startup.cs @@ -67,7 +67,6 @@ public override void ConfigureServices(IServiceCollection services) services.AddScoped(); services.AddScoped(); - services.AddScoped, DisplayManager>(); services.AddScoped(); services.AddScoped(); services.AddScoped(); diff --git a/src/OrchardCore.Modules/OrchardCore.Users/Startup.cs b/src/OrchardCore.Modules/OrchardCore.Users/Startup.cs index 2b0140fe6b3..eeed0ea2ca6 100644 --- a/src/OrchardCore.Modules/OrchardCore.Users/Startup.cs +++ b/src/OrchardCore.Modules/OrchardCore.Users/Startup.cs @@ -215,7 +215,6 @@ public override void ConfigureServices(IServiceCollection services) services.AddScoped, LoginSettingsDisplayDriver>(); - services.AddScoped, DisplayManager>(); services.AddScoped, UserDisplayDriver>(); services.AddScoped, UserRoleDisplayDriver>(); services.AddScoped, UserInformationDisplayDriver>(); @@ -227,7 +226,6 @@ public override void ConfigureServices(IServiceCollection services) services.AddScoped(); - services.AddScoped, DisplayManager>(); services.AddScoped, UserOptionsDisplayDriver>(); services.AddSingleton(sp => diff --git a/src/OrchardCore/OrchardCore.DisplayManagement/OrchardCoreBuilderExtensions.cs b/src/OrchardCore/OrchardCore.DisplayManagement/OrchardCoreBuilderExtensions.cs index 5e61e127fe6..3d62c5418d7 100644 --- a/src/OrchardCore/OrchardCore.DisplayManagement/OrchardCoreBuilderExtensions.cs +++ b/src/OrchardCore/OrchardCore.DisplayManagement/OrchardCoreBuilderExtensions.cs @@ -75,6 +75,7 @@ public static OrchardCoreBuilder AddTheming(this OrchardCoreBuilder builder) services.AddScoped(); services.AddShapeAttributes(); + services.AddScoped(typeof(IDisplayManager<>), typeof(DisplayManager<>)); services.AddScoped(); services.AddScoped(); services.AddScoped();