diff --git a/Lombiq.HelpfulLibraries.OrchardCore/DependencyInjection/ServiceProviderExtensions.cs b/Lombiq.HelpfulLibraries.OrchardCore/DependencyInjection/ServiceProviderExtensions.cs
index fb9686d9..4371d5b0 100644
--- a/Lombiq.HelpfulLibraries.OrchardCore/DependencyInjection/ServiceProviderExtensions.cs
+++ b/Lombiq.HelpfulLibraries.OrchardCore/DependencyInjection/ServiceProviderExtensions.cs
@@ -10,28 +10,18 @@ public static class ServiceProviderExtensions
///
/// Executes in the specified shell's scope.
///
- public static async Task WithShellScopeAsync(
+ public static Task WithShellScopeAsync(
this IServiceProvider serviceProvider,
Func asyncAction,
- string scopeName = "Default")
- {
- var shellHost = serviceProvider.GetRequiredService();
- var shellScope = await shellHost.GetScopeAsync(scopeName);
- await shellScope.UsingAsync(asyncAction);
- }
+ string scopeName = ShellSettings.DefaultShellName) =>
+ serviceProvider.GetRequiredService().WithShellScopeAsync(asyncAction, scopeName);
///
/// Executes in the specified shell's scope and returns the resulting object.
///
- public static async Task GetWithShellScopeAsync(
+ public static Task GetWithShellScopeAsync(
this IServiceProvider serviceProvider,
Func> asyncFunc,
- string scopeName = "Default")
- {
- T result = default;
-
- await serviceProvider.WithShellScopeAsync(async scope => result = await asyncFunc(scope), scopeName);
-
- return result;
- }
+ string scopeName = ShellSettings.DefaultShellName) =>
+ serviceProvider.GetRequiredService().GetWithShellScopeAsync(asyncFunc, scopeName);
}
diff --git a/Lombiq.HelpfulLibraries.OrchardCore/DependencyInjection/ShellHostExtensions.cs b/Lombiq.HelpfulLibraries.OrchardCore/DependencyInjection/ShellHostExtensions.cs
new file mode 100644
index 00000000..b68a98cb
--- /dev/null
+++ b/Lombiq.HelpfulLibraries.OrchardCore/DependencyInjection/ShellHostExtensions.cs
@@ -0,0 +1,35 @@
+using OrchardCore.Environment.Shell.Scope;
+using System;
+using System.Threading.Tasks;
+
+namespace OrchardCore.Environment.Shell;
+
+public static class ShellHostExtensions
+{
+ ///
+ /// Executes in the specified shell's scope.
+ ///
+ public static async Task WithShellScopeAsync(
+ this IShellHost shellHost,
+ Func asyncAction,
+ string scopeName = ShellSettings.DefaultShellName)
+ {
+ await using var shellScope = await shellHost.GetScopeAsync(scopeName);
+ await shellScope.UsingAsync(asyncAction);
+ }
+
+ ///
+ /// Executes in the specified shell's scope and returns the resulting object.
+ ///
+ public static async Task GetWithShellScopeAsync(
+ this IShellHost shellHost,
+ Func> asyncFunc,
+ string scopeName = ShellSettings.DefaultShellName)
+ {
+ T result = default;
+
+ await shellHost.WithShellScopeAsync(async scope => result = await asyncFunc(scope), scopeName);
+
+ return result;
+ }
+}
diff --git a/Lombiq.HelpfulLibraries.OrchardCore/Mvc/TypedRoute.cs b/Lombiq.HelpfulLibraries.OrchardCore/Mvc/TypedRoute.cs
index 594584d8..7ba71024 100644
--- a/Lombiq.HelpfulLibraries.OrchardCore/Mvc/TypedRoute.cs
+++ b/Lombiq.HelpfulLibraries.OrchardCore/Mvc/TypedRoute.cs
@@ -6,6 +6,7 @@
using Microsoft.Extensions.Options;
using OrchardCore.Admin;
using OrchardCore.Environment.Extensions;
+using OrchardCore.Environment.Shell;
using OrchardCore.Modules.Manifest;
using OrchardCore.Mvc.Core.Utilities;
using System;
@@ -111,7 +112,7 @@ public override string ToString()
/// route, and other arguments.
///
public string ToString(string tenantName) =>
- string.IsNullOrWhiteSpace(tenantName) || tenantName.EqualsOrdinalIgnoreCase("Default")
+ string.IsNullOrWhiteSpace(tenantName) || tenantName.EqualsOrdinalIgnoreCase(ShellSettings.DefaultShellName)
? ToString()
: $"/{tenantName}{this}";