From 33c54be9e5d3dd2dc8017a01467c241feeae7fc5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A1ra=20El-Saig?= Date: Wed, 7 Jan 2026 23:54:55 +0100 Subject: [PATCH 01/74] Update OC versions to preview. --- .../Lombiq.HelpfulLibraries.AspNetCore.csproj | 2 +- .../Lombiq.HelpfulLibraries.Cli.csproj | 2 +- .../Lombiq.HelpfulLibraries.Common.csproj | 2 +- .../Lombiq.HelpfulLibraries.LinqToDb.csproj | 4 +- ...elpfulLibraries.OrchardCore.Testing.csproj | 2 +- ...Lombiq.HelpfulLibraries.OrchardCore.csproj | 50 +++++++++---------- .../Lombiq.HelpfulLibraries.RestEase.csproj | 2 +- ...q.HelpfulLibraries.Samples.Tests.UI.csproj | 2 +- .../Lombiq.HelpfulLibraries.Samples.csproj | 14 +++--- .../Lombiq.HelpfulLibraries.Tests.csproj | 2 +- .../Lombiq.HelpfulLibraries.csproj | 2 +- 11 files changed, 42 insertions(+), 42 deletions(-) diff --git a/Lombiq.HelpfulLibraries.AspNetCore/Lombiq.HelpfulLibraries.AspNetCore.csproj b/Lombiq.HelpfulLibraries.AspNetCore/Lombiq.HelpfulLibraries.AspNetCore.csproj index 883d918b..95aa6abb 100644 --- a/Lombiq.HelpfulLibraries.AspNetCore/Lombiq.HelpfulLibraries.AspNetCore.csproj +++ b/Lombiq.HelpfulLibraries.AspNetCore/Lombiq.HelpfulLibraries.AspNetCore.csproj @@ -1,7 +1,7 @@ - net8.0 + net10.0 $(DefaultItemExcludes);.git* enable diff --git a/Lombiq.HelpfulLibraries.Cli/Lombiq.HelpfulLibraries.Cli.csproj b/Lombiq.HelpfulLibraries.Cli/Lombiq.HelpfulLibraries.Cli.csproj index 7e967fbe..0d896161 100644 --- a/Lombiq.HelpfulLibraries.Cli/Lombiq.HelpfulLibraries.Cli.csproj +++ b/Lombiq.HelpfulLibraries.Cli/Lombiq.HelpfulLibraries.Cli.csproj @@ -1,7 +1,7 @@ - net8.0 + net10.0 enable diff --git a/Lombiq.HelpfulLibraries.Common/Lombiq.HelpfulLibraries.Common.csproj b/Lombiq.HelpfulLibraries.Common/Lombiq.HelpfulLibraries.Common.csproj index 27c5aa88..9926fc2f 100644 --- a/Lombiq.HelpfulLibraries.Common/Lombiq.HelpfulLibraries.Common.csproj +++ b/Lombiq.HelpfulLibraries.Common/Lombiq.HelpfulLibraries.Common.csproj @@ -1,7 +1,7 @@ - net8.0 + net10.0 $(DefaultItemExcludes);.git* enable diff --git a/Lombiq.HelpfulLibraries.LinqToDb/Lombiq.HelpfulLibraries.LinqToDb.csproj b/Lombiq.HelpfulLibraries.LinqToDb/Lombiq.HelpfulLibraries.LinqToDb.csproj index 56c1abdd..80157b2d 100644 --- a/Lombiq.HelpfulLibraries.LinqToDb/Lombiq.HelpfulLibraries.LinqToDb.csproj +++ b/Lombiq.HelpfulLibraries.LinqToDb/Lombiq.HelpfulLibraries.LinqToDb.csproj @@ -1,7 +1,7 @@ - net8.0 + net10.0 $(DefaultItemExcludes);.git* enable @@ -25,6 +25,6 @@ - + diff --git a/Lombiq.HelpfulLibraries.OrchardCore.Testing/Lombiq.HelpfulLibraries.OrchardCore.Testing.csproj b/Lombiq.HelpfulLibraries.OrchardCore.Testing/Lombiq.HelpfulLibraries.OrchardCore.Testing.csproj index 4d9a7f55..c2931f6c 100644 --- a/Lombiq.HelpfulLibraries.OrchardCore.Testing/Lombiq.HelpfulLibraries.OrchardCore.Testing.csproj +++ b/Lombiq.HelpfulLibraries.OrchardCore.Testing/Lombiq.HelpfulLibraries.OrchardCore.Testing.csproj @@ -1,7 +1,7 @@ - net8.0 + net10.0 $(DefaultItemExcludes);.git* enable diff --git a/Lombiq.HelpfulLibraries.OrchardCore/Lombiq.HelpfulLibraries.OrchardCore.csproj b/Lombiq.HelpfulLibraries.OrchardCore/Lombiq.HelpfulLibraries.OrchardCore.csproj index 2d687e7a..4416be50 100644 --- a/Lombiq.HelpfulLibraries.OrchardCore/Lombiq.HelpfulLibraries.OrchardCore.csproj +++ b/Lombiq.HelpfulLibraries.OrchardCore/Lombiq.HelpfulLibraries.OrchardCore.csproj @@ -1,7 +1,7 @@ - net8.0 + net10.0 $(DefaultItemExcludes);.git* enable @@ -24,34 +24,34 @@ - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + - - + + diff --git a/Lombiq.HelpfulLibraries.RestEase/Lombiq.HelpfulLibraries.RestEase.csproj b/Lombiq.HelpfulLibraries.RestEase/Lombiq.HelpfulLibraries.RestEase.csproj index 46919d65..9353ad01 100644 --- a/Lombiq.HelpfulLibraries.RestEase/Lombiq.HelpfulLibraries.RestEase.csproj +++ b/Lombiq.HelpfulLibraries.RestEase/Lombiq.HelpfulLibraries.RestEase.csproj @@ -1,7 +1,7 @@ - net8.0 + net10.0 $(DefaultItemExcludes);.git* enable diff --git a/Lombiq.HelpfulLibraries.Samples.Tests.UI/Lombiq.HelpfulLibraries.Samples.Tests.UI.csproj b/Lombiq.HelpfulLibraries.Samples.Tests.UI/Lombiq.HelpfulLibraries.Samples.Tests.UI.csproj index ef468d17..e1bde716 100644 --- a/Lombiq.HelpfulLibraries.Samples.Tests.UI/Lombiq.HelpfulLibraries.Samples.Tests.UI.csproj +++ b/Lombiq.HelpfulLibraries.Samples.Tests.UI/Lombiq.HelpfulLibraries.Samples.Tests.UI.csproj @@ -1,7 +1,7 @@  - net8.0 + net10.0 $(DefaultItemExcludes);.git* diff --git a/Lombiq.HelpfulLibraries.Samples/Lombiq.HelpfulLibraries.Samples.csproj b/Lombiq.HelpfulLibraries.Samples/Lombiq.HelpfulLibraries.Samples.csproj index 1e8e5b82..ccf233bc 100644 --- a/Lombiq.HelpfulLibraries.Samples/Lombiq.HelpfulLibraries.Samples.csproj +++ b/Lombiq.HelpfulLibraries.Samples/Lombiq.HelpfulLibraries.Samples.csproj @@ -1,7 +1,7 @@ - net8.0 + net10.0 true false $(DefaultItemExcludes);.git* @@ -12,12 +12,12 @@ - - - - - - + + + + + + diff --git a/Lombiq.HelpfulLibraries.Tests/Lombiq.HelpfulLibraries.Tests.csproj b/Lombiq.HelpfulLibraries.Tests/Lombiq.HelpfulLibraries.Tests.csproj index 93e8d1cd..24e53bac 100644 --- a/Lombiq.HelpfulLibraries.Tests/Lombiq.HelpfulLibraries.Tests.csproj +++ b/Lombiq.HelpfulLibraries.Tests/Lombiq.HelpfulLibraries.Tests.csproj @@ -1,7 +1,7 @@ - net8.0 + net10.0 Exe diff --git a/Lombiq.HelpfulLibraries/Lombiq.HelpfulLibraries.csproj b/Lombiq.HelpfulLibraries/Lombiq.HelpfulLibraries.csproj index 1f774ddf..7f1daa21 100644 --- a/Lombiq.HelpfulLibraries/Lombiq.HelpfulLibraries.csproj +++ b/Lombiq.HelpfulLibraries/Lombiq.HelpfulLibraries.csproj @@ -1,7 +1,7 @@ - net8.0 + net10.0 $(DefaultItemExcludes);.git* enable From 9e243c9d2ae11456bb4bf4b0b49af8f74cc1c58e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A1ra=20El-Saig?= Date: Thu, 8 Jan 2026 11:55:12 +0100 Subject: [PATCH 02/74] Fix some build errors. --- .../Elasticsearch/ElasticIndexManagerExtensions.cs | 5 +++-- .../GraphQL/TotalOfContentTypeBuilder.cs | 4 ++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Lombiq.HelpfulLibraries.OrchardCore/Elasticsearch/ElasticIndexManagerExtensions.cs b/Lombiq.HelpfulLibraries.OrchardCore/Elasticsearch/ElasticIndexManagerExtensions.cs index b3d433f2..6c5ca2ca 100644 --- a/Lombiq.HelpfulLibraries.OrchardCore/Elasticsearch/ElasticIndexManagerExtensions.cs +++ b/Lombiq.HelpfulLibraries.OrchardCore/Elasticsearch/ElasticIndexManagerExtensions.cs @@ -1,3 +1,4 @@ +using OrchardCore.Indexing.Models; using System.Threading.Tasks; namespace OrchardCore.Search.Elasticsearch.Core.Services; @@ -8,6 +9,6 @@ public static class ElasticIndexManagerExtensions /// Clear all indexes for the tenant (within the prefix, if there is one) by passing a wildcard /// character (*) as the index name. /// - public static Task DeleteAllIndexesAsync(this ElasticIndexManager manager) => - manager.DeleteIndex("*"); + public static Task DeleteAllIndexesAsync(this ElasticsearchIndexManager manager) => + manager.DeleteAsync(new IndexProfile { IndexName = "*" }); } diff --git a/Lombiq.HelpfulLibraries.OrchardCore/GraphQL/TotalOfContentTypeBuilder.cs b/Lombiq.HelpfulLibraries.OrchardCore/GraphQL/TotalOfContentTypeBuilder.cs index 035473ff..6ddb8332 100644 --- a/Lombiq.HelpfulLibraries.OrchardCore/GraphQL/TotalOfContentTypeBuilder.cs +++ b/Lombiq.HelpfulLibraries.OrchardCore/GraphQL/TotalOfContentTypeBuilder.cs @@ -47,4 +47,8 @@ public void Build(ISchema schema, FieldType contentQuery, ContentTypeDefinition .CountAsync(); }); } + + public void Clear() + { + } } From fee2db0c94ba0151885e0544e650aeedd9accd09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A1ra=20El-Saig?= Date: Thu, 8 Jan 2026 11:55:51 +0100 Subject: [PATCH 03/74] Remove old compatibility suppressions files. --- .../CompatibilitySuppressions.xml | 18 --- .../CompatibilitySuppressions.xml | 67 -------- .../CompatibilitySuppressions.xml | 144 ------------------ .../CompatibilitySuppressions.xml | 11 -- 4 files changed, 240 deletions(-) delete mode 100644 Lombiq.HelpfulLibraries.AspNetCore/CompatibilitySuppressions.xml delete mode 100644 Lombiq.HelpfulLibraries.Common/CompatibilitySuppressions.xml delete mode 100644 Lombiq.HelpfulLibraries.OrchardCore/CompatibilitySuppressions.xml delete mode 100644 Lombiq.HelpfulLibraries.Refit/CompatibilitySuppressions.xml diff --git a/Lombiq.HelpfulLibraries.AspNetCore/CompatibilitySuppressions.xml b/Lombiq.HelpfulLibraries.AspNetCore/CompatibilitySuppressions.xml deleted file mode 100644 index 6a5cc938..00000000 --- a/Lombiq.HelpfulLibraries.AspNetCore/CompatibilitySuppressions.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - CP0002 - M:Lombiq.HelpfulLibraries.AspNetCore.Security.IContentSecurityPolicyProvider.GetDirective(System.Collections.Generic.IDictionary{System.String,System.String},System.String[]) - lib/net8.0/Lombiq.HelpfulLibraries.AspNetCore.dll - lib/net8.0/Lombiq.HelpfulLibraries.AspNetCore.dll - true - - - CP0002 - M:Microsoft.AspNetCore.Builder.ApplicationBuilderExtensions.UseContentSecurityPolicyHeader(Microsoft.AspNetCore.Builder.IApplicationBuilder,System.Boolean,System.Boolean) - lib/net8.0/Lombiq.HelpfulLibraries.AspNetCore.dll - lib/net8.0/Lombiq.HelpfulLibraries.AspNetCore.dll - true - - \ No newline at end of file diff --git a/Lombiq.HelpfulLibraries.Common/CompatibilitySuppressions.xml b/Lombiq.HelpfulLibraries.Common/CompatibilitySuppressions.xml deleted file mode 100644 index 733b6405..00000000 --- a/Lombiq.HelpfulLibraries.Common/CompatibilitySuppressions.xml +++ /dev/null @@ -1,67 +0,0 @@ - - - - - CP0002 - M:Lombiq.HelpfulLibraries.Common.Utilities.Country.set_DisplayText(System.String) - lib/net8.0/Lombiq.HelpfulLibraries.Common.dll - lib/net8.0/Lombiq.HelpfulLibraries.Common.dll - true - - - CP0002 - M:Lombiq.HelpfulLibraries.Common.Utilities.Country.set_TwoLetterIsoCode(System.String) - lib/net8.0/Lombiq.HelpfulLibraries.Common.dll - lib/net8.0/Lombiq.HelpfulLibraries.Common.dll - true - - - CP0002 - M:Lombiq.HelpfulLibraries.Common.Utilities.Language.set_Code(System.String) - lib/net8.0/Lombiq.HelpfulLibraries.Common.dll - lib/net8.0/Lombiq.HelpfulLibraries.Common.dll - true - - - CP0002 - M:Lombiq.HelpfulLibraries.Common.Utilities.Language.set_DisplayText(System.String) - lib/net8.0/Lombiq.HelpfulLibraries.Common.dll - lib/net8.0/Lombiq.HelpfulLibraries.Common.dll - true - - - CP0002 - M:Microsoft.Extensions.DependencyInjection.ServiceCollectionExtensions.RemoveImplementations(Microsoft.Extensions.DependencyInjection.IServiceCollection,System.String) - lib/net8.0/Lombiq.HelpfulLibraries.Common.dll - lib/net8.0/Lombiq.HelpfulLibraries.Common.dll - true - - - CP0002 - M:Microsoft.Extensions.DependencyInjection.ServiceCollectionExtensions.RemoveImplementations``1(Microsoft.Extensions.DependencyInjection.IServiceCollection) - lib/net8.0/Lombiq.HelpfulLibraries.Common.dll - lib/net8.0/Lombiq.HelpfulLibraries.Common.dll - true - - - CP0002 - M:System.StringExtensions.ContainsOrdinal(System.String,System.String) - lib/net8.0/Lombiq.HelpfulLibraries.Common.dll - lib/net8.0/Lombiq.HelpfulLibraries.Common.dll - true - - - CP0002 - M:System.StringExtensions.EqualsOrdinal(System.String,System.String) - lib/net8.0/Lombiq.HelpfulLibraries.Common.dll - lib/net8.0/Lombiq.HelpfulLibraries.Common.dll - true - - - CP0002 - M:System.StringExtensions.ReplaceOrdinal(System.String,System.String,System.String) - lib/net8.0/Lombiq.HelpfulLibraries.Common.dll - lib/net8.0/Lombiq.HelpfulLibraries.Common.dll - true - - \ No newline at end of file diff --git a/Lombiq.HelpfulLibraries.OrchardCore/CompatibilitySuppressions.xml b/Lombiq.HelpfulLibraries.OrchardCore/CompatibilitySuppressions.xml deleted file mode 100644 index befc3524..00000000 --- a/Lombiq.HelpfulLibraries.OrchardCore/CompatibilitySuppressions.xml +++ /dev/null @@ -1,144 +0,0 @@ - - - - - CP0001 - T:Lombiq.HelpfulLibraries.OrchardCore.Mvc.AdminRouteAttribute - lib/net8.0/Lombiq.HelpfulLibraries.OrchardCore.dll - lib/net8.0/Lombiq.HelpfulLibraries.OrchardCore.dll - true - - - CP0001 - T:Lombiq.HelpfulLibraries.OrchardCore.Mvc.AdminRouteAttributeRouteMapper - lib/net8.0/Lombiq.HelpfulLibraries.OrchardCore.dll - lib/net8.0/Lombiq.HelpfulLibraries.OrchardCore.dll - true - - - CP0002 - M:Lombiq.HelpfulLibraries.OrchardCore.Contents.JsonSectionDisplayDriver`2.get_GroupId - lib/net8.0/Lombiq.HelpfulLibraries.OrchardCore.dll - lib/net8.0/Lombiq.HelpfulLibraries.OrchardCore.dll - true - - - CP0002 - M:Lombiq.HelpfulLibraries.OrchardCore.ResourceManagement.ResourceFilter.get_Execution - lib/net8.0/Lombiq.HelpfulLibraries.OrchardCore.dll - lib/net8.0/Lombiq.HelpfulLibraries.OrchardCore.dll - true - - - CP0002 - M:Lombiq.HelpfulLibraries.OrchardCore.ResourceManagement.ResourceFilter.get_ExecutionAsync - lib/net8.0/Lombiq.HelpfulLibraries.OrchardCore.dll - lib/net8.0/Lombiq.HelpfulLibraries.OrchardCore.dll - true - - - CP0002 - M:Lombiq.HelpfulLibraries.OrchardCore.ResourceManagement.ResourceFilter.set_Execution(System.Action{OrchardCore.ResourceManagement.IResourceManager}) - lib/net8.0/Lombiq.HelpfulLibraries.OrchardCore.dll - lib/net8.0/Lombiq.HelpfulLibraries.OrchardCore.dll - true - - - CP0002 - M:Lombiq.HelpfulLibraries.OrchardCore.ResourceManagement.ResourceFilter.set_ExecutionAsync(System.Func{OrchardCore.ResourceManagement.IResourceManager,System.Threading.Tasks.Task}) - lib/net8.0/Lombiq.HelpfulLibraries.OrchardCore.dll - lib/net8.0/Lombiq.HelpfulLibraries.OrchardCore.dll - true - - - CP0002 - M:Lombiq.HelpfulLibraries.OrchardCore.ResourceManagement.ResourceFilterMiddleware.InvokeAsync(Microsoft.AspNetCore.Http.HttpContext) - lib/net8.0/Lombiq.HelpfulLibraries.OrchardCore.dll - lib/net8.0/Lombiq.HelpfulLibraries.OrchardCore.dll - true - - - CP0002 - M:Lombiq.HelpfulLibraries.OrchardCore.ResourceManagement.ResourceFilterThemeRequirementAttribute.GetRequirementsByType(System.Type) - lib/net8.0/Lombiq.HelpfulLibraries.OrchardCore.dll - lib/net8.0/Lombiq.HelpfulLibraries.OrchardCore.dll - true - - - CP0002 - M:Microsoft.Extensions.DependencyInjection.OrchardCoreBuilderExtensions.ConfigureSmtpSettings(Microsoft.Extensions.DependencyInjection.OrchardCoreBuilder,System.Boolean) - lib/net8.0/Lombiq.HelpfulLibraries.OrchardCore.dll - lib/net8.0/Lombiq.HelpfulLibraries.OrchardCore.dll - true - - - CP0002 - M:Microsoft.Extensions.DependencyInjection.ResourceManagerContentSecurityPolicyProvider.get_ResourceName - lib/net8.0/Lombiq.HelpfulLibraries.OrchardCore.dll - lib/net8.0/Lombiq.HelpfulLibraries.OrchardCore.dll - true - - - CP0002 - M:Microsoft.Extensions.DependencyInjection.ResourceManagerContentSecurityPolicyProvider.get_ResourceType - lib/net8.0/Lombiq.HelpfulLibraries.OrchardCore.dll - lib/net8.0/Lombiq.HelpfulLibraries.OrchardCore.dll - true - - - CP0002 - M:Microsoft.Extensions.DependencyInjection.SecurityOrchardCoreBuilderExtensions.ConfigureSecurityDefaults(Microsoft.Extensions.DependencyInjection.OrchardCoreBuilder,System.Boolean,System.Boolean) - lib/net8.0/Lombiq.HelpfulLibraries.OrchardCore.dll - lib/net8.0/Lombiq.HelpfulLibraries.OrchardCore.dll - true - - - CP0002 - M:Microsoft.Extensions.DependencyInjection.SecurityOrchardCoreBuilderExtensions.ConfigureSecurityDefaultsWithStaticFiles(Microsoft.Extensions.DependencyInjection.OrchardCoreBuilder,System.Boolean,System.Boolean) - lib/net8.0/Lombiq.HelpfulLibraries.OrchardCore.dll - lib/net8.0/Lombiq.HelpfulLibraries.OrchardCore.dll - true - - - CP0002 - M:OrchardCore.ContentManagement.ContentManagerExtensions.GetAsync``1(OrchardCore.ContentManagement.IContentManager,System.String) - lib/net8.0/Lombiq.HelpfulLibraries.OrchardCore.dll - lib/net8.0/Lombiq.HelpfulLibraries.OrchardCore.dll - true - - - CP0002 - M:OrchardCore.ContentOrchardHelperExtensions.GetItemEditUrlAsync(OrchardCore.IOrchardHelper,OrchardCore.ContentManagement.ContentItem) - lib/net8.0/Lombiq.HelpfulLibraries.OrchardCore.dll - lib/net8.0/Lombiq.HelpfulLibraries.OrchardCore.dll - true - - - CP0002 - M:OrchardCore.DisplayManagement.Handlers.BuildEditorContextExtensions.CreateModelMaybeAsync``1(OrchardCore.DisplayManagement.Handlers.BuildEditorContext,System.String,System.String,System.Func{System.Threading.Tasks.Task{System.Boolean}}) - lib/net8.0/Lombiq.HelpfulLibraries.OrchardCore.dll - lib/net8.0/Lombiq.HelpfulLibraries.OrchardCore.dll - true - - - CP0002 - M:OrchardCore.DisplayManagement.Implementation.ShapeExtensions.AddTenantReloadWarning(OrchardCore.DisplayManagement.IShape) - lib/net8.0/Lombiq.HelpfulLibraries.OrchardCore.dll - lib/net8.0/Lombiq.HelpfulLibraries.OrchardCore.dll - true - - - CP0002 - M:OrchardCore.DisplayManagement.Implementation.ShapeExtensions.CreateAdHocShape(OrchardCore.DisplayManagement.Descriptors.ShapeTable,System.String,System.Func{OrchardCore.DisplayManagement.Implementation.DisplayContext,System.Threading.Tasks.Task{Microsoft.AspNetCore.Html.IHtmlContent}}) - lib/net8.0/Lombiq.HelpfulLibraries.OrchardCore.dll - lib/net8.0/Lombiq.HelpfulLibraries.OrchardCore.dll - true - - - CP0002 - M:OrchardCore.DisplayManagement.Implementation.ShapeExtensions.CreateAdHocShapeForCurrentThemeAsync(System.IServiceProvider,System.String,System.Func{OrchardCore.DisplayManagement.Implementation.DisplayContext,System.Threading.Tasks.Task{Microsoft.AspNetCore.Html.IHtmlContent}}) - lib/net8.0/Lombiq.HelpfulLibraries.OrchardCore.dll - lib/net8.0/Lombiq.HelpfulLibraries.OrchardCore.dll - true - - \ No newline at end of file diff --git a/Lombiq.HelpfulLibraries.Refit/CompatibilitySuppressions.xml b/Lombiq.HelpfulLibraries.Refit/CompatibilitySuppressions.xml deleted file mode 100644 index aadc6c35..00000000 --- a/Lombiq.HelpfulLibraries.Refit/CompatibilitySuppressions.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - CP0001 - T:Lombiq.HelpfulLibraries.Refit.Helpers.RefitHelper - lib/netstandard2.0/Lombiq.HelpfulLibraries.Refit.dll - lib/netstandard2.0/Lombiq.HelpfulLibraries.Refit.dll - true - - \ No newline at end of file From 40662542a95dfa94a08bf3d4e5c131f1941b5867 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A1ra=20El-Saig?= Date: Thu, 8 Jan 2026 12:50:16 +0100 Subject: [PATCH 04/74] Fix HL warnings. --- ...rdedHeadersApplicationBuilderExtensions.cs | 2 +- .../Contents/CommonContentDisplayTypes.cs | 2 +- .../ContentOrchardHelperExtensions.cs | 5 +++++ .../Docs/Elasticsearch.md | 2 +- .../Elasticsearch/ConfigurationExtensions.cs | 21 ++++++++++++++----- .../Elasticsearch/ResponseExtensions.cs | 8 +++---- ...yAttributeContentSecurityPolicyProvider.cs | 20 ++++++++++-------- .../Shapes/PerTenantShapeTableManager.cs | 6 +----- 8 files changed, 40 insertions(+), 26 deletions(-) diff --git a/Lombiq.HelpfulLibraries.AspNetCore/Extensions/ForwardedHeadersApplicationBuilderExtensions.cs b/Lombiq.HelpfulLibraries.AspNetCore/Extensions/ForwardedHeadersApplicationBuilderExtensions.cs index 97443767..0a0d6356 100644 --- a/Lombiq.HelpfulLibraries.AspNetCore/Extensions/ForwardedHeadersApplicationBuilderExtensions.cs +++ b/Lombiq.HelpfulLibraries.AspNetCore/Extensions/ForwardedHeadersApplicationBuilderExtensions.cs @@ -32,7 +32,7 @@ public static IApplicationBuilder UseForwardedHeadersForCloudflareAndAzure(this }; // These are not all known for Cloudflare and Azure. - forwardedHeadersOptions.KnownNetworks.Clear(); + forwardedHeadersOptions.KnownIPNetworks.Clear(); forwardedHeadersOptions.KnownProxies.Clear(); builder.UseForwardedHeaders(forwardedHeadersOptions); diff --git a/Lombiq.HelpfulLibraries.OrchardCore/Contents/CommonContentDisplayTypes.cs b/Lombiq.HelpfulLibraries.OrchardCore/Contents/CommonContentDisplayTypes.cs index fbe43af9..a71c4733 100644 --- a/Lombiq.HelpfulLibraries.OrchardCore/Contents/CommonContentDisplayTypes.cs +++ b/Lombiq.HelpfulLibraries.OrchardCore/Contents/CommonContentDisplayTypes.cs @@ -4,7 +4,7 @@ namespace Lombiq.HelpfulLibraries.OrchardCore.Contents; /// /// Values that can be used with or to safely select the correct display type. +/// cref="ContentOrchardRazorHelperExtensions.DisplayAsync"/> to safely select the correct display type. /// public static class CommonContentDisplayTypes { diff --git a/Lombiq.HelpfulLibraries.OrchardCore/Contents/ContentOrchardHelperExtensions.cs b/Lombiq.HelpfulLibraries.OrchardCore/Contents/ContentOrchardHelperExtensions.cs index 4616e30d..0fe99ebd 100644 --- a/Lombiq.HelpfulLibraries.OrchardCore/Contents/ContentOrchardHelperExtensions.cs +++ b/Lombiq.HelpfulLibraries.OrchardCore/Contents/ContentOrchardHelperExtensions.cs @@ -88,8 +88,13 @@ public static IUrlHelper GetUrlHelper(this IOrchardHelper orchardHelper) { var serviceProvider = orchardHelper.HttpContext.RequestServices; var urlHelperFactory = serviceProvider.GetRequiredService(); + + // It's required by ASP.NET Core's IUrlHelperFactory at the time of writing: + // https://github.com/aspnet/Mvc/blob/04ce6ca/src/Microsoft.AspNetCore.Mvc.Core/Routing/IUrlHelperFactory.cs#L9 +#pragma warning disable ASPDEPR006 // Interface 'Microsoft.AspNetCore.Mvc.Infrastructure.IActionContextAccessor' is obsolete. var actionContext = serviceProvider.GetService()?.ActionContext ?? throw new InvalidOperationException("Couldn't access the action context."); +#pragma warning restore ASPDEPR006 // Interface 'Microsoft.AspNetCore.Mvc.Infrastructure.IActionContextAccessor' is obsolete. return urlHelperFactory.GetUrlHelper(actionContext); } diff --git a/Lombiq.HelpfulLibraries.OrchardCore/Docs/Elasticsearch.md b/Lombiq.HelpfulLibraries.OrchardCore/Docs/Elasticsearch.md index 7f5f609e..33403407 100644 --- a/Lombiq.HelpfulLibraries.OrchardCore/Docs/Elasticsearch.md +++ b/Lombiq.HelpfulLibraries.OrchardCore/Docs/Elasticsearch.md @@ -4,4 +4,4 @@ - `ElasticIndexManagerExtensions`: Adds extension methods for the `ElasticIndexManager` like `DeleteAllIndexesAsync`. - `ResponseExtensions`: Adds extension methods for handling response objects from the `IElasticClient` like `ThrowIfFailed`. -- `ConfigurationExtensions`: Adds extension methods for configuration like `CreateElasticClient`. +- `ConfigurationExtensions`: Adds extension methods for configuration like `CreateElasticsearchClient`. diff --git a/Lombiq.HelpfulLibraries.OrchardCore/Elasticsearch/ConfigurationExtensions.cs b/Lombiq.HelpfulLibraries.OrchardCore/Elasticsearch/ConfigurationExtensions.cs index a22ebf5b..53a27081 100644 --- a/Lombiq.HelpfulLibraries.OrchardCore/Elasticsearch/ConfigurationExtensions.cs +++ b/Lombiq.HelpfulLibraries.OrchardCore/Elasticsearch/ConfigurationExtensions.cs @@ -1,16 +1,27 @@ +using Elastic.Clients.Elasticsearch; using Microsoft.Extensions.Configuration; -using Nest; +using Microsoft.Extensions.Logging.Abstractions; using OrchardCore.Search.Elasticsearch.Core.Models; +using OrchardCore.Search.Elasticsearch.Core.Services; +using System; namespace OrchardCore.Environment.Shell.Configuration; public static class ConfigurationExtensions { - public static IElasticClient CreateElasticClient(this IShellConfiguration shellConfiguration) + [Obsolete($"Use {nameof(CreateElasticsearchClient)} instead.")] + public static ElasticsearchClient CreateElasticClient(this IShellConfiguration shellConfiguration) => + shellConfiguration.CreateElasticsearchClient(); + + public static ElasticsearchClient CreateElasticsearchClient( + this IShellConfiguration shellConfiguration, + IElasticsearchClientFactory? factory = null) { - var configuration = shellConfiguration.GetSection("OrchardCore_Elasticsearch"); - var elasticConfiguration = configuration.Get(); + factory ??= new ElasticsearchClientFactory(NullLogger.Instance); + + var configuration = shellConfiguration.GetSection(ElasticsearchConnectionOptionsConfigurations.ConfigSectionName); + var connectionOptions = configuration.Get(); - return new ElasticClient(elasticConfiguration?.GetConnectionSettings()); + return factory.Create(connectionOptions); } } diff --git a/Lombiq.HelpfulLibraries.OrchardCore/Elasticsearch/ResponseExtensions.cs b/Lombiq.HelpfulLibraries.OrchardCore/Elasticsearch/ResponseExtensions.cs index e1085c38..87b0aae5 100644 --- a/Lombiq.HelpfulLibraries.OrchardCore/Elasticsearch/ResponseExtensions.cs +++ b/Lombiq.HelpfulLibraries.OrchardCore/Elasticsearch/ResponseExtensions.cs @@ -1,13 +1,13 @@ +using Elastic.Transport.Products.Elasticsearch; using System; - -namespace Nest; +namespace Elastic.Clients.Elasticsearch.Core; public static class ResponseExtensions { public static T ThrowIfFailed(this T response, string? message = null) - where T : ResponseBase + where T : ElasticsearchResponse { - if (response.IsValid) return response; + if (response.IsValidResponse) return response; if (!string.IsNullOrWhiteSpace(message)) message = $" ({message.Trim()})"; var error = $"Elasticsearch operation failed{message}. {response.DebugInformation}"; diff --git a/Lombiq.HelpfulLibraries.OrchardCore/Security/ContentSecurityPolicyAttributeContentSecurityPolicyProvider.cs b/Lombiq.HelpfulLibraries.OrchardCore/Security/ContentSecurityPolicyAttributeContentSecurityPolicyProvider.cs index 2239147d..03b18d32 100644 --- a/Lombiq.HelpfulLibraries.OrchardCore/Security/ContentSecurityPolicyAttributeContentSecurityPolicyProvider.cs +++ b/Lombiq.HelpfulLibraries.OrchardCore/Security/ContentSecurityPolicyAttributeContentSecurityPolicyProvider.cs @@ -60,16 +60,18 @@ public class ContentSecurityPolicyAttributeContentSecurityPolicyProvider : ICont { public ValueTask UpdateAsync(IDictionary securityPolicies, HttpContext context) { - if (context.RequestServices.GetService() is - { ActionContext.ActionDescriptor: ControllerActionDescriptor actionDescriptor }) + var attributes = context + .GetEndpoint()? + .RequestDelegate? + .Method + .GetCustomAttributes() ?? []; + + foreach (var attribute in attributes) { - foreach (var attribute in actionDescriptor.MethodInfo.GetCustomAttributes()) - { - ContentSecurityPolicyProvider.MergeDirectiveValues( - securityPolicies, - attribute.DirectiveNames, - attribute.DirectiveValue); - } + ContentSecurityPolicyProvider.MergeDirectiveValues( + securityPolicies, + attribute.DirectiveNames, + attribute.DirectiveValue); } return ValueTask.CompletedTask; diff --git a/Lombiq.HelpfulLibraries.OrchardCore/Shapes/PerTenantShapeTableManager.cs b/Lombiq.HelpfulLibraries.OrchardCore/Shapes/PerTenantShapeTableManager.cs index 55e5c609..a7bea903 100644 --- a/Lombiq.HelpfulLibraries.OrchardCore/Shapes/PerTenantShapeTableManager.cs +++ b/Lombiq.HelpfulLibraries.OrchardCore/Shapes/PerTenantShapeTableManager.cs @@ -111,8 +111,6 @@ public async Task GetShapeTableAsync(string themeId) .Select((id, index) => new { id, index }) .ToDictionary(item => item.id, item => item.index); - var concurrentShapeDescriptors = new ConcurrentDictionary(shapeDescriptors); - // Using the dictionary for O(1) index retrieval instead of O(n) in a list. var descriptors = shapeDescriptors .Where(shapeDescriptor => featureIdIndexLookup.ContainsKey(shapeDescriptor.Value.Feature.Id) && @@ -121,9 +119,7 @@ public async Task GetShapeTableAsync(string themeId) .GroupBy(shapeDescriptor => shapeDescriptor.Value.ShapeType, StringComparer.OrdinalIgnoreCase) .Select(group => new ShapeDescriptorIndex( shapeType: group.Key, - alterationKeys: group.Select(kv => kv.Key), - descriptors: concurrentShapeDescriptors - )) + alterations: group.Select(pair => pair.Value))) .ToList(); shapeTable = new ShapeTable( From b1e31f0ce9e42ace66ff5bbc4c1068441a12ad5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A1ra=20El-Saig?= Date: Fri, 9 Jan 2026 01:30:21 +0100 Subject: [PATCH 05/74] Fix various errors. --- Lombiq.HelpfulLibraries.OrchardCore/Docs/Elasticsearch.md | 2 +- .../UnitTests/Extensions/SafeJsonTests.cs | 6 +++--- .../UnitTests/Services/ManualConnectingIndexServiceTests.cs | 3 ++- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Lombiq.HelpfulLibraries.OrchardCore/Docs/Elasticsearch.md b/Lombiq.HelpfulLibraries.OrchardCore/Docs/Elasticsearch.md index 33403407..6fa793d9 100644 --- a/Lombiq.HelpfulLibraries.OrchardCore/Docs/Elasticsearch.md +++ b/Lombiq.HelpfulLibraries.OrchardCore/Docs/Elasticsearch.md @@ -3,5 +3,5 @@ ## Extensions - `ElasticIndexManagerExtensions`: Adds extension methods for the `ElasticIndexManager` like `DeleteAllIndexesAsync`. -- `ResponseExtensions`: Adds extension methods for handling response objects from the `IElasticClient` like `ThrowIfFailed`. +- `ResponseExtensions`: Adds extension methods for handling response objects from the `ElasticsearchClient` like `ThrowIfFailed`. - `ConfigurationExtensions`: Adds extension methods for configuration like `CreateElasticsearchClient`. diff --git a/Lombiq.HelpfulLibraries.Tests/UnitTests/Extensions/SafeJsonTests.cs b/Lombiq.HelpfulLibraries.Tests/UnitTests/Extensions/SafeJsonTests.cs index 5c1b5dcd..17651618 100644 --- a/Lombiq.HelpfulLibraries.Tests/UnitTests/Extensions/SafeJsonTests.cs +++ b/Lombiq.HelpfulLibraries.Tests/UnitTests/Extensions/SafeJsonTests.cs @@ -120,7 +120,7 @@ private static async Task> SafeJsonToDictionaryAsync( private sealed record TestResults( ListLoggerProvider LoggerProvider, - Dictionary Failure, - Dictionary FailureAsync, - Dictionary Success); + IDictionary Failure, + IDictionary FailureAsync, + IDictionary Success); } diff --git a/Lombiq.HelpfulLibraries.Tests/UnitTests/Services/ManualConnectingIndexServiceTests.cs b/Lombiq.HelpfulLibraries.Tests/UnitTests/Services/ManualConnectingIndexServiceTests.cs index 8aa64297..eaf8c5ba 100644 --- a/Lombiq.HelpfulLibraries.Tests/UnitTests/Services/ManualConnectingIndexServiceTests.cs +++ b/Lombiq.HelpfulLibraries.Tests/UnitTests/Services/ManualConnectingIndexServiceTests.cs @@ -1,6 +1,7 @@ using Lombiq.HelpfulLibraries.Tests.Models; using Shouldly; using System; +using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Xunit; @@ -25,7 +26,7 @@ public Task IndicesShouldHaveMatchingDocuments() => _fixture.SessionAsync(async var indices = (await session.QueryIndex().ListAsync()).ToList(); indices.ShouldNotBeEmpty(); - var documents = (await session.Query().ListAsync()) + IDictionary documents = (await session.Query().ListAsync()) .ToDictionary(document => document.Name); foreach (var index in indices) documents.ShouldContainKey(NamePrefix + index.Number.ToTechnicalString()); }); From 1ae336cbab84010884030f7664c8740eb4e9b291 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A1ra=20El-Saig?= Date: Fri, 9 Jan 2026 12:19:33 +0100 Subject: [PATCH 06/74] Add GetAllElasticsearchIndexesAsync extension. --- .../ElasticsearchIndexProfileStoreExtensions.cs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 Lombiq.HelpfulLibraries.OrchardCore/Elasticsearch/ElasticsearchIndexProfileStoreExtensions.cs diff --git a/Lombiq.HelpfulLibraries.OrchardCore/Elasticsearch/ElasticsearchIndexProfileStoreExtensions.cs b/Lombiq.HelpfulLibraries.OrchardCore/Elasticsearch/ElasticsearchIndexProfileStoreExtensions.cs new file mode 100644 index 00000000..3531ab24 --- /dev/null +++ b/Lombiq.HelpfulLibraries.OrchardCore/Elasticsearch/ElasticsearchIndexProfileStoreExtensions.cs @@ -0,0 +1,17 @@ + +using OrchardCore.Indexing.Models; +using OrchardCore.Search.Elasticsearch; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +namespace OrchardCore.Indexing; + +public static class ElasticsearchIndexProfileStoreExtensions +{ + /// + /// Returns only the Elasticsearch indexes from the . + /// + public static async Task> GetAllElasticsearchIndexesAsync(this IIndexProfileStore store) => + (await store.GetAllAsync()) + .Where(profile => profile.ProviderName == ElasticsearchConstants.ProviderName); +} From fd066aa9b31ed38fe302dde472c30e34fe7e2511 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A1ra=20El-Saig?= Date: Fri, 9 Jan 2026 13:36:14 +0100 Subject: [PATCH 07/74] Fix obsolete IActionContextAccessor usage. --- .../ContentOrchardHelperExtensions.cs | 47 ++++++++++++++++--- 1 file changed, 40 insertions(+), 7 deletions(-) diff --git a/Lombiq.HelpfulLibraries.OrchardCore/Contents/ContentOrchardHelperExtensions.cs b/Lombiq.HelpfulLibraries.OrchardCore/Contents/ContentOrchardHelperExtensions.cs index 0fe99ebd..b6c366c3 100644 --- a/Lombiq.HelpfulLibraries.OrchardCore/Contents/ContentOrchardHelperExtensions.cs +++ b/Lombiq.HelpfulLibraries.OrchardCore/Contents/ContentOrchardHelperExtensions.cs @@ -1,9 +1,9 @@ using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; -using Microsoft.AspNetCore.Mvc.Infrastructure; using Microsoft.AspNetCore.Mvc.Routing; using Microsoft.Extensions.DependencyInjection; using OrchardCore.ContentManagement; +using OrchardCore.DisplayManagement.Extensions; using System; using System.Diagnostics.CodeAnalysis; using System.Linq.Expressions; @@ -17,6 +17,7 @@ public static class ContentOrchardHelperExtensions /// Gets the given content item's edit URL. /// [SuppressMessage("Design", "CA1055:URI-like return values should not be strings", Justification = "It only returns relative URL.")] + [Obsolete($"Use {nameof(GetItemEditUrlAsync)} instead.")] public static string GetItemEditUrl(this IOrchardHelper orchardHelper, ContentItem contentItem) => orchardHelper.GetItemEditUrl(contentItem.ContentItemId); @@ -24,22 +25,51 @@ public static string GetItemEditUrl(this IOrchardHelper orchardHelper, ContentIt /// Gets the given content item's edit URL. /// [SuppressMessage("Design", "CA1055:URI-like return values should not be strings", Justification = "It only returns relative URL.")] + public static Task GetItemEditUrlAsync(this IOrchardHelper orchardHelper, ContentItem contentItem) => + orchardHelper.GetItemEditUrlAsync(contentItem.ContentItemId); + + /// + /// Gets the given content item's edit URL. + /// + [SuppressMessage("Design", "CA1055:URI-like return values should not be strings", Justification = "It only returns relative URL.")] + [Obsolete($"Use {nameof(GetItemEditUrlAsync)} instead.")] public static string GetItemEditUrl(this IOrchardHelper orchardHelper, string contentItemId) { var urlHelper = orchardHelper.GetUrlHelper(); return urlHelper.EditContentItem(contentItemId); } + /// + /// Gets the given content item's edit URL. + /// + [SuppressMessage("Design", "CA1055:URI-like return values should not be strings", Justification = "It only returns relative URL.")] + public static async Task GetItemEditUrlAsync(this IOrchardHelper orchardHelper, string contentItemId) + { + var urlHelper = await orchardHelper.GetUrlHelperAsync(); + return urlHelper.EditContentItem(contentItemId); + } + /// /// Gets the given content item's display URL. /// [SuppressMessage("Design", "CA1055:URI-like return values should not be strings", Justification = "It only returns relative URL.")] + [Obsolete($"Use {nameof(GetItemDisplayUrlAsync)} instead.")] public static string GetItemDisplayUrl(this IOrchardHelper orchardHelper, string contentItemId) { var urlHelper = orchardHelper.GetUrlHelper(); return urlHelper.DisplayContentItem(contentItemId); } + /// + /// Gets the given content item's display URL. + /// + [SuppressMessage("Design", "CA1055:URI-like return values should not be strings", Justification = "It only returns relative URL.")] + public static async Task GetItemDisplayUrlAsync(this IOrchardHelper orchardHelper, string contentItemId) + { + var urlHelper = await orchardHelper.GetUrlHelperAsync(); + return urlHelper.DisplayContentItem(contentItemId); + } + /// /// Runs a getter delegate to get a content item or loads the item currently viewed via Content Preview. /// @@ -84,17 +114,20 @@ public static string Action( /// /// Constructs a new instance using the current . /// - public static IUrlHelper GetUrlHelper(this IOrchardHelper orchardHelper) + [Obsolete($"Use {nameof(GetUrlHelperAsync)} instead.")] + public static IUrlHelper GetUrlHelper(this IOrchardHelper orchardHelper) => + orchardHelper.GetUrlHelperAsync().Result; + + /// + /// Constructs a new instance using the current . + /// + public static async Task GetUrlHelperAsync(this IOrchardHelper orchardHelper) { var serviceProvider = orchardHelper.HttpContext.RequestServices; var urlHelperFactory = serviceProvider.GetRequiredService(); - // It's required by ASP.NET Core's IUrlHelperFactory at the time of writing: - // https://github.com/aspnet/Mvc/blob/04ce6ca/src/Microsoft.AspNetCore.Mvc.Core/Routing/IUrlHelperFactory.cs#L9 -#pragma warning disable ASPDEPR006 // Interface 'Microsoft.AspNetCore.Mvc.Infrastructure.IActionContextAccessor' is obsolete. - var actionContext = serviceProvider.GetService()?.ActionContext ?? + var actionContext = await orchardHelper.HttpContext.GetActionContextAsync() ?? throw new InvalidOperationException("Couldn't access the action context."); -#pragma warning restore ASPDEPR006 // Interface 'Microsoft.AspNetCore.Mvc.Infrastructure.IActionContextAccessor' is obsolete. return urlHelperFactory.GetUrlHelper(actionContext); } From d561e51690f7155f360f3a443de9c51eca9d0566 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A1ra=20El-Saig?= Date: Fri, 9 Jan 2026 18:01:38 +0100 Subject: [PATCH 08/74] Fix remaining warnings. --- .../Extensions/ZipArchiveExtensions.cs | 4 ++-- .../Contents/ContentOrchardHelperExtensions.cs | 14 +++++++------- ...ElasticsearchIndexProfileStoreExtensions.cs | 1 - .../ResourceFilterBuilder.cs | 5 +++-- ...cyAttributeContentSecurityPolicyProvider.cs | 2 -- .../Shapes/PerTenantShapeTableManager.cs | 1 - .../ManualConnectingIndexServiceFixture.cs | 4 ++-- .../ManualConnectingIndexServiceTests.cs | 18 +++++++++++++----- 8 files changed, 27 insertions(+), 22 deletions(-) diff --git a/Lombiq.HelpfulLibraries.Common/Extensions/ZipArchiveExtensions.cs b/Lombiq.HelpfulLibraries.Common/Extensions/ZipArchiveExtensions.cs index c556a5e0..a210856d 100644 --- a/Lombiq.HelpfulLibraries.Common/Extensions/ZipArchiveExtensions.cs +++ b/Lombiq.HelpfulLibraries.Common/Extensions/ZipArchiveExtensions.cs @@ -10,7 +10,7 @@ public static class ZipArchiveExtensions /// public static async Task CreateTextEntryAsync(this ZipArchive zip, string entryName, IEnumerable? lines) { - await using var writer = new StreamWriter(zip.CreateEntry(entryName).Open()); + await using var writer = new StreamWriter(await zip.CreateEntry(entryName).OpenAsync()); if (lines == null) return; @@ -31,7 +31,7 @@ public static Task CreateTextEntryAsync(this ZipArchive zip, string entryName, s /// public static async Task CreateBinaryEntryAsync(this ZipArchive zip, string entryName, ReadOnlyMemory data) { - await using var stream = zip.CreateEntry(entryName).Open(); + await using var stream = await zip.CreateEntry(entryName).OpenAsync(); await stream.WriteAsync(data); } } diff --git a/Lombiq.HelpfulLibraries.OrchardCore/Contents/ContentOrchardHelperExtensions.cs b/Lombiq.HelpfulLibraries.OrchardCore/Contents/ContentOrchardHelperExtensions.cs index b6c366c3..f682ad2f 100644 --- a/Lombiq.HelpfulLibraries.OrchardCore/Contents/ContentOrchardHelperExtensions.cs +++ b/Lombiq.HelpfulLibraries.OrchardCore/Contents/ContentOrchardHelperExtensions.cs @@ -21,13 +21,6 @@ public static class ContentOrchardHelperExtensions public static string GetItemEditUrl(this IOrchardHelper orchardHelper, ContentItem contentItem) => orchardHelper.GetItemEditUrl(contentItem.ContentItemId); - /// - /// Gets the given content item's edit URL. - /// - [SuppressMessage("Design", "CA1055:URI-like return values should not be strings", Justification = "It only returns relative URL.")] - public static Task GetItemEditUrlAsync(this IOrchardHelper orchardHelper, ContentItem contentItem) => - orchardHelper.GetItemEditUrlAsync(contentItem.ContentItemId); - /// /// Gets the given content item's edit URL. /// @@ -39,6 +32,13 @@ public static string GetItemEditUrl(this IOrchardHelper orchardHelper, string co return urlHelper.EditContentItem(contentItemId); } + /// + /// Gets the given content item's edit URL. + /// + [SuppressMessage("Design", "CA1055:URI-like return values should not be strings", Justification = "It only returns relative URL.")] + public static Task GetItemEditUrlAsync(this IOrchardHelper orchardHelper, ContentItem contentItem) => + orchardHelper.GetItemEditUrlAsync(contentItem.ContentItemId); + /// /// Gets the given content item's edit URL. /// diff --git a/Lombiq.HelpfulLibraries.OrchardCore/Elasticsearch/ElasticsearchIndexProfileStoreExtensions.cs b/Lombiq.HelpfulLibraries.OrchardCore/Elasticsearch/ElasticsearchIndexProfileStoreExtensions.cs index 3531ab24..7c0c786f 100644 --- a/Lombiq.HelpfulLibraries.OrchardCore/Elasticsearch/ElasticsearchIndexProfileStoreExtensions.cs +++ b/Lombiq.HelpfulLibraries.OrchardCore/Elasticsearch/ElasticsearchIndexProfileStoreExtensions.cs @@ -1,4 +1,3 @@ - using OrchardCore.Indexing.Models; using OrchardCore.Search.Elasticsearch; using System.Collections.Generic; diff --git a/Lombiq.HelpfulLibraries.OrchardCore/ResourceManagement/ResourceFilterBuilder.cs b/Lombiq.HelpfulLibraries.OrchardCore/ResourceManagement/ResourceFilterBuilder.cs index 9ccab90c..1d49482a 100644 --- a/Lombiq.HelpfulLibraries.OrchardCore/ResourceManagement/ResourceFilterBuilder.cs +++ b/Lombiq.HelpfulLibraries.OrchardCore/ResourceManagement/ResourceFilterBuilder.cs @@ -163,8 +163,9 @@ private ResourceFilter WhenContentTypeInner(string displayType, params string[] // We check for both published and draft content items. session.QueryIndex(index => index.Published || (index.Latest && !index.Published)) : session.QueryContentItemIndex(PublicationStatus.Published); - var contentItemIndex = await query.Where(index => index.ContentItemId == contentItemId) - .FirstOrDefaultAsync(); + var contentItemIndex = await query + .Where(index => index.ContentItemId == contentItemId) + .FirstOrDefaultAsync(context.RequestAborted); return contentItemIndex?.ContentType is { } contentType && contentTypes.Contains(contentType, StringComparer.OrdinalIgnoreCase); }); diff --git a/Lombiq.HelpfulLibraries.OrchardCore/Security/ContentSecurityPolicyAttributeContentSecurityPolicyProvider.cs b/Lombiq.HelpfulLibraries.OrchardCore/Security/ContentSecurityPolicyAttributeContentSecurityPolicyProvider.cs index 03b18d32..2511c603 100644 --- a/Lombiq.HelpfulLibraries.OrchardCore/Security/ContentSecurityPolicyAttributeContentSecurityPolicyProvider.cs +++ b/Lombiq.HelpfulLibraries.OrchardCore/Security/ContentSecurityPolicyAttributeContentSecurityPolicyProvider.cs @@ -1,7 +1,5 @@ using Lombiq.HelpfulLibraries.AspNetCore.Security; using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Mvc.Controllers; -using Microsoft.AspNetCore.Mvc.Infrastructure; using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; diff --git a/Lombiq.HelpfulLibraries.OrchardCore/Shapes/PerTenantShapeTableManager.cs b/Lombiq.HelpfulLibraries.OrchardCore/Shapes/PerTenantShapeTableManager.cs index a7bea903..aebe61ed 100644 --- a/Lombiq.HelpfulLibraries.OrchardCore/Shapes/PerTenantShapeTableManager.cs +++ b/Lombiq.HelpfulLibraries.OrchardCore/Shapes/PerTenantShapeTableManager.cs @@ -9,7 +9,6 @@ using OrchardCore.Environment.Shell; using OrchardCore.Settings; using System; -using System.Collections.Concurrent; using System.Collections.Frozen; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; diff --git a/Lombiq.HelpfulLibraries.Tests/UnitTests/Services/ManualConnectingIndexServiceFixture.cs b/Lombiq.HelpfulLibraries.Tests/UnitTests/Services/ManualConnectingIndexServiceFixture.cs index 81d99577..7a99c014 100644 --- a/Lombiq.HelpfulLibraries.Tests/UnitTests/Services/ManualConnectingIndexServiceFixture.cs +++ b/Lombiq.HelpfulLibraries.Tests/UnitTests/Services/ManualConnectingIndexServiceFixture.cs @@ -44,9 +44,9 @@ public async Task SessionAsync(Func action) { if (Store == null) await CreateDatabaseAsync(); - await using var session = Store.CreateSession(); + await using var session = Store!.CreateSession(); await action(session); - await session.SaveChangesAsync(); + await session.SaveChangesAsync(Xunit.TestContext.Current.CancellationToken); } // We could have a diff --git a/Lombiq.HelpfulLibraries.Tests/UnitTests/Services/ManualConnectingIndexServiceTests.cs b/Lombiq.HelpfulLibraries.Tests/UnitTests/Services/ManualConnectingIndexServiceTests.cs index eaf8c5ba..088c2c0b 100644 --- a/Lombiq.HelpfulLibraries.Tests/UnitTests/Services/ManualConnectingIndexServiceTests.cs +++ b/Lombiq.HelpfulLibraries.Tests/UnitTests/Services/ManualConnectingIndexServiceTests.cs @@ -23,12 +23,17 @@ public class ManualConnectingIndexServiceTests : IClassFixture _fixture.SessionAsync(async session => { - var indices = (await session.QueryIndex().ListAsync()).ToList(); + var indices = (await session.QueryIndex().ListAsync(TestContext.Current.CancellationToken)).ToList(); indices.ShouldNotBeEmpty(); - IDictionary documents = (await session.Query().ListAsync()) + IDictionary documents = + (await session.Query().ListAsync(TestContext.Current.CancellationToken)) .ToDictionary(document => document.Name); - foreach (var index in indices) documents.ShouldContainKey(NamePrefix + index.Number.ToTechnicalString()); + + foreach (var index in indices) + { + documents.ShouldContainKey(NamePrefix + index.Number.ToTechnicalString()); + } }); [Fact] @@ -37,7 +42,7 @@ public Task AllIndexShouldRetrieveItsDocument() => _fixture.SessionAsync(async s // In the example 3's index was intentionally skipped and 6's index was deleted after the fact. var numbers = Enumerable.Range(0, 10).Where(i => i is not 3 and not 6).ToList(); var query = session.Query(index => index.Number.IsIn(numbers)); - var list = await query.ListAsync(); + var list = await query.ListAsync(TestContext.Current.CancellationToken); var documents = list.ToList(); documents.Select(document => document.Name) .ShouldBe(_fixture.Documents.Where((_, index) => index is not 3 and not 6).Select(document => document.Name)); @@ -46,7 +51,10 @@ public Task AllIndexShouldRetrieveItsDocument() => _fixture.SessionAsync(async s [Fact] public Task MissingOrDeletedIndexShouldNotRetrieveAnyDocument() => _fixture.SessionAsync(async session => { - var documents = (await session.Query(index => index.Number.IsIn(Numbers)).ListAsync()).ToList(); + var documents = (await session + .Query(index => index.Number.IsIn(Numbers)) + .ListAsync(TestContext.Current.CancellationToken)) + .AsList(); documents.ShouldBeEmpty(); }); } From c622d5b6e00fb0bcc8b639507c5f6195bb140713 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A1ra=20El-Saig?= Date: Fri, 9 Jan 2026 18:34:18 +0100 Subject: [PATCH 09/74] Upgrade Moq.AutoMock. --- .../Lombiq.HelpfulLibraries.OrchardCore.Testing.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lombiq.HelpfulLibraries.OrchardCore.Testing/Lombiq.HelpfulLibraries.OrchardCore.Testing.csproj b/Lombiq.HelpfulLibraries.OrchardCore.Testing/Lombiq.HelpfulLibraries.OrchardCore.Testing.csproj index c2931f6c..5fbeed43 100644 --- a/Lombiq.HelpfulLibraries.OrchardCore.Testing/Lombiq.HelpfulLibraries.OrchardCore.Testing.csproj +++ b/Lombiq.HelpfulLibraries.OrchardCore.Testing/Lombiq.HelpfulLibraries.OrchardCore.Testing.csproj @@ -24,7 +24,7 @@ - + From d8bda24a78852bafc598131141c831e1a784294e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A1ra=20El-Saig?= Date: Fri, 9 Jan 2026 18:43:52 +0100 Subject: [PATCH 10/74] Remove System.Linq.Async package references, since that's now part of .NET. --- .../Lombiq.HelpfulLibraries.Common.csproj | 1 - 1 file changed, 1 deletion(-) diff --git a/Lombiq.HelpfulLibraries.Common/Lombiq.HelpfulLibraries.Common.csproj b/Lombiq.HelpfulLibraries.Common/Lombiq.HelpfulLibraries.Common.csproj index 9926fc2f..4a5617bb 100644 --- a/Lombiq.HelpfulLibraries.Common/Lombiq.HelpfulLibraries.Common.csproj +++ b/Lombiq.HelpfulLibraries.Common/Lombiq.HelpfulLibraries.Common.csproj @@ -27,7 +27,6 @@ - From 86c585f5960a93b9eb25e3c394f74514b6e1fe89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A1ra=20El-Saig?= Date: Fri, 9 Jan 2026 18:44:33 +0100 Subject: [PATCH 11/74] Use "await foreach" instead of ".GetAsyncEnumerator()". --- .../Extensions/CommandExtensions.cs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/Lombiq.HelpfulLibraries.Cli/Extensions/CommandExtensions.cs b/Lombiq.HelpfulLibraries.Cli/Extensions/CommandExtensions.cs index cc7b857d..17f37197 100644 --- a/Lombiq.HelpfulLibraries.Cli/Extensions/CommandExtensions.cs +++ b/Lombiq.HelpfulLibraries.Cli/Extensions/CommandExtensions.cs @@ -29,16 +29,15 @@ public static async Task ExecuteUntilOutputAsync( Action? stdErrHandler = default, CancellationToken cancellationToken = default) { - await using var enumerator = command.ListenAsync(cancellationToken).GetAsyncEnumerator(cancellationToken); - - while (await enumerator.MoveNextAsync(cancellationToken)) + await foreach (var commandEvent in command.ListenAsync(cancellationToken)) { - if (enumerator.Current is StandardOutputCommandEvent stdOut && stdOut.Text.ContainsOrdinalIgnoreCase(outputToWaitFor)) + if (commandEvent is StandardOutputCommandEvent stdOut && + stdOut.Text.ContainsOrdinalIgnoreCase(outputToWaitFor)) { return; } - if (enumerator.Current is StandardErrorCommandEvent stdErr) + if (commandEvent is StandardErrorCommandEvent stdErr) { stdErrHandler?.Invoke(stdErr); } From 0a644921f1345c9cdc9d58b925167525369ef3c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A1ra=20El-Saig?= Date: Fri, 9 Jan 2026 23:35:28 +0100 Subject: [PATCH 12/74] Fix IsMvcRoute. --- .../Mvc/MvcActionContextExtensions.cs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/Lombiq.HelpfulLibraries.OrchardCore/Mvc/MvcActionContextExtensions.cs b/Lombiq.HelpfulLibraries.OrchardCore/Mvc/MvcActionContextExtensions.cs index f5858921..e323dcbe 100644 --- a/Lombiq.HelpfulLibraries.OrchardCore/Mvc/MvcActionContextExtensions.cs +++ b/Lombiq.HelpfulLibraries.OrchardCore/Mvc/MvcActionContextExtensions.cs @@ -18,13 +18,18 @@ public static bool IsMvcRoute( string? controller = null, string? area = null) { - var routeValues = context.ActionDescriptor.RouteValues; + static bool IsMatch(IDictionary routeValues, string key, string? expected) => + routeValues.TryGetValue(key, out var value) && + (expected?.EqualsOrdinalIgnoreCase(value) ?? value is null); - if (!string.IsNullOrEmpty(action) && routeValues["Action"]?.EqualsOrdinalIgnoreCase(action) != true) return false; - if (!string.IsNullOrEmpty(controller) && routeValues["Controller"]?.EqualsOrdinalIgnoreCase(controller) != true) return false; - if (!string.IsNullOrEmpty(area) && routeValues["Area"]?.EqualsOrdinalIgnoreCase(area) != true) return false; + var routeValues = new Dictionary( + context.ActionDescriptor.RouteValues, + StringComparer.OrdinalIgnoreCase); - return true; + return + IsMatch(routeValues, "Action", action) && + IsMatch(routeValues, "Controller", controller) && + IsMatch(routeValues, "Area", area); } /// From 4517d633094afd206e8a932aeaf848c36008492c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A1ra=20El-Saig?= Date: Fri, 9 Jan 2026 23:45:49 +0100 Subject: [PATCH 13/74] IDE0055: Fix formatting --- .../Mvc/MvcActionContextExtensions.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lombiq.HelpfulLibraries.OrchardCore/Mvc/MvcActionContextExtensions.cs b/Lombiq.HelpfulLibraries.OrchardCore/Mvc/MvcActionContextExtensions.cs index e323dcbe..46df8a5d 100644 --- a/Lombiq.HelpfulLibraries.OrchardCore/Mvc/MvcActionContextExtensions.cs +++ b/Lombiq.HelpfulLibraries.OrchardCore/Mvc/MvcActionContextExtensions.cs @@ -18,7 +18,7 @@ public static bool IsMvcRoute( string? controller = null, string? area = null) { - static bool IsMatch(IDictionary routeValues, string key, string? expected) => + static bool IsMatch(IDictionary routeValues, string key, string? expected) => routeValues.TryGetValue(key, out var value) && (expected?.EqualsOrdinalIgnoreCase(value) ?? value is null); From e319a3be5e2b671a6497f4b388dd6c4c03ca12bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A1ra=20El-Saig?= Date: Sat, 10 Jan 2026 23:27:52 +0100 Subject: [PATCH 14/74] Fix incorrect GetEndpoint usage in ContentSecurityPolicyAttributeContentSecurityPolicyProvider. --- ...icyAttributeContentSecurityPolicyProvider.cs | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/Lombiq.HelpfulLibraries.OrchardCore/Security/ContentSecurityPolicyAttributeContentSecurityPolicyProvider.cs b/Lombiq.HelpfulLibraries.OrchardCore/Security/ContentSecurityPolicyAttributeContentSecurityPolicyProvider.cs index 2511c603..44f888e9 100644 --- a/Lombiq.HelpfulLibraries.OrchardCore/Security/ContentSecurityPolicyAttributeContentSecurityPolicyProvider.cs +++ b/Lombiq.HelpfulLibraries.OrchardCore/Security/ContentSecurityPolicyAttributeContentSecurityPolicyProvider.cs @@ -1,8 +1,11 @@ using Lombiq.HelpfulLibraries.AspNetCore.Security; using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc.Controllers; +using OrchardCore.DisplayManagement.Extensions; using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; +using System.Linq; using System.Reflection; using System.Threading.Tasks; using static Lombiq.HelpfulLibraries.AspNetCore.Security.ContentSecurityPolicyDirectives; @@ -56,13 +59,13 @@ public ContentSecurityPolicyAttribute(string directiveValue, params string[] dir /// public class ContentSecurityPolicyAttributeContentSecurityPolicyProvider : IContentSecurityPolicyProvider { - public ValueTask UpdateAsync(IDictionary securityPolicies, HttpContext context) + public async ValueTask UpdateAsync(IDictionary securityPolicies, HttpContext context) { - var attributes = context - .GetEndpoint()? - .RequestDelegate? - .Method - .GetCustomAttributes() ?? []; + var actionContext = await context.GetActionContextAsync(); + var attributes = (actionContext?.ActionDescriptor as ControllerActionDescriptor)? + .MethodInfo + .GetCustomAttributes() + .ToList() ?? []; foreach (var attribute in attributes) { @@ -71,7 +74,5 @@ public ValueTask UpdateAsync(IDictionary securityPolicies, HttpC attribute.DirectiveNames, attribute.DirectiveValue); } - - return ValueTask.CompletedTask; } } From 2a6a3c2ae6af290f0bf0fd07e6b93ed788649e11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A1ra=20El-Saig?= Date: Sat, 10 Jan 2026 23:57:18 +0100 Subject: [PATCH 15/74] Same but for real this time. --- ...icyAttributeContentSecurityPolicyProvider.cs | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/Lombiq.HelpfulLibraries.OrchardCore/Security/ContentSecurityPolicyAttributeContentSecurityPolicyProvider.cs b/Lombiq.HelpfulLibraries.OrchardCore/Security/ContentSecurityPolicyAttributeContentSecurityPolicyProvider.cs index 44f888e9..52f4505e 100644 --- a/Lombiq.HelpfulLibraries.OrchardCore/Security/ContentSecurityPolicyAttributeContentSecurityPolicyProvider.cs +++ b/Lombiq.HelpfulLibraries.OrchardCore/Security/ContentSecurityPolicyAttributeContentSecurityPolicyProvider.cs @@ -2,6 +2,7 @@ using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc.Controllers; using OrchardCore.DisplayManagement.Extensions; +using OrchardCore.DisplayManagement.Razor; using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; @@ -59,13 +60,17 @@ public ContentSecurityPolicyAttribute(string directiveValue, params string[] dir /// public class ContentSecurityPolicyAttributeContentSecurityPolicyProvider : IContentSecurityPolicyProvider { - public async ValueTask UpdateAsync(IDictionary securityPolicies, HttpContext context) + public ValueTask UpdateAsync(IDictionary securityPolicies, HttpContext context) { - var actionContext = await context.GetActionContextAsync(); - var attributes = (actionContext?.ActionDescriptor as ControllerActionDescriptor)? + var actionDescriptor = context + .GetEndpoint()? + .Metadata + .CastWhere() + .FirstOrDefault(); + + var attributes = actionDescriptor? .MethodInfo - .GetCustomAttributes() - .ToList() ?? []; + .GetCustomAttributes() ?? []; foreach (var attribute in attributes) { @@ -74,5 +79,7 @@ public async ValueTask UpdateAsync(IDictionary securityPolicies, attribute.DirectiveNames, attribute.DirectiveValue); } + + return ValueTask.CompletedTask; } } From 84baacbee271ed7525f4a0c9e52613fbb3d77369 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A1ra=20El-Saig?= Date: Sun, 11 Jan 2026 00:11:41 +0100 Subject: [PATCH 16/74] Unusing. --- ...ntentSecurityPolicyAttributeContentSecurityPolicyProvider.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/Lombiq.HelpfulLibraries.OrchardCore/Security/ContentSecurityPolicyAttributeContentSecurityPolicyProvider.cs b/Lombiq.HelpfulLibraries.OrchardCore/Security/ContentSecurityPolicyAttributeContentSecurityPolicyProvider.cs index 52f4505e..7241e8c2 100644 --- a/Lombiq.HelpfulLibraries.OrchardCore/Security/ContentSecurityPolicyAttributeContentSecurityPolicyProvider.cs +++ b/Lombiq.HelpfulLibraries.OrchardCore/Security/ContentSecurityPolicyAttributeContentSecurityPolicyProvider.cs @@ -1,8 +1,6 @@ using Lombiq.HelpfulLibraries.AspNetCore.Security; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc.Controllers; -using OrchardCore.DisplayManagement.Extensions; -using OrchardCore.DisplayManagement.Razor; using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; From 1f97165d6681ee90ce536771e9a564c68e10aa77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A1ra=20El-Saig?= Date: Sun, 11 Jan 2026 00:45:12 +0100 Subject: [PATCH 17/74] Update all Microsoft packages. --- .../Lombiq.HelpfulLibraries.Common.csproj | 4 ++-- .../Lombiq.HelpfulLibraries.RestEase.csproj | 2 +- .../Lombiq.HelpfulLibraries.SourceGenerators.csproj | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Lombiq.HelpfulLibraries.Common/Lombiq.HelpfulLibraries.Common.csproj b/Lombiq.HelpfulLibraries.Common/Lombiq.HelpfulLibraries.Common.csproj index 4a5617bb..864ad2fb 100644 --- a/Lombiq.HelpfulLibraries.Common/Lombiq.HelpfulLibraries.Common.csproj +++ b/Lombiq.HelpfulLibraries.Common/Lombiq.HelpfulLibraries.Common.csproj @@ -25,8 +25,8 @@ - - + + diff --git a/Lombiq.HelpfulLibraries.RestEase/Lombiq.HelpfulLibraries.RestEase.csproj b/Lombiq.HelpfulLibraries.RestEase/Lombiq.HelpfulLibraries.RestEase.csproj index 9353ad01..7d13ced6 100644 --- a/Lombiq.HelpfulLibraries.RestEase/Lombiq.HelpfulLibraries.RestEase.csproj +++ b/Lombiq.HelpfulLibraries.RestEase/Lombiq.HelpfulLibraries.RestEase.csproj @@ -24,7 +24,7 @@ - + all diff --git a/Lombiq.HelpfulLibraries.SourceGenerators/Lombiq.HelpfulLibraries.SourceGenerators.csproj b/Lombiq.HelpfulLibraries.SourceGenerators/Lombiq.HelpfulLibraries.SourceGenerators.csproj index 3d4dd97b..838c16fd 100644 --- a/Lombiq.HelpfulLibraries.SourceGenerators/Lombiq.HelpfulLibraries.SourceGenerators.csproj +++ b/Lombiq.HelpfulLibraries.SourceGenerators/Lombiq.HelpfulLibraries.SourceGenerators.csproj @@ -34,7 +34,7 @@ - + From de9f32775b924e1de14898dc573b4583f2d7c3f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A1ra=20El-Saig?= Date: Sun, 11 Jan 2026 13:59:30 +0100 Subject: [PATCH 18/74] Fix LinqToDbSamplesShouldWorkCorrectly. --- ...Extensions.AssertSimpleQueryAsync.approved.json | 2 +- .../Extensions/TestCaseUITestContextExtensions.cs | 14 +++++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/Lombiq.HelpfulLibraries.Samples.Tests.UI/Extensions/TestCaseUITestContextExtensions.AssertSimpleQueryAsync.approved.json b/Lombiq.HelpfulLibraries.Samples.Tests.UI/Extensions/TestCaseUITestContextExtensions.AssertSimpleQueryAsync.approved.json index 76c7f9f1..67fdb25a 100644 --- a/Lombiq.HelpfulLibraries.Samples.Tests.UI/Extensions/TestCaseUITestContextExtensions.AssertSimpleQueryAsync.approved.json +++ b/Lombiq.HelpfulLibraries.Samples.Tests.UI/Extensions/TestCaseUITestContextExtensions.AssertSimpleQueryAsync.approved.json @@ -1 +1 @@ -[{"documentId":7,"contentItemId":"","path":"tags/space","published":true,"latest":true,"containedContentItemId":"","jsonPath":"TaxonomyPart.Terms[2]","id":12},{"documentId":7,"contentItemId":"","path":"tags/exploration","published":true,"latest":true,"containedContentItemId":"","jsonPath":"TaxonomyPart.Terms[1]","id":11},{"documentId":7,"contentItemId":"","path":"tags/earth","published":true,"latest":true,"containedContentItemId":"","jsonPath":"TaxonomyPart.Terms[0]","id":10},{"documentId":7,"contentItemId":"","path":"tags","published":true,"latest":true,"containedContentItemId":"","jsonPath":null,"id":9},{"documentId":8,"contentItemId":"","path":"categories/travel","published":true,"latest":true,"containedContentItemId":"","jsonPath":"TaxonomyPart.Terms[0]","id":18},{"documentId":8,"contentItemId":"","path":"categories","published":true,"latest":true,"containedContentItemId":"","jsonPath":null,"id":17},{"documentId":23,"contentItemId":"","path":"carousel-widget-example","published":true,"latest":true,"containedContentItemId":"","jsonPath":null,"id":31},{"documentId":11,"contentItemId":"","path":"about","published":true,"latest":true,"containedContentItemId":"","jsonPath":null,"id":27}] \ No newline at end of file +[{"documentId":7,"contentItemId":"","path":"tags/space","published":true,"latest":true,"containedContentItemId":"","jsonPath":"TaxonomyPart.Terms[2]"},{"documentId":7,"contentItemId":"","path":"tags/exploration","published":true,"latest":true,"containedContentItemId":"","jsonPath":"TaxonomyPart.Terms[1]"},{"documentId":7,"contentItemId":"","path":"tags/earth","published":true,"latest":true,"containedContentItemId":"","jsonPath":"TaxonomyPart.Terms[0]"},{"documentId":7,"contentItemId":"","path":"tags","published":true,"latest":true,"containedContentItemId":"","jsonPath":null},{"documentId":8,"contentItemId":"","path":"categories/travel","published":true,"latest":true,"containedContentItemId":"","jsonPath":"TaxonomyPart.Terms[0]"},{"documentId":8,"contentItemId":"","path":"categories","published":true,"latest":true,"containedContentItemId":"","jsonPath":null},{"documentId":23,"contentItemId":"","path":"carousel-widget-example","published":true,"latest":true,"containedContentItemId":"","jsonPath":null},{"documentId":11,"contentItemId":"","path":"about","published":true,"latest":true,"containedContentItemId":"","jsonPath":null}] \ No newline at end of file diff --git a/Lombiq.HelpfulLibraries.Samples.Tests.UI/Extensions/TestCaseUITestContextExtensions.cs b/Lombiq.HelpfulLibraries.Samples.Tests.UI/Extensions/TestCaseUITestContextExtensions.cs index c9f8d379..99a85c00 100644 --- a/Lombiq.HelpfulLibraries.Samples.Tests.UI/Extensions/TestCaseUITestContextExtensions.cs +++ b/Lombiq.HelpfulLibraries.Samples.Tests.UI/Extensions/TestCaseUITestContextExtensions.cs @@ -4,6 +4,7 @@ using Lombiq.Tests.UI.Services; using Shouldly; using System; +using System.Collections.Generic; using System.Net.Http; using System.Text.Json; using System.Text.Json.Nodes; @@ -28,8 +29,19 @@ private static async Task AssertSimpleQueryAsync(UITestContext context, HttpClie { var simpleQueryUrl = context.GetAbsoluteUrlOfAction(controller => controller.SimpleQuery()); var simpleQueryOutput = await client.GetStringAsync(simpleQueryUrl, context.Configuration.TestCancellationToken); + var simpleQueryParsed = JsonSerializer.Deserialize[]>(simpleQueryOutput); - simpleQueryOutput.ShouldMatchApproved( + // Cleanup received data. + foreach (var item in simpleQueryParsed) + { + // The "id" property represents the record's write order in the database. It's not relevant guaranteed to be + // consistent on different setups, and it's not relevant for this query. + item.Remove("id"); + } + + // The results are re-serialized into JSON using standard options, so they can be compared in a consistent way. + var reserialized = JsonSerializer.Serialize(simpleQueryParsed, JOptions.Default); + reserialized.ShouldMatchApproved( options => options .WithScrubber(ScrubContentItemIds) .WithFileExtension("json"), From ea8fbcf7896f494ca1bbe37cd0094a21d3ceebd2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A1ra=20El-Saig?= Date: Sun, 11 Jan 2026 22:52:43 +0100 Subject: [PATCH 19/74] Fix LinqToDbSamplesShouldWorkCorrectly. --- ...nsions.AssertSimpleQueryAsync.approved.json | 2 +- .../TestCaseUITestContextExtensions.cs | 18 +++++++++++------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/Lombiq.HelpfulLibraries.Samples.Tests.UI/Extensions/TestCaseUITestContextExtensions.AssertSimpleQueryAsync.approved.json b/Lombiq.HelpfulLibraries.Samples.Tests.UI/Extensions/TestCaseUITestContextExtensions.AssertSimpleQueryAsync.approved.json index 67fdb25a..8b72aa13 100644 --- a/Lombiq.HelpfulLibraries.Samples.Tests.UI/Extensions/TestCaseUITestContextExtensions.AssertSimpleQueryAsync.approved.json +++ b/Lombiq.HelpfulLibraries.Samples.Tests.UI/Extensions/TestCaseUITestContextExtensions.AssertSimpleQueryAsync.approved.json @@ -1 +1 @@ -[{"documentId":7,"contentItemId":"","path":"tags/space","published":true,"latest":true,"containedContentItemId":"","jsonPath":"TaxonomyPart.Terms[2]"},{"documentId":7,"contentItemId":"","path":"tags/exploration","published":true,"latest":true,"containedContentItemId":"","jsonPath":"TaxonomyPart.Terms[1]"},{"documentId":7,"contentItemId":"","path":"tags/earth","published":true,"latest":true,"containedContentItemId":"","jsonPath":"TaxonomyPart.Terms[0]"},{"documentId":7,"contentItemId":"","path":"tags","published":true,"latest":true,"containedContentItemId":"","jsonPath":null},{"documentId":8,"contentItemId":"","path":"categories/travel","published":true,"latest":true,"containedContentItemId":"","jsonPath":"TaxonomyPart.Terms[0]"},{"documentId":8,"contentItemId":"","path":"categories","published":true,"latest":true,"containedContentItemId":"","jsonPath":null},{"documentId":23,"contentItemId":"","path":"carousel-widget-example","published":true,"latest":true,"containedContentItemId":"","jsonPath":null},{"documentId":11,"contentItemId":"","path":"about","published":true,"latest":true,"containedContentItemId":"","jsonPath":null}] \ No newline at end of file +[{"containedContentItemId":"","contentItemId":"","jsonPath":"TaxonomyPart.Terms[2]","latest":true,"path":"tags/space","published":true},{"containedContentItemId":"","contentItemId":"","jsonPath":"TaxonomyPart.Terms[1]","latest":true,"path":"tags/exploration","published":true},{"containedContentItemId":"","contentItemId":"","jsonPath":"TaxonomyPart.Terms[0]","latest":true,"path":"tags/earth","published":true},{"containedContentItemId":"","contentItemId":"","jsonPath":null,"latest":true,"path":"tags","published":true},{"containedContentItemId":"","contentItemId":"","jsonPath":"TaxonomyPart.Terms[0]","latest":true,"path":"categories/travel","published":true},{"containedContentItemId":"","contentItemId":"","jsonPath":null,"latest":true,"path":"categories","published":true},{"containedContentItemId":"","contentItemId":"","jsonPath":null,"latest":true,"path":"carousel-widget-example","published":true},{"containedContentItemId":"","contentItemId":"","jsonPath":null,"latest":true,"path":"about","published":true}] \ No newline at end of file diff --git a/Lombiq.HelpfulLibraries.Samples.Tests.UI/Extensions/TestCaseUITestContextExtensions.cs b/Lombiq.HelpfulLibraries.Samples.Tests.UI/Extensions/TestCaseUITestContextExtensions.cs index 99a85c00..41e7f14b 100644 --- a/Lombiq.HelpfulLibraries.Samples.Tests.UI/Extensions/TestCaseUITestContextExtensions.cs +++ b/Lombiq.HelpfulLibraries.Samples.Tests.UI/Extensions/TestCaseUITestContextExtensions.cs @@ -5,6 +5,7 @@ using Shouldly; using System; using System.Collections.Generic; +using System.Linq; using System.Net.Http; using System.Text.Json; using System.Text.Json.Nodes; @@ -29,15 +30,18 @@ private static async Task AssertSimpleQueryAsync(UITestContext context, HttpClie { var simpleQueryUrl = context.GetAbsoluteUrlOfAction(controller => controller.SimpleQuery()); var simpleQueryOutput = await client.GetStringAsync(simpleQueryUrl, context.Configuration.TestCancellationToken); - var simpleQueryParsed = JsonSerializer.Deserialize[]>(simpleQueryOutput); + var simpleQueryParsed = JsonSerializer.Deserialize>>(simpleQueryOutput); // Cleanup received data. - foreach (var item in simpleQueryParsed) - { - // The "id" property represents the record's write order in the database. It's not relevant guaranteed to be - // consistent on different setups, and it's not relevant for this query. - item.Remove("id"); - } + simpleQueryParsed = simpleQueryParsed + .Select(item => item + // The "id" and "documentId" properties depend on the record's write order in the database. They are not + // guaranteed to be consistent on different setups, and they are not relevant for this query. + .Where(pair => pair.Key is not "id" and not "documentId") + // The order of these properties is not guaranteed either, so sorting them here makes it more reliable. + .OrderBy(pair => pair.Key) + .ToDictionary(pair => pair.Key, pair => pair.Value)) + .ToList(); // The results are re-serialized into JSON using standard options, so they can be compared in a consistent way. var reserialized = JsonSerializer.Serialize(simpleQueryParsed, JOptions.Default); From f48952e5c890d730193cc3fadb643a8738bc431d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A1ra=20El-Saig?= Date: Wed, 14 Jan 2026 17:28:50 +0100 Subject: [PATCH 20/74] Upgrade OC preview. --- .../Lombiq.HelpfulLibraries.LinqToDb.csproj | 2 +- ...Lombiq.HelpfulLibraries.OrchardCore.csproj | 48 +++++++++---------- .../Lombiq.HelpfulLibraries.Samples.csproj | 12 ++--- 3 files changed, 31 insertions(+), 31 deletions(-) diff --git a/Lombiq.HelpfulLibraries.LinqToDb/Lombiq.HelpfulLibraries.LinqToDb.csproj b/Lombiq.HelpfulLibraries.LinqToDb/Lombiq.HelpfulLibraries.LinqToDb.csproj index 80157b2d..83411159 100644 --- a/Lombiq.HelpfulLibraries.LinqToDb/Lombiq.HelpfulLibraries.LinqToDb.csproj +++ b/Lombiq.HelpfulLibraries.LinqToDb/Lombiq.HelpfulLibraries.LinqToDb.csproj @@ -25,6 +25,6 @@ - + diff --git a/Lombiq.HelpfulLibraries.OrchardCore/Lombiq.HelpfulLibraries.OrchardCore.csproj b/Lombiq.HelpfulLibraries.OrchardCore/Lombiq.HelpfulLibraries.OrchardCore.csproj index 4416be50..3cb538c3 100644 --- a/Lombiq.HelpfulLibraries.OrchardCore/Lombiq.HelpfulLibraries.OrchardCore.csproj +++ b/Lombiq.HelpfulLibraries.OrchardCore/Lombiq.HelpfulLibraries.OrchardCore.csproj @@ -24,34 +24,34 @@ - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + - - + + diff --git a/Lombiq.HelpfulLibraries.Samples/Lombiq.HelpfulLibraries.Samples.csproj b/Lombiq.HelpfulLibraries.Samples/Lombiq.HelpfulLibraries.Samples.csproj index ccf233bc..826aed5b 100644 --- a/Lombiq.HelpfulLibraries.Samples/Lombiq.HelpfulLibraries.Samples.csproj +++ b/Lombiq.HelpfulLibraries.Samples/Lombiq.HelpfulLibraries.Samples.csproj @@ -12,12 +12,12 @@ - - - - - - + + + + + + From 57dabee056704136671357ec3fcfd9ab96fa58b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A1ra=20El-Saig?= Date: Sat, 17 Jan 2026 16:44:55 +0100 Subject: [PATCH 21/74] Add NullIfWhiteSpace. --- .../Extensions/StringExtensions.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Lombiq.HelpfulLibraries.Common/Extensions/StringExtensions.cs b/Lombiq.HelpfulLibraries.Common/Extensions/StringExtensions.cs index 397f9cbb..8b3d53cf 100644 --- a/Lombiq.HelpfulLibraries.Common/Extensions/StringExtensions.cs +++ b/Lombiq.HelpfulLibraries.Common/Extensions/StringExtensions.cs @@ -435,4 +435,11 @@ public static string Concat(this string text, IList ranges) /// public static string Join(this IList ranges, string text) => text.Concat(ranges); + + /// + /// Returns if the is or whitespace. This + /// makes chaining with the null-coalescing operator (??) easier. + /// + public static string? NullIfWhiteSpace(this string value) => + string.IsNullOrWhiteSpace(value) ? null : value; } From ee1b5b3aff46f3c38c7355ecb6064d78b81d9a31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A1ra=20El-Saig?= Date: Tue, 20 Jan 2026 00:17:19 +0100 Subject: [PATCH 22/74] Update branch selector. --- .github/workflows/publish-cloudsmith.yml | 2 +- .github/workflows/publish-nuget.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/publish-cloudsmith.yml b/.github/workflows/publish-cloudsmith.yml index c92bc592..e6203dce 100644 --- a/.github/workflows/publish-cloudsmith.yml +++ b/.github/workflows/publish-cloudsmith.yml @@ -8,7 +8,7 @@ on: jobs: publish-nuget: name: Publish to Cloudsmith - uses: Lombiq/GitHub-Actions/.github/workflows/publish-nuget.yml@dev + uses: Lombiq/GitHub-Actions/.github/workflows/publish-nuget.yml@issue/OSOE-925 with: source: https://nuget.cloudsmith.io/lombiq/open-source-orchard-core-extensions/v3/index.json secrets: diff --git a/.github/workflows/publish-nuget.yml b/.github/workflows/publish-nuget.yml index 44a74afd..2b2a5e73 100644 --- a/.github/workflows/publish-nuget.yml +++ b/.github/workflows/publish-nuget.yml @@ -9,6 +9,6 @@ jobs: publish-nuget: name: Publish to NuGet if: ${{ !contains(github.ref_name, '-preview.') }} - uses: Lombiq/GitHub-Actions/.github/workflows/publish-nuget.yml@dev + uses: Lombiq/GitHub-Actions/.github/workflows/publish-nuget.yml@issue/OSOE-925 secrets: API_KEY: ${{ secrets.DEFAULT_NUGET_PUBLISH_API_KEY }} From 4e0bbae28af8a7cc5349858118adb886f7f8cc07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A1ra=20El-Saig?= Date: Tue, 20 Jan 2026 00:22:16 +0100 Subject: [PATCH 23/74] Update branch selectors. --- .github/workflows/validate-nuget-publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/validate-nuget-publish.yml b/.github/workflows/validate-nuget-publish.yml index 9f8979c5..f0fd6be1 100644 --- a/.github/workflows/validate-nuget-publish.yml +++ b/.github/workflows/validate-nuget-publish.yml @@ -9,4 +9,4 @@ on: jobs: validate-nuget-publish: name: Validate NuGet Publish - uses: Lombiq/GitHub-Actions/.github/workflows/validate-nuget-publish.yml@dev + uses: Lombiq/GitHub-Actions/.github/workflows/validate-nuget-publish.yml@issue/OSOE-925 From deb53fec53321510082945ae9a4118410c62a578 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A1ra=20El-Saig?= Date: Tue, 20 Jan 2026 01:53:46 +0100 Subject: [PATCH 24/74] Update NuGet.config. --- NuGet.config | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/NuGet.config b/NuGet.config index 2ba9b219..ed23fc59 100644 --- a/NuGet.config +++ b/NuGet.config @@ -13,5 +13,15 @@ + + + + + + + + + + From f8403f5249042a2843c1b516f8efdd175063edfa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A1ra=20El-Saig?= Date: Tue, 20 Jan 2026 01:59:24 +0100 Subject: [PATCH 25/74] CompatibilitySuppressions.xml --- CompatibilitySuppressions.xml | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 CompatibilitySuppressions.xml diff --git a/CompatibilitySuppressions.xml b/CompatibilitySuppressions.xml new file mode 100644 index 00000000..8af156c8 --- /dev/null +++ b/CompatibilitySuppressions.xml @@ -0,0 +1,8 @@ + + + + + PKV006 + net8.0 + + \ No newline at end of file From 38ac2d174e58a2a25b4713490887fdede8584237 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A1ra=20El-Saig?= Date: Tue, 20 Jan 2026 13:52:22 +0100 Subject: [PATCH 26/74] CompatibilitySuppressions.xml --- .../CompatibilitySuppressions.xml | 0 .../CompatibilitySuppressions.xml | 8 ++++++++ Lombiq.HelpfulLibraries.Cli/CompatibilitySuppressions.xml | 8 ++++++++ .../CompatibilitySuppressions.xml | 8 ++++++++ .../CompatibilitySuppressions.xml | 8 ++++++++ .../CompatibilitySuppressions.xml | 8 ++++++++ .../CompatibilitySuppressions.xml | 8 ++++++++ .../CompatibilitySuppressions.xml | 8 ++++++++ .../CompatibilitySuppressions.xml | 8 ++++++++ .../CompatibilitySuppressions.xml | 8 ++++++++ .../CompatibilitySuppressions.xml | 8 ++++++++ .../CompatibilitySuppressions.xml | 8 ++++++++ .../CompatibilitySuppressions.xml | 8 ++++++++ Lombiq.HelpfulLibraries/CompatibilitySuppressions.xml | 8 ++++++++ 14 files changed, 104 insertions(+) rename CompatibilitySuppressions.xml => Lombiq.HelpfulLibraries.AspNetCore/CompatibilitySuppressions.xml (100%) create mode 100644 Lombiq.HelpfulLibraries.Attributes/CompatibilitySuppressions.xml create mode 100644 Lombiq.HelpfulLibraries.Cli/CompatibilitySuppressions.xml create mode 100644 Lombiq.HelpfulLibraries.Common/CompatibilitySuppressions.xml create mode 100644 Lombiq.HelpfulLibraries.LinqToDb/CompatibilitySuppressions.xml create mode 100644 Lombiq.HelpfulLibraries.OrchardCore.Testing/CompatibilitySuppressions.xml create mode 100644 Lombiq.HelpfulLibraries.OrchardCore/CompatibilitySuppressions.xml create mode 100644 Lombiq.HelpfulLibraries.Refit/CompatibilitySuppressions.xml create mode 100644 Lombiq.HelpfulLibraries.RestEase/CompatibilitySuppressions.xml create mode 100644 Lombiq.HelpfulLibraries.Samples.Tests.UI/CompatibilitySuppressions.xml create mode 100644 Lombiq.HelpfulLibraries.Samples/CompatibilitySuppressions.xml create mode 100644 Lombiq.HelpfulLibraries.SourceGenerators/CompatibilitySuppressions.xml create mode 100644 Lombiq.HelpfulLibraries.Tests/CompatibilitySuppressions.xml create mode 100644 Lombiq.HelpfulLibraries/CompatibilitySuppressions.xml diff --git a/CompatibilitySuppressions.xml b/Lombiq.HelpfulLibraries.AspNetCore/CompatibilitySuppressions.xml similarity index 100% rename from CompatibilitySuppressions.xml rename to Lombiq.HelpfulLibraries.AspNetCore/CompatibilitySuppressions.xml diff --git a/Lombiq.HelpfulLibraries.Attributes/CompatibilitySuppressions.xml b/Lombiq.HelpfulLibraries.Attributes/CompatibilitySuppressions.xml new file mode 100644 index 00000000..8af156c8 --- /dev/null +++ b/Lombiq.HelpfulLibraries.Attributes/CompatibilitySuppressions.xml @@ -0,0 +1,8 @@ + + + + + PKV006 + net8.0 + + \ No newline at end of file diff --git a/Lombiq.HelpfulLibraries.Cli/CompatibilitySuppressions.xml b/Lombiq.HelpfulLibraries.Cli/CompatibilitySuppressions.xml new file mode 100644 index 00000000..8af156c8 --- /dev/null +++ b/Lombiq.HelpfulLibraries.Cli/CompatibilitySuppressions.xml @@ -0,0 +1,8 @@ + + + + + PKV006 + net8.0 + + \ No newline at end of file diff --git a/Lombiq.HelpfulLibraries.Common/CompatibilitySuppressions.xml b/Lombiq.HelpfulLibraries.Common/CompatibilitySuppressions.xml new file mode 100644 index 00000000..8af156c8 --- /dev/null +++ b/Lombiq.HelpfulLibraries.Common/CompatibilitySuppressions.xml @@ -0,0 +1,8 @@ + + + + + PKV006 + net8.0 + + \ No newline at end of file diff --git a/Lombiq.HelpfulLibraries.LinqToDb/CompatibilitySuppressions.xml b/Lombiq.HelpfulLibraries.LinqToDb/CompatibilitySuppressions.xml new file mode 100644 index 00000000..8af156c8 --- /dev/null +++ b/Lombiq.HelpfulLibraries.LinqToDb/CompatibilitySuppressions.xml @@ -0,0 +1,8 @@ + + + + + PKV006 + net8.0 + + \ No newline at end of file diff --git a/Lombiq.HelpfulLibraries.OrchardCore.Testing/CompatibilitySuppressions.xml b/Lombiq.HelpfulLibraries.OrchardCore.Testing/CompatibilitySuppressions.xml new file mode 100644 index 00000000..8af156c8 --- /dev/null +++ b/Lombiq.HelpfulLibraries.OrchardCore.Testing/CompatibilitySuppressions.xml @@ -0,0 +1,8 @@ + + + + + PKV006 + net8.0 + + \ No newline at end of file diff --git a/Lombiq.HelpfulLibraries.OrchardCore/CompatibilitySuppressions.xml b/Lombiq.HelpfulLibraries.OrchardCore/CompatibilitySuppressions.xml new file mode 100644 index 00000000..8af156c8 --- /dev/null +++ b/Lombiq.HelpfulLibraries.OrchardCore/CompatibilitySuppressions.xml @@ -0,0 +1,8 @@ + + + + + PKV006 + net8.0 + + \ No newline at end of file diff --git a/Lombiq.HelpfulLibraries.Refit/CompatibilitySuppressions.xml b/Lombiq.HelpfulLibraries.Refit/CompatibilitySuppressions.xml new file mode 100644 index 00000000..8af156c8 --- /dev/null +++ b/Lombiq.HelpfulLibraries.Refit/CompatibilitySuppressions.xml @@ -0,0 +1,8 @@ + + + + + PKV006 + net8.0 + + \ No newline at end of file diff --git a/Lombiq.HelpfulLibraries.RestEase/CompatibilitySuppressions.xml b/Lombiq.HelpfulLibraries.RestEase/CompatibilitySuppressions.xml new file mode 100644 index 00000000..8af156c8 --- /dev/null +++ b/Lombiq.HelpfulLibraries.RestEase/CompatibilitySuppressions.xml @@ -0,0 +1,8 @@ + + + + + PKV006 + net8.0 + + \ No newline at end of file diff --git a/Lombiq.HelpfulLibraries.Samples.Tests.UI/CompatibilitySuppressions.xml b/Lombiq.HelpfulLibraries.Samples.Tests.UI/CompatibilitySuppressions.xml new file mode 100644 index 00000000..8af156c8 --- /dev/null +++ b/Lombiq.HelpfulLibraries.Samples.Tests.UI/CompatibilitySuppressions.xml @@ -0,0 +1,8 @@ + + + + + PKV006 + net8.0 + + \ No newline at end of file diff --git a/Lombiq.HelpfulLibraries.Samples/CompatibilitySuppressions.xml b/Lombiq.HelpfulLibraries.Samples/CompatibilitySuppressions.xml new file mode 100644 index 00000000..8af156c8 --- /dev/null +++ b/Lombiq.HelpfulLibraries.Samples/CompatibilitySuppressions.xml @@ -0,0 +1,8 @@ + + + + + PKV006 + net8.0 + + \ No newline at end of file diff --git a/Lombiq.HelpfulLibraries.SourceGenerators/CompatibilitySuppressions.xml b/Lombiq.HelpfulLibraries.SourceGenerators/CompatibilitySuppressions.xml new file mode 100644 index 00000000..8af156c8 --- /dev/null +++ b/Lombiq.HelpfulLibraries.SourceGenerators/CompatibilitySuppressions.xml @@ -0,0 +1,8 @@ + + + + + PKV006 + net8.0 + + \ No newline at end of file diff --git a/Lombiq.HelpfulLibraries.Tests/CompatibilitySuppressions.xml b/Lombiq.HelpfulLibraries.Tests/CompatibilitySuppressions.xml new file mode 100644 index 00000000..8af156c8 --- /dev/null +++ b/Lombiq.HelpfulLibraries.Tests/CompatibilitySuppressions.xml @@ -0,0 +1,8 @@ + + + + + PKV006 + net8.0 + + \ No newline at end of file diff --git a/Lombiq.HelpfulLibraries/CompatibilitySuppressions.xml b/Lombiq.HelpfulLibraries/CompatibilitySuppressions.xml new file mode 100644 index 00000000..8af156c8 --- /dev/null +++ b/Lombiq.HelpfulLibraries/CompatibilitySuppressions.xml @@ -0,0 +1,8 @@ + + + + + PKV006 + net8.0 + + \ No newline at end of file From 39bcc8c99bea0b9b063523ebb14ae8e489769d27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A1ra=20El-Saig?= Date: Tue, 20 Jan 2026 14:24:37 +0100 Subject: [PATCH 27/74] CompatibilitySuppressions.xml --- .../CompatibilitySuppressions.xml | 7 +------ .../CompatibilitySuppressions.xml | 8 -------- .../CompatibilitySuppressions.xml | 8 -------- .../CompatibilitySuppressions.xml | 8 -------- .../CompatibilitySuppressions.xml | 8 -------- .../CompatibilitySuppressions.xml | 8 -------- .../CompatibilitySuppressions.xml | 8 -------- NuGet.config | 18 ------------------ 8 files changed, 1 insertion(+), 72 deletions(-) delete mode 100644 Lombiq.HelpfulLibraries.Refit/CompatibilitySuppressions.xml delete mode 100644 Lombiq.HelpfulLibraries.Samples.Tests.UI/CompatibilitySuppressions.xml delete mode 100644 Lombiq.HelpfulLibraries.Samples/CompatibilitySuppressions.xml delete mode 100644 Lombiq.HelpfulLibraries.SourceGenerators/CompatibilitySuppressions.xml delete mode 100644 Lombiq.HelpfulLibraries.Tests/CompatibilitySuppressions.xml delete mode 100644 Lombiq.HelpfulLibraries/CompatibilitySuppressions.xml diff --git a/Lombiq.HelpfulLibraries.Attributes/CompatibilitySuppressions.xml b/Lombiq.HelpfulLibraries.Attributes/CompatibilitySuppressions.xml index 8af156c8..0497d618 100644 --- a/Lombiq.HelpfulLibraries.Attributes/CompatibilitySuppressions.xml +++ b/Lombiq.HelpfulLibraries.Attributes/CompatibilitySuppressions.xml @@ -1,8 +1,3 @@  - - - PKV006 - net8.0 - - \ No newline at end of file + \ No newline at end of file diff --git a/Lombiq.HelpfulLibraries.Refit/CompatibilitySuppressions.xml b/Lombiq.HelpfulLibraries.Refit/CompatibilitySuppressions.xml deleted file mode 100644 index 8af156c8..00000000 --- a/Lombiq.HelpfulLibraries.Refit/CompatibilitySuppressions.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - PKV006 - net8.0 - - \ No newline at end of file diff --git a/Lombiq.HelpfulLibraries.Samples.Tests.UI/CompatibilitySuppressions.xml b/Lombiq.HelpfulLibraries.Samples.Tests.UI/CompatibilitySuppressions.xml deleted file mode 100644 index 8af156c8..00000000 --- a/Lombiq.HelpfulLibraries.Samples.Tests.UI/CompatibilitySuppressions.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - PKV006 - net8.0 - - \ No newline at end of file diff --git a/Lombiq.HelpfulLibraries.Samples/CompatibilitySuppressions.xml b/Lombiq.HelpfulLibraries.Samples/CompatibilitySuppressions.xml deleted file mode 100644 index 8af156c8..00000000 --- a/Lombiq.HelpfulLibraries.Samples/CompatibilitySuppressions.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - PKV006 - net8.0 - - \ No newline at end of file diff --git a/Lombiq.HelpfulLibraries.SourceGenerators/CompatibilitySuppressions.xml b/Lombiq.HelpfulLibraries.SourceGenerators/CompatibilitySuppressions.xml deleted file mode 100644 index 8af156c8..00000000 --- a/Lombiq.HelpfulLibraries.SourceGenerators/CompatibilitySuppressions.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - PKV006 - net8.0 - - \ No newline at end of file diff --git a/Lombiq.HelpfulLibraries.Tests/CompatibilitySuppressions.xml b/Lombiq.HelpfulLibraries.Tests/CompatibilitySuppressions.xml deleted file mode 100644 index 8af156c8..00000000 --- a/Lombiq.HelpfulLibraries.Tests/CompatibilitySuppressions.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - PKV006 - net8.0 - - \ No newline at end of file diff --git a/Lombiq.HelpfulLibraries/CompatibilitySuppressions.xml b/Lombiq.HelpfulLibraries/CompatibilitySuppressions.xml deleted file mode 100644 index 8af156c8..00000000 --- a/Lombiq.HelpfulLibraries/CompatibilitySuppressions.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - PKV006 - net8.0 - - \ No newline at end of file diff --git a/NuGet.config b/NuGet.config index ed23fc59..2e8ae60a 100644 --- a/NuGet.config +++ b/NuGet.config @@ -3,25 +3,7 @@ - - - - - - - - - - - - - - - - - - From 7e988982db4b8a9afad3434ed3b563677070a32b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A1ra=20El-Saig?= Date: Tue, 20 Jan 2026 14:31:37 +0100 Subject: [PATCH 28/74] CompatibilitySuppressions.xml --- .../CompatibilitySuppressions.xml | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 Lombiq.HelpfulLibraries.Refit/CompatibilitySuppressions.xml diff --git a/Lombiq.HelpfulLibraries.Refit/CompatibilitySuppressions.xml b/Lombiq.HelpfulLibraries.Refit/CompatibilitySuppressions.xml new file mode 100644 index 00000000..aadc6c35 --- /dev/null +++ b/Lombiq.HelpfulLibraries.Refit/CompatibilitySuppressions.xml @@ -0,0 +1,11 @@ + + + + + CP0001 + T:Lombiq.HelpfulLibraries.Refit.Helpers.RefitHelper + lib/netstandard2.0/Lombiq.HelpfulLibraries.Refit.dll + lib/netstandard2.0/Lombiq.HelpfulLibraries.Refit.dll + true + + \ No newline at end of file From fcd80b7a6e9aaf9cb4981e405c4c446acd8a5c8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A1ra=20El-Saig?= Date: Tue, 20 Jan 2026 14:47:53 +0100 Subject: [PATCH 29/74] CompatibilitySuppressions.xml --- Lombiq.HelpfulLibraries/CompatibilitySuppressions.xml | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 Lombiq.HelpfulLibraries/CompatibilitySuppressions.xml diff --git a/Lombiq.HelpfulLibraries/CompatibilitySuppressions.xml b/Lombiq.HelpfulLibraries/CompatibilitySuppressions.xml new file mode 100644 index 00000000..8af156c8 --- /dev/null +++ b/Lombiq.HelpfulLibraries/CompatibilitySuppressions.xml @@ -0,0 +1,8 @@ + + + + + PKV006 + net8.0 + + \ No newline at end of file From dbe2ca5398679f0241d07b9ec3b6a1def8f21576 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zolt=C3=A1n=20Leh=C3=B3czky?= Date: Thu, 22 Jan 2026 02:11:54 +0100 Subject: [PATCH 30/74] Grammar --- .../Contents/ContentOrchardHelperExtensions.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Lombiq.HelpfulLibraries.OrchardCore/Contents/ContentOrchardHelperExtensions.cs b/Lombiq.HelpfulLibraries.OrchardCore/Contents/ContentOrchardHelperExtensions.cs index f682ad2f..85478d5f 100644 --- a/Lombiq.HelpfulLibraries.OrchardCore/Contents/ContentOrchardHelperExtensions.cs +++ b/Lombiq.HelpfulLibraries.OrchardCore/Contents/ContentOrchardHelperExtensions.cs @@ -16,7 +16,7 @@ public static class ContentOrchardHelperExtensions /// /// Gets the given content item's edit URL. /// - [SuppressMessage("Design", "CA1055:URI-like return values should not be strings", Justification = "It only returns relative URL.")] + [SuppressMessage("Design", "CA1055:URI-like return values should not be strings", Justification = "It only returns a relative URL.")] [Obsolete($"Use {nameof(GetItemEditUrlAsync)} instead.")] public static string GetItemEditUrl(this IOrchardHelper orchardHelper, ContentItem contentItem) => orchardHelper.GetItemEditUrl(contentItem.ContentItemId); @@ -24,7 +24,7 @@ public static string GetItemEditUrl(this IOrchardHelper orchardHelper, ContentIt /// /// Gets the given content item's edit URL. /// - [SuppressMessage("Design", "CA1055:URI-like return values should not be strings", Justification = "It only returns relative URL.")] + [SuppressMessage("Design", "CA1055:URI-like return values should not be strings", Justification = "It only returns a relative URL.")] [Obsolete($"Use {nameof(GetItemEditUrlAsync)} instead.")] public static string GetItemEditUrl(this IOrchardHelper orchardHelper, string contentItemId) { @@ -35,14 +35,14 @@ public static string GetItemEditUrl(this IOrchardHelper orchardHelper, string co /// /// Gets the given content item's edit URL. /// - [SuppressMessage("Design", "CA1055:URI-like return values should not be strings", Justification = "It only returns relative URL.")] + [SuppressMessage("Design", "CA1055:URI-like return values should not be strings", Justification = "It only returns a relative URL.")] public static Task GetItemEditUrlAsync(this IOrchardHelper orchardHelper, ContentItem contentItem) => orchardHelper.GetItemEditUrlAsync(contentItem.ContentItemId); /// /// Gets the given content item's edit URL. /// - [SuppressMessage("Design", "CA1055:URI-like return values should not be strings", Justification = "It only returns relative URL.")] + [SuppressMessage("Design", "CA1055:URI-like return values should not be strings", Justification = "It only returns a relative URL.")] public static async Task GetItemEditUrlAsync(this IOrchardHelper orchardHelper, string contentItemId) { var urlHelper = await orchardHelper.GetUrlHelperAsync(); @@ -52,7 +52,7 @@ public static async Task GetItemEditUrlAsync(this IOrchardHelper orchard /// /// Gets the given content item's display URL. /// - [SuppressMessage("Design", "CA1055:URI-like return values should not be strings", Justification = "It only returns relative URL.")] + [SuppressMessage("Design", "CA1055:URI-like return values should not be strings", Justification = "It only returns a relative URL.")] [Obsolete($"Use {nameof(GetItemDisplayUrlAsync)} instead.")] public static string GetItemDisplayUrl(this IOrchardHelper orchardHelper, string contentItemId) { @@ -63,7 +63,7 @@ public static string GetItemDisplayUrl(this IOrchardHelper orchardHelper, string /// /// Gets the given content item's display URL. /// - [SuppressMessage("Design", "CA1055:URI-like return values should not be strings", Justification = "It only returns relative URL.")] + [SuppressMessage("Design", "CA1055:URI-like return values should not be strings", Justification = "It only returns a relative URL.")] public static async Task GetItemDisplayUrlAsync(this IOrchardHelper orchardHelper, string contentItemId) { var urlHelper = await orchardHelper.GetUrlHelperAsync(); From 684501beac810c4688be56e453796eb293e9750a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A1ra=20El-Saig?= Date: Thu, 22 Jan 2026 02:26:05 +0100 Subject: [PATCH 31/74] Upgrade STJ. --- .../Lombiq.HelpfulLibraries.SourceGenerators.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lombiq.HelpfulLibraries.SourceGenerators/Lombiq.HelpfulLibraries.SourceGenerators.csproj b/Lombiq.HelpfulLibraries.SourceGenerators/Lombiq.HelpfulLibraries.SourceGenerators.csproj index 838c16fd..feb2a751 100644 --- a/Lombiq.HelpfulLibraries.SourceGenerators/Lombiq.HelpfulLibraries.SourceGenerators.csproj +++ b/Lombiq.HelpfulLibraries.SourceGenerators/Lombiq.HelpfulLibraries.SourceGenerators.csproj @@ -44,7 +44,7 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive From 808f68cc87d6ad471609caa3feab67d22ceeb030 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A1ra=20El-Saig?= Date: Thu, 22 Jan 2026 02:40:21 +0100 Subject: [PATCH 32/74] Nothing to do here. --- .../GraphQL/TotalOfContentTypeBuilder.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/Lombiq.HelpfulLibraries.OrchardCore/GraphQL/TotalOfContentTypeBuilder.cs b/Lombiq.HelpfulLibraries.OrchardCore/GraphQL/TotalOfContentTypeBuilder.cs index 6ddb8332..da9db74b 100644 --- a/Lombiq.HelpfulLibraries.OrchardCore/GraphQL/TotalOfContentTypeBuilder.cs +++ b/Lombiq.HelpfulLibraries.OrchardCore/GraphQL/TotalOfContentTypeBuilder.cs @@ -50,5 +50,6 @@ public void Build(ISchema schema, FieldType contentQuery, ContentTypeDefinition public void Clear() { + // Nothing to do here. } } From edb782493d9a63fde00ec2b3b7ca8a4b1b7ccde0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A1ra=20El-Saig?= Date: Thu, 22 Jan 2026 11:51:29 +0100 Subject: [PATCH 33/74] Is this file actually needed? --- .../CompatibilitySuppressions.xml | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 Lombiq.HelpfulLibraries.Attributes/CompatibilitySuppressions.xml diff --git a/Lombiq.HelpfulLibraries.Attributes/CompatibilitySuppressions.xml b/Lombiq.HelpfulLibraries.Attributes/CompatibilitySuppressions.xml deleted file mode 100644 index 0497d618..00000000 --- a/Lombiq.HelpfulLibraries.Attributes/CompatibilitySuppressions.xml +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file From e413f82e1bc25c1cb971ff2ac61be4de300060be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A1ra=20El-Saig?= Date: Thu, 22 Jan 2026 16:50:43 +0100 Subject: [PATCH 34/74] Upgrade OC preview. --- .../Lombiq.HelpfulLibraries.LinqToDb.csproj | 2 +- ...Lombiq.HelpfulLibraries.OrchardCore.csproj | 48 +++++++++---------- .../Lombiq.HelpfulLibraries.Samples.csproj | 12 ++--- 3 files changed, 31 insertions(+), 31 deletions(-) diff --git a/Lombiq.HelpfulLibraries.LinqToDb/Lombiq.HelpfulLibraries.LinqToDb.csproj b/Lombiq.HelpfulLibraries.LinqToDb/Lombiq.HelpfulLibraries.LinqToDb.csproj index 83411159..e337ef96 100644 --- a/Lombiq.HelpfulLibraries.LinqToDb/Lombiq.HelpfulLibraries.LinqToDb.csproj +++ b/Lombiq.HelpfulLibraries.LinqToDb/Lombiq.HelpfulLibraries.LinqToDb.csproj @@ -25,6 +25,6 @@ - + diff --git a/Lombiq.HelpfulLibraries.OrchardCore/Lombiq.HelpfulLibraries.OrchardCore.csproj b/Lombiq.HelpfulLibraries.OrchardCore/Lombiq.HelpfulLibraries.OrchardCore.csproj index 3cb538c3..05a73263 100644 --- a/Lombiq.HelpfulLibraries.OrchardCore/Lombiq.HelpfulLibraries.OrchardCore.csproj +++ b/Lombiq.HelpfulLibraries.OrchardCore/Lombiq.HelpfulLibraries.OrchardCore.csproj @@ -24,34 +24,34 @@ - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + - - + + diff --git a/Lombiq.HelpfulLibraries.Samples/Lombiq.HelpfulLibraries.Samples.csproj b/Lombiq.HelpfulLibraries.Samples/Lombiq.HelpfulLibraries.Samples.csproj index 826aed5b..1b9a81e6 100644 --- a/Lombiq.HelpfulLibraries.Samples/Lombiq.HelpfulLibraries.Samples.csproj +++ b/Lombiq.HelpfulLibraries.Samples/Lombiq.HelpfulLibraries.Samples.csproj @@ -12,12 +12,12 @@ - - - - - - + + + + + + From fdcfb0e0ad21ac977765f0cc11145697620cbd38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A1ra=20El-Saig?= Date: Thu, 22 Jan 2026 19:04:47 +0100 Subject: [PATCH 35/74] Add DeleteAllIndexesAsync --- .../Elasticsearch/ConfigurationExtensions.cs | 6 +++++ .../ElasticIndexManagerExtensions.cs | 6 +++-- .../ElasticsearchClientExtensions.cs | 23 +++++++++++++++++++ ...Lombiq.HelpfulLibraries.OrchardCore.csproj | 1 + 4 files changed, 34 insertions(+), 2 deletions(-) create mode 100644 Lombiq.HelpfulLibraries.OrchardCore/Elasticsearch/ElasticsearchClientExtensions.cs diff --git a/Lombiq.HelpfulLibraries.OrchardCore/Elasticsearch/ConfigurationExtensions.cs b/Lombiq.HelpfulLibraries.OrchardCore/Elasticsearch/ConfigurationExtensions.cs index 53a27081..8e585322 100644 --- a/Lombiq.HelpfulLibraries.OrchardCore/Elasticsearch/ConfigurationExtensions.cs +++ b/Lombiq.HelpfulLibraries.OrchardCore/Elasticsearch/ConfigurationExtensions.cs @@ -13,6 +13,12 @@ public static class ConfigurationExtensions public static ElasticsearchClient CreateElasticClient(this IShellConfiguration shellConfiguration) => shellConfiguration.CreateElasticsearchClient(); + /// + /// Returns a new instance of the client. + /// + /// + /// Same as the code found in . + /// public static ElasticsearchClient CreateElasticsearchClient( this IShellConfiguration shellConfiguration, IElasticsearchClientFactory? factory = null) diff --git a/Lombiq.HelpfulLibraries.OrchardCore/Elasticsearch/ElasticIndexManagerExtensions.cs b/Lombiq.HelpfulLibraries.OrchardCore/Elasticsearch/ElasticIndexManagerExtensions.cs index 6c5ca2ca..c65bebba 100644 --- a/Lombiq.HelpfulLibraries.OrchardCore/Elasticsearch/ElasticIndexManagerExtensions.cs +++ b/Lombiq.HelpfulLibraries.OrchardCore/Elasticsearch/ElasticIndexManagerExtensions.cs @@ -1,4 +1,5 @@ -using OrchardCore.Indexing.Models; +using Elastic.Clients.Elasticsearch; +using System; using System.Threading.Tasks; namespace OrchardCore.Search.Elasticsearch.Core.Services; @@ -9,6 +10,7 @@ public static class ElasticIndexManagerExtensions /// Clear all indexes for the tenant (within the prefix, if there is one) by passing a wildcard /// character (*) as the index name. /// + [Obsolete($"Use the equivalent extension method for {nameof(ElasticsearchClient)} instead.")] public static Task DeleteAllIndexesAsync(this ElasticsearchIndexManager manager) => - manager.DeleteAsync(new IndexProfile { IndexName = "*" }); + throw new NotSupportedException($"Use the equivalent extension method for {nameof(ElasticsearchClient)} instead."); } diff --git a/Lombiq.HelpfulLibraries.OrchardCore/Elasticsearch/ElasticsearchClientExtensions.cs b/Lombiq.HelpfulLibraries.OrchardCore/Elasticsearch/ElasticsearchClientExtensions.cs new file mode 100644 index 00000000..745f45bb --- /dev/null +++ b/Lombiq.HelpfulLibraries.OrchardCore/Elasticsearch/ElasticsearchClientExtensions.cs @@ -0,0 +1,23 @@ +using Elastic.Clients.Elasticsearch.Core; +using Elastic.Clients.Elasticsearch.IndexManagement; +using System.Linq; +using System.Threading.Tasks; + +namespace Elastic.Clients.Elasticsearch; + +public static class ElasticIndexManagerExtensions +{ + /// + /// Clear all indexes for the tenant (within the prefix, if there is one) by passing a wildcard + /// character (*) as the index name. + /// + public static async Task DeleteAllIndexesAsync(this ElasticsearchClient client, string prefix) + { + var index = string.IsNullOrWhiteSpace(prefix) ? Indices.All : Indices.Index($"{prefix}_*"); + var getRequest = new GetIndexRequest(index) { ExpandWildcards = [ExpandWildcard.All], AllowNoIndices = true }; + var getResponse = (await client.Indices.GetAsync(getRequest)).ThrowIfFailed($"get index \"{index}\""); + + if (getResponse.Indices.Count == 0) return; + (await client.Indices.DeleteAsync(getResponse.Indices.Keys.ToArray())).ThrowIfFailed($"delete index \"{index}\""); + } +} diff --git a/Lombiq.HelpfulLibraries.OrchardCore/Lombiq.HelpfulLibraries.OrchardCore.csproj b/Lombiq.HelpfulLibraries.OrchardCore/Lombiq.HelpfulLibraries.OrchardCore.csproj index 05a73263..4c6b8248 100644 --- a/Lombiq.HelpfulLibraries.OrchardCore/Lombiq.HelpfulLibraries.OrchardCore.csproj +++ b/Lombiq.HelpfulLibraries.OrchardCore/Lombiq.HelpfulLibraries.OrchardCore.csproj @@ -40,6 +40,7 @@ + From 67fa7c1b6553f284b77620a6c8292c8023c78225 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A1ra=20El-Saig?= Date: Thu, 22 Jan 2026 19:25:21 +0100 Subject: [PATCH 36/74] Big fix. --- .../Elasticsearch/ElasticsearchClientExtensions.cs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Lombiq.HelpfulLibraries.OrchardCore/Elasticsearch/ElasticsearchClientExtensions.cs b/Lombiq.HelpfulLibraries.OrchardCore/Elasticsearch/ElasticsearchClientExtensions.cs index 745f45bb..0bb90806 100644 --- a/Lombiq.HelpfulLibraries.OrchardCore/Elasticsearch/ElasticsearchClientExtensions.cs +++ b/Lombiq.HelpfulLibraries.OrchardCore/Elasticsearch/ElasticsearchClientExtensions.cs @@ -1,5 +1,9 @@ using Elastic.Clients.Elasticsearch.Core; using Elastic.Clients.Elasticsearch.IndexManagement; +using Microsoft.Extensions.Configuration; +using OrchardCore.Environment.Shell.Configuration; +using OrchardCore.Search.Elasticsearch; +using OrchardCore.Search.Elasticsearch.Core.Services; using System.Linq; using System.Threading.Tasks; @@ -11,7 +15,7 @@ public static class ElasticIndexManagerExtensions /// Clear all indexes for the tenant (within the prefix, if there is one) by passing a wildcard /// character (*) as the index name. /// - public static async Task DeleteAllIndexesAsync(this ElasticsearchClient client, string prefix) + public static async Task DeleteAllIndexesAsync(this ElasticsearchClient client, string? prefix) { var index = string.IsNullOrWhiteSpace(prefix) ? Indices.All : Indices.Index($"{prefix}_*"); var getRequest = new GetIndexRequest(index) { ExpandWildcards = [ExpandWildcard.All], AllowNoIndices = true }; @@ -20,4 +24,12 @@ public static async Task DeleteAllIndexesAsync(this ElasticsearchClient client, if (getResponse.Indices.Count == 0) return; (await client.Indices.DeleteAsync(getResponse.Indices.Keys.ToArray())).ThrowIfFailed($"delete index \"{index}\""); } + + public static Task DeleteAllIndexesAsync(this ElasticsearchClient client, IShellConfiguration shellConfiguration) + { + var prefix = shellConfiguration + .GetSection(ElasticsearchConnectionOptionsConfigurations.ConfigSectionName) + .GetValue(nameof(ElasticsearchOptions.IndexPrefix)); + return client.DeleteAllIndexesAsync(prefix); + } } From 99ffc1dae2bd5346f65ad058e574ccb09efa5d26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A1ra=20El-Saig?= Date: Thu, 22 Jan 2026 22:19:32 +0100 Subject: [PATCH 37/74] Fix LangVersion and AnalysisLevel. --- .../Lombiq.HelpfulLibraries.Attributes.csproj | 2 +- .../Lombiq.HelpfulLibraries.SourceGenerators.csproj | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Lombiq.HelpfulLibraries.Attributes/Lombiq.HelpfulLibraries.Attributes.csproj b/Lombiq.HelpfulLibraries.Attributes/Lombiq.HelpfulLibraries.Attributes.csproj index 461e8356..7b29f155 100644 --- a/Lombiq.HelpfulLibraries.Attributes/Lombiq.HelpfulLibraries.Attributes.csproj +++ b/Lombiq.HelpfulLibraries.Attributes/Lombiq.HelpfulLibraries.Attributes.csproj @@ -4,7 +4,7 @@ netstandard2.0 true enable - latest + 14.0 diff --git a/Lombiq.HelpfulLibraries.SourceGenerators/Lombiq.HelpfulLibraries.SourceGenerators.csproj b/Lombiq.HelpfulLibraries.SourceGenerators/Lombiq.HelpfulLibraries.SourceGenerators.csproj index feb2a751..b3ab418f 100644 --- a/Lombiq.HelpfulLibraries.SourceGenerators/Lombiq.HelpfulLibraries.SourceGenerators.csproj +++ b/Lombiq.HelpfulLibraries.SourceGenerators/Lombiq.HelpfulLibraries.SourceGenerators.csproj @@ -4,7 +4,7 @@ netstandard2.0 true enable - latest + 14.0 true true From 92b309117b37d79ec9b82888170609efe5e09acc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A1ra=20El-Saig?= Date: Thu, 22 Jan 2026 22:30:53 +0100 Subject: [PATCH 38/74] Fix CA2263. --- .../Extensions/ServiceCollectionExtensions.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lombiq.HelpfulLibraries.AspNetCore/Extensions/ServiceCollectionExtensions.cs b/Lombiq.HelpfulLibraries.AspNetCore/Extensions/ServiceCollectionExtensions.cs index dedf02d3..5bdc9f54 100644 --- a/Lombiq.HelpfulLibraries.AspNetCore/Extensions/ServiceCollectionExtensions.cs +++ b/Lombiq.HelpfulLibraries.AspNetCore/Extensions/ServiceCollectionExtensions.cs @@ -11,5 +11,5 @@ public static class ServiceCollectionExtensions /// public static void AddAsyncResultFilter(this IServiceCollection services) where TFilter : IAsyncResultFilter => - services.Configure(options => options.Filters.Add(typeof(TFilter))); + services.Configure(options => options.Filters.Add()); } From 631759965ba5b41e7c70f45de0224a74a28f02c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A1ra=20El-Saig?= Date: Fri, 23 Jan 2026 12:15:16 +0100 Subject: [PATCH 39/74] UC preview update. --- .../Lombiq.HelpfulLibraries.LinqToDb.csproj | 2 +- ...Lombiq.HelpfulLibraries.OrchardCore.csproj | 50 +++++++++---------- .../Lombiq.HelpfulLibraries.Samples.csproj | 12 ++--- 3 files changed, 32 insertions(+), 32 deletions(-) diff --git a/Lombiq.HelpfulLibraries.LinqToDb/Lombiq.HelpfulLibraries.LinqToDb.csproj b/Lombiq.HelpfulLibraries.LinqToDb/Lombiq.HelpfulLibraries.LinqToDb.csproj index e337ef96..a37163d6 100644 --- a/Lombiq.HelpfulLibraries.LinqToDb/Lombiq.HelpfulLibraries.LinqToDb.csproj +++ b/Lombiq.HelpfulLibraries.LinqToDb/Lombiq.HelpfulLibraries.LinqToDb.csproj @@ -25,6 +25,6 @@ - + diff --git a/Lombiq.HelpfulLibraries.OrchardCore/Lombiq.HelpfulLibraries.OrchardCore.csproj b/Lombiq.HelpfulLibraries.OrchardCore/Lombiq.HelpfulLibraries.OrchardCore.csproj index 4c6b8248..2e130c02 100644 --- a/Lombiq.HelpfulLibraries.OrchardCore/Lombiq.HelpfulLibraries.OrchardCore.csproj +++ b/Lombiq.HelpfulLibraries.OrchardCore/Lombiq.HelpfulLibraries.OrchardCore.csproj @@ -24,35 +24,35 @@ - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + - - + + diff --git a/Lombiq.HelpfulLibraries.Samples/Lombiq.HelpfulLibraries.Samples.csproj b/Lombiq.HelpfulLibraries.Samples/Lombiq.HelpfulLibraries.Samples.csproj index 1b9a81e6..2103a223 100644 --- a/Lombiq.HelpfulLibraries.Samples/Lombiq.HelpfulLibraries.Samples.csproj +++ b/Lombiq.HelpfulLibraries.Samples/Lombiq.HelpfulLibraries.Samples.csproj @@ -12,12 +12,12 @@ - - - - - - + + + + + + From e9d98c40d7dd831b9abb50574fa1b8aa9c62fdda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zolt=C3=A1n=20Leh=C3=B3czky?= Date: Sat, 24 Jan 2026 21:56:10 +0100 Subject: [PATCH 40/74] Formatting --- .../Elasticsearch/ElasticsearchClientExtensions.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Lombiq.HelpfulLibraries.OrchardCore/Elasticsearch/ElasticsearchClientExtensions.cs b/Lombiq.HelpfulLibraries.OrchardCore/Elasticsearch/ElasticsearchClientExtensions.cs index 0bb90806..bc8dbc7d 100644 --- a/Lombiq.HelpfulLibraries.OrchardCore/Elasticsearch/ElasticsearchClientExtensions.cs +++ b/Lombiq.HelpfulLibraries.OrchardCore/Elasticsearch/ElasticsearchClientExtensions.cs @@ -12,8 +12,8 @@ namespace Elastic.Clients.Elasticsearch; public static class ElasticIndexManagerExtensions { /// - /// Clear all indexes for the tenant (within the prefix, if there is one) by passing a wildcard - /// character (*) as the index name. + /// Clear all indexes for the tenant (within the prefix, if there is one) by passing a wildcard character (*) + /// as the index name. /// public static async Task DeleteAllIndexesAsync(this ElasticsearchClient client, string? prefix) { From 90aae04ade0e49f851f3a89475deb0f17f4524da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A1ra=20El-Saig?= Date: Tue, 27 Jan 2026 13:42:01 +0100 Subject: [PATCH 41/74] Update OC preview. --- .../Lombiq.HelpfulLibraries.LinqToDb.csproj | 2 +- ...Lombiq.HelpfulLibraries.OrchardCore.csproj | 50 +++++++++---------- .../Lombiq.HelpfulLibraries.Samples.csproj | 12 ++--- 3 files changed, 32 insertions(+), 32 deletions(-) diff --git a/Lombiq.HelpfulLibraries.LinqToDb/Lombiq.HelpfulLibraries.LinqToDb.csproj b/Lombiq.HelpfulLibraries.LinqToDb/Lombiq.HelpfulLibraries.LinqToDb.csproj index a37163d6..5a662926 100644 --- a/Lombiq.HelpfulLibraries.LinqToDb/Lombiq.HelpfulLibraries.LinqToDb.csproj +++ b/Lombiq.HelpfulLibraries.LinqToDb/Lombiq.HelpfulLibraries.LinqToDb.csproj @@ -25,6 +25,6 @@ - + diff --git a/Lombiq.HelpfulLibraries.OrchardCore/Lombiq.HelpfulLibraries.OrchardCore.csproj b/Lombiq.HelpfulLibraries.OrchardCore/Lombiq.HelpfulLibraries.OrchardCore.csproj index 2e130c02..6eb7dfb5 100644 --- a/Lombiq.HelpfulLibraries.OrchardCore/Lombiq.HelpfulLibraries.OrchardCore.csproj +++ b/Lombiq.HelpfulLibraries.OrchardCore/Lombiq.HelpfulLibraries.OrchardCore.csproj @@ -24,35 +24,35 @@ - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + - - + + diff --git a/Lombiq.HelpfulLibraries.Samples/Lombiq.HelpfulLibraries.Samples.csproj b/Lombiq.HelpfulLibraries.Samples/Lombiq.HelpfulLibraries.Samples.csproj index 2103a223..c1cb8069 100644 --- a/Lombiq.HelpfulLibraries.Samples/Lombiq.HelpfulLibraries.Samples.csproj +++ b/Lombiq.HelpfulLibraries.Samples/Lombiq.HelpfulLibraries.Samples.csproj @@ -12,12 +12,12 @@ - - - - - - + + + + + + From 0f370c7828d2b17605bbc9fd9d465b03251d422d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A1ra=20El-Saig?= Date: Sat, 31 Jan 2026 00:55:59 +0100 Subject: [PATCH 42/74] Add CreatingOrUpdatingPartHandler. --- .../Contents/CreatingOrUpdatingPartHandler.cs | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 Lombiq.HelpfulLibraries.OrchardCore/Contents/CreatingOrUpdatingPartHandler.cs diff --git a/Lombiq.HelpfulLibraries.OrchardCore/Contents/CreatingOrUpdatingPartHandler.cs b/Lombiq.HelpfulLibraries.OrchardCore/Contents/CreatingOrUpdatingPartHandler.cs new file mode 100644 index 00000000..b31aaf93 --- /dev/null +++ b/Lombiq.HelpfulLibraries.OrchardCore/Contents/CreatingOrUpdatingPartHandler.cs @@ -0,0 +1,23 @@ +using OrchardCore.ContentManagement; +using OrchardCore.ContentManagement.Handlers; +using System.Threading.Tasks; + +namespace Lombiq.HelpfulLibraries.OrchardCore.Contents; + +/// +/// Abstraction over , to assign a common event handler for +/// both and events. This replicates the behavior of handlers +/// before OC 3.0 that only used the latter. +/// +public abstract class CreatingOrUpdatingPartHandler : ContentPartHandler + where TPart : ContentPart, new() +{ + protected abstract Task CreatingOrUpdatingAsync(TPart part); + + public override Task CreatingAsync(CreateContentContext context, TPart part) => + CreatingOrUpdatingAsync(part); + + public override Task UpdatingAsync(UpdateContentContext context, TPart part) => + CreatingOrUpdatingAsync(part); +} From 043c559a13f6553bbd5b71a24a9d8eb2a46f074d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A1ra=20El-Saig?= Date: Sat, 31 Jan 2026 01:57:07 +0100 Subject: [PATCH 43/74] AddDefaultTenantFeatures --- .../ServiceCollectionExtensions.cs | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/Lombiq.HelpfulLibraries.OrchardCore/DependencyInjection/ServiceCollectionExtensions.cs b/Lombiq.HelpfulLibraries.OrchardCore/DependencyInjection/ServiceCollectionExtensions.cs index b3db16ef..7d4ad7d2 100644 --- a/Lombiq.HelpfulLibraries.OrchardCore/DependencyInjection/ServiceCollectionExtensions.cs +++ b/Lombiq.HelpfulLibraries.OrchardCore/DependencyInjection/ServiceCollectionExtensions.cs @@ -3,6 +3,8 @@ using Microsoft.AspNetCore.Routing; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection.Extensions; +using OrchardCore.Environment.Shell; +using OrchardCore.Environment.Shell.Descriptor.Models; using OrchardCore.Modules; using System; using System.Threading.Tasks; @@ -44,4 +46,33 @@ public static IServiceCollection AddInlineStartup( Func? configureAsync = null, int order = 0) => services.AddSingleton(new InlineStartup(configureServices, configure, configureAsync, order)); + + /// + /// Enables the provided tenant features, but only for the tenant. + /// + public static IServiceCollection AddDefaultTenantFeatures( + this IServiceCollection services, + params string[] featureIds) + { + foreach (var id in featureIds) + { + services.AddTransient(sp => + { + var shellSettings = sp.GetRequiredService(); + return shellSettings.Name == ShellSettings.DefaultShellName + ? new ShellFeature(id, alwaysEnabled: true) + : new(); + }); + } + + return services; + } + + /// + /// Enables the provided tenant features, but only for the tenant. + /// + public static OrchardCoreBuilder AddDefaultTenantFeatures( + this OrchardCoreBuilder builder, + params string[] featureIds) => + builder.ConfigureServices(services => services.AddDefaultTenantFeatures(featureIds)); } From f0e41b9bd40e719d5ceace465e08c64a2442ee7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A1ra=20El-Saig?= Date: Sat, 31 Jan 2026 21:17:28 +0100 Subject: [PATCH 44/74] Make Request.Form access safer. --- .../Extensions/HttpRequestExtensions.cs | 23 +++++++++++++++++++ .../ContentOrchardHelperExtensions.cs | 16 ++++--------- .../ResourceFilterBuilder.cs | 8 ++----- 3 files changed, 30 insertions(+), 17 deletions(-) diff --git a/Lombiq.HelpfulLibraries.AspNetCore/Extensions/HttpRequestExtensions.cs b/Lombiq.HelpfulLibraries.AspNetCore/Extensions/HttpRequestExtensions.cs index 14e7c2c5..2d48580b 100644 --- a/Lombiq.HelpfulLibraries.AspNetCore/Extensions/HttpRequestExtensions.cs +++ b/Lombiq.HelpfulLibraries.AspNetCore/Extensions/HttpRequestExtensions.cs @@ -114,4 +114,27 @@ public static bool IsAction( string? area = null) where TController : ControllerBase => request.IsAction(actionSelector.StripResult(), area); + + /// + /// If the has a form body, it tries to find the value for amd + /// trims it. If that fails or if the result is an empty string, is returned instead. + /// + public static string? GetFormValueMaybe(this HttpRequest request, string key) + { + if (!request.HasFormContentType) return null; + + // We use try-catch in case the request is somehow broken or invalid because then just accessing the form can + // throw an exception. + try + { + return request.Form.TryGetValue(key, out var values) && + values.WhereNot(string.IsNullOrWhiteSpace).FirstOrDefault()?.Trim() is { } value + ? value + : null; + } + catch + { + return null; + } + } } diff --git a/Lombiq.HelpfulLibraries.OrchardCore/Contents/ContentOrchardHelperExtensions.cs b/Lombiq.HelpfulLibraries.OrchardCore/Contents/ContentOrchardHelperExtensions.cs index 85478d5f..6cb64480 100644 --- a/Lombiq.HelpfulLibraries.OrchardCore/Contents/ContentOrchardHelperExtensions.cs +++ b/Lombiq.HelpfulLibraries.OrchardCore/Contents/ContentOrchardHelperExtensions.cs @@ -82,17 +82,11 @@ public static Task GetContentItemOrPreviewAsync( { var httpContext = orchardHelper.HttpContext; - if (httpContext.Request.Method == "POST") - { - var previewContentItemId = httpContext.Request.Form["PreviewContentItemId"].ToString(); - if (!string.IsNullOrEmpty(previewContentItemId) && - httpContext.RequestServices.GetService() is { } contentManager) - { - return contentManager.GetAsync(previewContentItemId); - } - } - - return contentItemGetter(); + return httpContext.Request.GetFormValueMaybe("PreviewContentItemId") is { } previewContentItemId && + !string.IsNullOrEmpty(previewContentItemId) && + httpContext.RequestServices.GetService() is { } contentManager + ? contentManager.GetAsync(previewContentItemId) + : contentItemGetter(); } /// diff --git a/Lombiq.HelpfulLibraries.OrchardCore/ResourceManagement/ResourceFilterBuilder.cs b/Lombiq.HelpfulLibraries.OrchardCore/ResourceManagement/ResourceFilterBuilder.cs index 7d61f11e..3ba7c357 100644 --- a/Lombiq.HelpfulLibraries.OrchardCore/ResourceManagement/ResourceFilterBuilder.cs +++ b/Lombiq.HelpfulLibraries.OrchardCore/ResourceManagement/ResourceFilterBuilder.cs @@ -179,12 +179,9 @@ private static bool GetContentItemId(string displayType, HttpContext context, ou { if (displayType == "Preview") { - if (HttpMethods.IsPost(context.Request.Method) - && (context.Request.ContentType?.ContainsOrdinalIgnoreCase("application/x-www-form-urlencoded") ?? false) - && context.Request.Form.TryGetValue("PreviewContentItemId", out var previewContentItemId)) + if (context.Request.GetFormValueMaybe("PreviewContentItemId") is { } previewContentItemId) { - contentItemId = previewContentItemId.FirstOrDefault(); - + contentItemId = previewContentItemId; return true; } } @@ -203,7 +200,6 @@ private static bool GetContentItemId(string displayType, HttpContext context, ou } contentItemId = null; - return false; } From 66e32142c3010715c6159815b8929ec1f599abd6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A1ra=20El-Saig?= Date: Wed, 4 Feb 2026 18:04:55 +0100 Subject: [PATCH 45/74] Update OC preview. --- .../Lombiq.HelpfulLibraries.LinqToDb.csproj | 2 +- ...Lombiq.HelpfulLibraries.OrchardCore.csproj | 50 +++++++++---------- .../Lombiq.HelpfulLibraries.Samples.csproj | 12 ++--- 3 files changed, 32 insertions(+), 32 deletions(-) diff --git a/Lombiq.HelpfulLibraries.LinqToDb/Lombiq.HelpfulLibraries.LinqToDb.csproj b/Lombiq.HelpfulLibraries.LinqToDb/Lombiq.HelpfulLibraries.LinqToDb.csproj index 5a662926..d14bfb8c 100644 --- a/Lombiq.HelpfulLibraries.LinqToDb/Lombiq.HelpfulLibraries.LinqToDb.csproj +++ b/Lombiq.HelpfulLibraries.LinqToDb/Lombiq.HelpfulLibraries.LinqToDb.csproj @@ -25,6 +25,6 @@ - + diff --git a/Lombiq.HelpfulLibraries.OrchardCore/Lombiq.HelpfulLibraries.OrchardCore.csproj b/Lombiq.HelpfulLibraries.OrchardCore/Lombiq.HelpfulLibraries.OrchardCore.csproj index 6eb7dfb5..4c635e3f 100644 --- a/Lombiq.HelpfulLibraries.OrchardCore/Lombiq.HelpfulLibraries.OrchardCore.csproj +++ b/Lombiq.HelpfulLibraries.OrchardCore/Lombiq.HelpfulLibraries.OrchardCore.csproj @@ -24,35 +24,35 @@ - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + - - + + diff --git a/Lombiq.HelpfulLibraries.Samples/Lombiq.HelpfulLibraries.Samples.csproj b/Lombiq.HelpfulLibraries.Samples/Lombiq.HelpfulLibraries.Samples.csproj index c1cb8069..68e23f16 100644 --- a/Lombiq.HelpfulLibraries.Samples/Lombiq.HelpfulLibraries.Samples.csproj +++ b/Lombiq.HelpfulLibraries.Samples/Lombiq.HelpfulLibraries.Samples.csproj @@ -12,12 +12,12 @@ - - - - - - + + + + + + From 64a495c9e8f57e3f08c75009e7338aa57cb47832 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A1ra=20El-Saig?= Date: Thu, 5 Feb 2026 12:15:23 +0100 Subject: [PATCH 46/74] Update OC preview. --- .../Lombiq.HelpfulLibraries.LinqToDb.csproj | 2 +- ...Lombiq.HelpfulLibraries.OrchardCore.csproj | 50 +++++++++---------- .../Lombiq.HelpfulLibraries.Samples.csproj | 12 ++--- 3 files changed, 32 insertions(+), 32 deletions(-) diff --git a/Lombiq.HelpfulLibraries.LinqToDb/Lombiq.HelpfulLibraries.LinqToDb.csproj b/Lombiq.HelpfulLibraries.LinqToDb/Lombiq.HelpfulLibraries.LinqToDb.csproj index d14bfb8c..dc57df89 100644 --- a/Lombiq.HelpfulLibraries.LinqToDb/Lombiq.HelpfulLibraries.LinqToDb.csproj +++ b/Lombiq.HelpfulLibraries.LinqToDb/Lombiq.HelpfulLibraries.LinqToDb.csproj @@ -25,6 +25,6 @@ - + diff --git a/Lombiq.HelpfulLibraries.OrchardCore/Lombiq.HelpfulLibraries.OrchardCore.csproj b/Lombiq.HelpfulLibraries.OrchardCore/Lombiq.HelpfulLibraries.OrchardCore.csproj index 4c635e3f..789b5cd6 100644 --- a/Lombiq.HelpfulLibraries.OrchardCore/Lombiq.HelpfulLibraries.OrchardCore.csproj +++ b/Lombiq.HelpfulLibraries.OrchardCore/Lombiq.HelpfulLibraries.OrchardCore.csproj @@ -24,35 +24,35 @@ - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + - - + + diff --git a/Lombiq.HelpfulLibraries.Samples/Lombiq.HelpfulLibraries.Samples.csproj b/Lombiq.HelpfulLibraries.Samples/Lombiq.HelpfulLibraries.Samples.csproj index 68e23f16..18452cec 100644 --- a/Lombiq.HelpfulLibraries.Samples/Lombiq.HelpfulLibraries.Samples.csproj +++ b/Lombiq.HelpfulLibraries.Samples/Lombiq.HelpfulLibraries.Samples.csproj @@ -12,12 +12,12 @@ - - - - - - + + + + + + From e0dd95366c71b58c3135fd9299448316b5643d18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A1ra=20El-Saig?= Date: Thu, 5 Feb 2026 20:42:57 +0100 Subject: [PATCH 47/74] Fix analyzer warning. --- .../DateTime/LocalClockExtensions.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Lombiq.HelpfulLibraries.OrchardCore/DateTime/LocalClockExtensions.cs b/Lombiq.HelpfulLibraries.OrchardCore/DateTime/LocalClockExtensions.cs index 8ba82d03..fe37efb0 100644 --- a/Lombiq.HelpfulLibraries.OrchardCore/DateTime/LocalClockExtensions.cs +++ b/Lombiq.HelpfulLibraries.OrchardCore/DateTime/LocalClockExtensions.cs @@ -48,11 +48,13 @@ public static Task ConvertToUtcAsync( /// public static async Task LocalizeAndFormatAsync( this ILocalClock localClock, - DateTime? dateTimeUtc) + DateTime? dateTimeUtc, + IFormatProvider? formatProvider = null) { if (dateTimeUtc == null) return null; - return ((DateTime?)(await localClock.ConvertToLocalAsync(dateTime: dateTimeUtc.Value)).DateTime).ToString(); + var localTime = await localClock.ConvertToLocalAsync(dateTime: dateTimeUtc.Value); + return localTime.DateTime.ToString(formatProvider); } private static async Task ExecuteInDifferentTimeZoneAsync(HttpContext httpContext, string timeZoneId, Func> asyncAction) From f287b3521e11bd27d54e674a89e050c24c6b4657 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A1ra=20El-Saig?= Date: Fri, 6 Feb 2026 11:43:48 +0100 Subject: [PATCH 48/74] Upda --- .../Lombiq.HelpfulLibraries.LinqToDb.csproj | 2 +- ...Lombiq.HelpfulLibraries.OrchardCore.csproj | 50 +++++++++---------- .../Lombiq.HelpfulLibraries.Samples.csproj | 12 ++--- 3 files changed, 32 insertions(+), 32 deletions(-) diff --git a/Lombiq.HelpfulLibraries.LinqToDb/Lombiq.HelpfulLibraries.LinqToDb.csproj b/Lombiq.HelpfulLibraries.LinqToDb/Lombiq.HelpfulLibraries.LinqToDb.csproj index dc57df89..d46e9486 100644 --- a/Lombiq.HelpfulLibraries.LinqToDb/Lombiq.HelpfulLibraries.LinqToDb.csproj +++ b/Lombiq.HelpfulLibraries.LinqToDb/Lombiq.HelpfulLibraries.LinqToDb.csproj @@ -25,6 +25,6 @@ - + diff --git a/Lombiq.HelpfulLibraries.OrchardCore/Lombiq.HelpfulLibraries.OrchardCore.csproj b/Lombiq.HelpfulLibraries.OrchardCore/Lombiq.HelpfulLibraries.OrchardCore.csproj index 789b5cd6..9b490c3c 100644 --- a/Lombiq.HelpfulLibraries.OrchardCore/Lombiq.HelpfulLibraries.OrchardCore.csproj +++ b/Lombiq.HelpfulLibraries.OrchardCore/Lombiq.HelpfulLibraries.OrchardCore.csproj @@ -24,35 +24,35 @@ - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + - - + + diff --git a/Lombiq.HelpfulLibraries.Samples/Lombiq.HelpfulLibraries.Samples.csproj b/Lombiq.HelpfulLibraries.Samples/Lombiq.HelpfulLibraries.Samples.csproj index 18452cec..d790faa2 100644 --- a/Lombiq.HelpfulLibraries.Samples/Lombiq.HelpfulLibraries.Samples.csproj +++ b/Lombiq.HelpfulLibraries.Samples/Lombiq.HelpfulLibraries.Samples.csproj @@ -12,12 +12,12 @@ - - - - - - + + + + + + From e2f278dbe70f33c0a14090a766fd8dacf57a0da2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A1ra=20El-Saig?= Date: Tue, 10 Feb 2026 08:13:25 +0100 Subject: [PATCH 49/74] Post-merge fixup. --- .../ResourceManagement/ResourceFilterBuilder.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lombiq.HelpfulLibraries.OrchardCore/ResourceManagement/ResourceFilterBuilder.cs b/Lombiq.HelpfulLibraries.OrchardCore/ResourceManagement/ResourceFilterBuilder.cs index 58b3cbad..f79ee325 100644 --- a/Lombiq.HelpfulLibraries.OrchardCore/ResourceManagement/ResourceFilterBuilder.cs +++ b/Lombiq.HelpfulLibraries.OrchardCore/ResourceManagement/ResourceFilterBuilder.cs @@ -184,7 +184,7 @@ private static bool GetContentItemId(string displayType, HttpContext context, ou { if (context.Request.GetFormValueMaybe("PreviewContentItemId") is { } previewContentItemId) { - contentItemId = previewContentItemId.FirstOrDefault(); + contentItemId = previewContentItemId; return true; } From e385ac923b021df399c44e1301f94a3d679c8d75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A1ra=20El-Saig?= Date: Tue, 10 Feb 2026 13:09:20 +0100 Subject: [PATCH 50/74] Fix formatting. --- .../ResourceManagement/ResourceFilterBuilder.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Lombiq.HelpfulLibraries.OrchardCore/ResourceManagement/ResourceFilterBuilder.cs b/Lombiq.HelpfulLibraries.OrchardCore/ResourceManagement/ResourceFilterBuilder.cs index f79ee325..1f3c5b7f 100644 --- a/Lombiq.HelpfulLibraries.OrchardCore/ResourceManagement/ResourceFilterBuilder.cs +++ b/Lombiq.HelpfulLibraries.OrchardCore/ResourceManagement/ResourceFilterBuilder.cs @@ -164,10 +164,12 @@ private ResourceFilter WhenContentTypeInner(string displayType, params string[] } var session = context.RequestServices.GetRequiredService(); - var query = displayType is "Edit" ? - // We check for both published and draft content items. - session.QueryIndex(index => index.Published || (index.Latest && !index.Published)) + + // In case of Edit, we check for both published and draft content items. + var query = displayType is "Edit" + ? session.QueryIndex(index => index.Published || (index.Latest && !index.Published)) : session.QueryContentItemIndex(PublicationStatus.Published); + var contentItemIndex = await query .Where(index => index.ContentItemId == contentItemId) .FirstOrDefaultAsync(context.RequestAborted); From 88b27aaf1a8b3b7ce3bae9dbf8571189b22bab1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A1ra=20El-Saig?= Date: Thu, 12 Feb 2026 16:24:28 +0100 Subject: [PATCH 51/74] Remove unnecessary nullability constraints. --- .../Extensions/ArrayExtensions.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Lombiq.HelpfulLibraries.Common/Extensions/ArrayExtensions.cs b/Lombiq.HelpfulLibraries.Common/Extensions/ArrayExtensions.cs index fc6faac7..de3add81 100644 --- a/Lombiq.HelpfulLibraries.Common/Extensions/ArrayExtensions.cs +++ b/Lombiq.HelpfulLibraries.Common/Extensions/ArrayExtensions.cs @@ -11,7 +11,7 @@ public static class ArrayExtensions /// it's better to use this instead of the general `Any()` extension method. /// /// - public static bool Exists(this T?[] array, Predicate match) => Array.Exists(array, match); + public static bool Exists(this T[] array, Predicate match) => Array.Exists(array, match); /// /// A fluid alternative to . @@ -22,12 +22,12 @@ public static class ArrayExtensions /// it's better to use this instead of the general `FirstOrDefault()` extension method. /// /// - public static T? Find(this T?[] array, Predicate match) => Array.Find(array, match); + public static T? Find(this T[] array, Predicate match) => Array.Find(array, match); /// /// A fluid alternative to . /// - public static T?[] FindAll(this T?[] array, Predicate match) => Array.FindAll(array, match); + public static T[] FindAll(this T[] array, Predicate match) => Array.FindAll(array, match); /// /// A fluid alternative to . @@ -38,5 +38,5 @@ public static class ArrayExtensions /// it's better to use this instead of the general `All()` extension method. /// /// - public static bool TrueForAll(this T?[] array, Predicate match) => Array.TrueForAll(array, match); + public static bool TrueForAll(this T[] array, Predicate match) => Array.TrueForAll(array, match); } From 75bfa590e950bfc86ac027da50c58d934362fdfb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A1ra=20El-Saig?= Date: Thu, 12 Feb 2026 23:27:28 +0100 Subject: [PATCH 52/74] Update OC to avoid missing method exceptions. --- .../Lombiq.HelpfulLibraries.LinqToDb.csproj | 2 +- ...Lombiq.HelpfulLibraries.OrchardCore.csproj | 50 +++++++++---------- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/Lombiq.HelpfulLibraries.LinqToDb/Lombiq.HelpfulLibraries.LinqToDb.csproj b/Lombiq.HelpfulLibraries.LinqToDb/Lombiq.HelpfulLibraries.LinqToDb.csproj index d46e9486..b83da1f2 100644 --- a/Lombiq.HelpfulLibraries.LinqToDb/Lombiq.HelpfulLibraries.LinqToDb.csproj +++ b/Lombiq.HelpfulLibraries.LinqToDb/Lombiq.HelpfulLibraries.LinqToDb.csproj @@ -25,6 +25,6 @@ - + diff --git a/Lombiq.HelpfulLibraries.OrchardCore/Lombiq.HelpfulLibraries.OrchardCore.csproj b/Lombiq.HelpfulLibraries.OrchardCore/Lombiq.HelpfulLibraries.OrchardCore.csproj index 9b490c3c..20cd985d 100644 --- a/Lombiq.HelpfulLibraries.OrchardCore/Lombiq.HelpfulLibraries.OrchardCore.csproj +++ b/Lombiq.HelpfulLibraries.OrchardCore/Lombiq.HelpfulLibraries.OrchardCore.csproj @@ -24,35 +24,35 @@ - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + - - + + From 4f452842aaff2828513297856f0cb65aa64a80ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A1ra=20El-Saig?= Date: Fri, 13 Feb 2026 21:44:05 +0100 Subject: [PATCH 53/74] Update OC previews to fix package downgrade. --- .../Lombiq.HelpfulLibraries.Samples.csproj | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Lombiq.HelpfulLibraries.Samples/Lombiq.HelpfulLibraries.Samples.csproj b/Lombiq.HelpfulLibraries.Samples/Lombiq.HelpfulLibraries.Samples.csproj index d790faa2..69905145 100644 --- a/Lombiq.HelpfulLibraries.Samples/Lombiq.HelpfulLibraries.Samples.csproj +++ b/Lombiq.HelpfulLibraries.Samples/Lombiq.HelpfulLibraries.Samples.csproj @@ -12,12 +12,12 @@ - - - - - - + + + + + + From 6b4e69a1406940931177f8eb03b4e7f71bb9a44a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A1ra=20El-Saig?= Date: Sat, 21 Feb 2026 20:19:27 +0100 Subject: [PATCH 54/74] Update OC preview and fix build errors. --- .../Lombiq.HelpfulLibraries.LinqToDb.csproj | 2 +- ...ngleDisplayTypeContentPartDisplayDriver.cs | 2 +- ...Lombiq.HelpfulLibraries.OrchardCore.csproj | 50 +++++++++---------- 3 files changed, 27 insertions(+), 27 deletions(-) diff --git a/Lombiq.HelpfulLibraries.LinqToDb/Lombiq.HelpfulLibraries.LinqToDb.csproj b/Lombiq.HelpfulLibraries.LinqToDb/Lombiq.HelpfulLibraries.LinqToDb.csproj index b83da1f2..92c6aeaa 100644 --- a/Lombiq.HelpfulLibraries.LinqToDb/Lombiq.HelpfulLibraries.LinqToDb.csproj +++ b/Lombiq.HelpfulLibraries.LinqToDb/Lombiq.HelpfulLibraries.LinqToDb.csproj @@ -25,6 +25,6 @@ - + diff --git a/Lombiq.HelpfulLibraries.OrchardCore/Contents/SingleDisplayTypeContentPartDisplayDriver.cs b/Lombiq.HelpfulLibraries.OrchardCore/Contents/SingleDisplayTypeContentPartDisplayDriver.cs index 6aba2dc4..d45c8ceb 100644 --- a/Lombiq.HelpfulLibraries.OrchardCore/Contents/SingleDisplayTypeContentPartDisplayDriver.cs +++ b/Lombiq.HelpfulLibraries.OrchardCore/Contents/SingleDisplayTypeContentPartDisplayDriver.cs @@ -66,7 +66,7 @@ public FieldHiderPlacementInfoResolver(IServiceProvider provider) => if (placementContext.DisplayType == _driver.DisplayType && placementContext.Differentiator?.StartsWithOrdinal($"{typeof(TPart).Name}-") == true) { - return new PlacementInfo { Location = "-" }; + return new PlacementInfo(location: "-"); } return null; diff --git a/Lombiq.HelpfulLibraries.OrchardCore/Lombiq.HelpfulLibraries.OrchardCore.csproj b/Lombiq.HelpfulLibraries.OrchardCore/Lombiq.HelpfulLibraries.OrchardCore.csproj index 20cd985d..3163ba7e 100644 --- a/Lombiq.HelpfulLibraries.OrchardCore/Lombiq.HelpfulLibraries.OrchardCore.csproj +++ b/Lombiq.HelpfulLibraries.OrchardCore/Lombiq.HelpfulLibraries.OrchardCore.csproj @@ -24,35 +24,35 @@ - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + - - + + From 83a12dca13069eb902963dd899940f857fac4ba1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A1ra=20El-Saig?= Date: Sun, 22 Feb 2026 10:17:18 +0100 Subject: [PATCH 55/74] Update OC preview. --- .../Lombiq.HelpfulLibraries.LinqToDb.csproj | 2 +- ...Lombiq.HelpfulLibraries.OrchardCore.csproj | 50 +++++++++---------- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/Lombiq.HelpfulLibraries.LinqToDb/Lombiq.HelpfulLibraries.LinqToDb.csproj b/Lombiq.HelpfulLibraries.LinqToDb/Lombiq.HelpfulLibraries.LinqToDb.csproj index 92c6aeaa..f4b01673 100644 --- a/Lombiq.HelpfulLibraries.LinqToDb/Lombiq.HelpfulLibraries.LinqToDb.csproj +++ b/Lombiq.HelpfulLibraries.LinqToDb/Lombiq.HelpfulLibraries.LinqToDb.csproj @@ -25,6 +25,6 @@ - + diff --git a/Lombiq.HelpfulLibraries.OrchardCore/Lombiq.HelpfulLibraries.OrchardCore.csproj b/Lombiq.HelpfulLibraries.OrchardCore/Lombiq.HelpfulLibraries.OrchardCore.csproj index 3163ba7e..1bdfe186 100644 --- a/Lombiq.HelpfulLibraries.OrchardCore/Lombiq.HelpfulLibraries.OrchardCore.csproj +++ b/Lombiq.HelpfulLibraries.OrchardCore/Lombiq.HelpfulLibraries.OrchardCore.csproj @@ -24,35 +24,35 @@ - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + - - + + From f0210f01569f99a364684c78ae00b814c3bc7bef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A1ra=20El-Saig?= Date: Sun, 22 Feb 2026 12:36:34 +0100 Subject: [PATCH 56/74] OC preview version --- .../Lombiq.HelpfulLibraries.Samples.csproj | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Lombiq.HelpfulLibraries.Samples/Lombiq.HelpfulLibraries.Samples.csproj b/Lombiq.HelpfulLibraries.Samples/Lombiq.HelpfulLibraries.Samples.csproj index 69905145..4dddc94c 100644 --- a/Lombiq.HelpfulLibraries.Samples/Lombiq.HelpfulLibraries.Samples.csproj +++ b/Lombiq.HelpfulLibraries.Samples/Lombiq.HelpfulLibraries.Samples.csproj @@ -12,12 +12,12 @@ - - - - - - + + + + + + From c22dc8dafae1d1eaf2b69035d2c4407a16f74d12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A1ra=20El-Saig?= Date: Tue, 24 Feb 2026 05:01:30 +0100 Subject: [PATCH 57/74] Fix documentation. --- .../Extensions/EnumerableExtensions.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lombiq.HelpfulLibraries.Common/Extensions/EnumerableExtensions.cs b/Lombiq.HelpfulLibraries.Common/Extensions/EnumerableExtensions.cs index 14f723c4..0945086b 100644 --- a/Lombiq.HelpfulLibraries.Common/Extensions/EnumerableExtensions.cs +++ b/Lombiq.HelpfulLibraries.Common/Extensions/EnumerableExtensions.cs @@ -93,7 +93,7 @@ public static async Task AwaitEachAsync( } /// - /// Awaits the tasks sequentially while the action returns . + /// Awaits the tasks sequentially while the action returns . /// /// if the was never broken. public static async Task AwaitWhileAsync( From 1d8f273b560f2a02aa5a0c35755eac44c93370a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A1ra=20El-Saig?= Date: Sat, 28 Feb 2026 15:10:26 +0100 Subject: [PATCH 58/74] I don't think this is necessary. --- Lombiq.HelpfulLibraries/Lombiq.HelpfulLibraries.csproj | 1 - 1 file changed, 1 deletion(-) diff --git a/Lombiq.HelpfulLibraries/Lombiq.HelpfulLibraries.csproj b/Lombiq.HelpfulLibraries/Lombiq.HelpfulLibraries.csproj index 7f1daa21..5caf0e73 100644 --- a/Lombiq.HelpfulLibraries/Lombiq.HelpfulLibraries.csproj +++ b/Lombiq.HelpfulLibraries/Lombiq.HelpfulLibraries.csproj @@ -28,7 +28,6 @@ - From f45749c6edcfd37f94897b9b44d9e7133f4a3bef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A1ra=20El-Saig?= Date: Sat, 7 Mar 2026 11:32:52 +0100 Subject: [PATCH 59/74] Update OC preview. --- .../Lombiq.HelpfulLibraries.LinqToDb.csproj | 2 +- ...Lombiq.HelpfulLibraries.OrchardCore.csproj | 50 +++++++++---------- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/Lombiq.HelpfulLibraries.LinqToDb/Lombiq.HelpfulLibraries.LinqToDb.csproj b/Lombiq.HelpfulLibraries.LinqToDb/Lombiq.HelpfulLibraries.LinqToDb.csproj index f4b01673..196a01ce 100644 --- a/Lombiq.HelpfulLibraries.LinqToDb/Lombiq.HelpfulLibraries.LinqToDb.csproj +++ b/Lombiq.HelpfulLibraries.LinqToDb/Lombiq.HelpfulLibraries.LinqToDb.csproj @@ -25,6 +25,6 @@ - + diff --git a/Lombiq.HelpfulLibraries.OrchardCore/Lombiq.HelpfulLibraries.OrchardCore.csproj b/Lombiq.HelpfulLibraries.OrchardCore/Lombiq.HelpfulLibraries.OrchardCore.csproj index 1bdfe186..d8d8a61b 100644 --- a/Lombiq.HelpfulLibraries.OrchardCore/Lombiq.HelpfulLibraries.OrchardCore.csproj +++ b/Lombiq.HelpfulLibraries.OrchardCore/Lombiq.HelpfulLibraries.OrchardCore.csproj @@ -24,35 +24,35 @@ - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + - - + + From 7e05d13500876df127e8859052261443bc43f0a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A1ra=20El-Saig?= Date: Sat, 7 Mar 2026 12:00:22 +0100 Subject: [PATCH 60/74] Update OC preview. --- .../Lombiq.HelpfulLibraries.Samples.csproj | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Lombiq.HelpfulLibraries.Samples/Lombiq.HelpfulLibraries.Samples.csproj b/Lombiq.HelpfulLibraries.Samples/Lombiq.HelpfulLibraries.Samples.csproj index 4dddc94c..17b27133 100644 --- a/Lombiq.HelpfulLibraries.Samples/Lombiq.HelpfulLibraries.Samples.csproj +++ b/Lombiq.HelpfulLibraries.Samples/Lombiq.HelpfulLibraries.Samples.csproj @@ -12,12 +12,12 @@ - - - - - - + + + + + + From 49db6c94b4417c2202d8d48f804ced2d529c430b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A1ra=20El-Saig?= Date: Fri, 20 Mar 2026 15:15:26 +0100 Subject: [PATCH 61/74] Fix package consolidation. --- .../Lombiq.HelpfulLibraries.OrchardCore.Testing.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lombiq.HelpfulLibraries.OrchardCore.Testing/Lombiq.HelpfulLibraries.OrchardCore.Testing.csproj b/Lombiq.HelpfulLibraries.OrchardCore.Testing/Lombiq.HelpfulLibraries.OrchardCore.Testing.csproj index 5fbeed43..65d5818b 100644 --- a/Lombiq.HelpfulLibraries.OrchardCore.Testing/Lombiq.HelpfulLibraries.OrchardCore.Testing.csproj +++ b/Lombiq.HelpfulLibraries.OrchardCore.Testing/Lombiq.HelpfulLibraries.OrchardCore.Testing.csproj @@ -24,7 +24,7 @@ - + From 73e7bdbd76fb919733c08043e48882dbd3646702 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A1ra=20El-Saig?= Date: Fri, 20 Mar 2026 16:46:51 +0100 Subject: [PATCH 62/74] Update OC preview. --- .../Lombiq.HelpfulLibraries.LinqToDb.csproj | 2 +- ...Lombiq.HelpfulLibraries.OrchardCore.csproj | 50 +++++++++---------- .../Lombiq.HelpfulLibraries.Samples.csproj | 12 ++--- 3 files changed, 32 insertions(+), 32 deletions(-) diff --git a/Lombiq.HelpfulLibraries.LinqToDb/Lombiq.HelpfulLibraries.LinqToDb.csproj b/Lombiq.HelpfulLibraries.LinqToDb/Lombiq.HelpfulLibraries.LinqToDb.csproj index 196a01ce..22162bf3 100644 --- a/Lombiq.HelpfulLibraries.LinqToDb/Lombiq.HelpfulLibraries.LinqToDb.csproj +++ b/Lombiq.HelpfulLibraries.LinqToDb/Lombiq.HelpfulLibraries.LinqToDb.csproj @@ -25,6 +25,6 @@ - + diff --git a/Lombiq.HelpfulLibraries.OrchardCore/Lombiq.HelpfulLibraries.OrchardCore.csproj b/Lombiq.HelpfulLibraries.OrchardCore/Lombiq.HelpfulLibraries.OrchardCore.csproj index d8d8a61b..241e20dd 100644 --- a/Lombiq.HelpfulLibraries.OrchardCore/Lombiq.HelpfulLibraries.OrchardCore.csproj +++ b/Lombiq.HelpfulLibraries.OrchardCore/Lombiq.HelpfulLibraries.OrchardCore.csproj @@ -24,35 +24,35 @@ - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + - - + + diff --git a/Lombiq.HelpfulLibraries.Samples/Lombiq.HelpfulLibraries.Samples.csproj b/Lombiq.HelpfulLibraries.Samples/Lombiq.HelpfulLibraries.Samples.csproj index 17b27133..47ee422c 100644 --- a/Lombiq.HelpfulLibraries.Samples/Lombiq.HelpfulLibraries.Samples.csproj +++ b/Lombiq.HelpfulLibraries.Samples/Lombiq.HelpfulLibraries.Samples.csproj @@ -12,12 +12,12 @@ - - - - - - + + + + + + From 6f8ef276a3cbb7ee022b86f7ebebf31dc13e122e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A1ra=20El-Saig?= Date: Sun, 29 Mar 2026 01:38:58 +0100 Subject: [PATCH 63/74] Update OC preview. --- .../Lombiq.HelpfulLibraries.LinqToDb.csproj | 2 +- ...Lombiq.HelpfulLibraries.OrchardCore.csproj | 50 +++++++++---------- .../Lombiq.HelpfulLibraries.Samples.csproj | 12 ++--- 3 files changed, 32 insertions(+), 32 deletions(-) diff --git a/Lombiq.HelpfulLibraries.LinqToDb/Lombiq.HelpfulLibraries.LinqToDb.csproj b/Lombiq.HelpfulLibraries.LinqToDb/Lombiq.HelpfulLibraries.LinqToDb.csproj index 22162bf3..98a816bb 100644 --- a/Lombiq.HelpfulLibraries.LinqToDb/Lombiq.HelpfulLibraries.LinqToDb.csproj +++ b/Lombiq.HelpfulLibraries.LinqToDb/Lombiq.HelpfulLibraries.LinqToDb.csproj @@ -25,6 +25,6 @@ - + diff --git a/Lombiq.HelpfulLibraries.OrchardCore/Lombiq.HelpfulLibraries.OrchardCore.csproj b/Lombiq.HelpfulLibraries.OrchardCore/Lombiq.HelpfulLibraries.OrchardCore.csproj index 241e20dd..b10ada79 100644 --- a/Lombiq.HelpfulLibraries.OrchardCore/Lombiq.HelpfulLibraries.OrchardCore.csproj +++ b/Lombiq.HelpfulLibraries.OrchardCore/Lombiq.HelpfulLibraries.OrchardCore.csproj @@ -24,35 +24,35 @@ - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + - - + + diff --git a/Lombiq.HelpfulLibraries.Samples/Lombiq.HelpfulLibraries.Samples.csproj b/Lombiq.HelpfulLibraries.Samples/Lombiq.HelpfulLibraries.Samples.csproj index 47ee422c..8247d382 100644 --- a/Lombiq.HelpfulLibraries.Samples/Lombiq.HelpfulLibraries.Samples.csproj +++ b/Lombiq.HelpfulLibraries.Samples/Lombiq.HelpfulLibraries.Samples.csproj @@ -12,12 +12,12 @@ - - - - - - + + + + + + From 812fb3f0534ae54b6282474fcb7ed5e351e66e2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A1ra=20El-Saig?= Date: Wed, 8 Apr 2026 22:19:04 +0200 Subject: [PATCH 64/74] Update OC preview. --- .../Lombiq.HelpfulLibraries.LinqToDb.csproj | 2 +- ...Lombiq.HelpfulLibraries.OrchardCore.csproj | 50 +++++++++---------- .../Lombiq.HelpfulLibraries.Samples.csproj | 12 ++--- 3 files changed, 32 insertions(+), 32 deletions(-) diff --git a/Lombiq.HelpfulLibraries.LinqToDb/Lombiq.HelpfulLibraries.LinqToDb.csproj b/Lombiq.HelpfulLibraries.LinqToDb/Lombiq.HelpfulLibraries.LinqToDb.csproj index ecba006d..fb8a358e 100644 --- a/Lombiq.HelpfulLibraries.LinqToDb/Lombiq.HelpfulLibraries.LinqToDb.csproj +++ b/Lombiq.HelpfulLibraries.LinqToDb/Lombiq.HelpfulLibraries.LinqToDb.csproj @@ -25,6 +25,6 @@ - + diff --git a/Lombiq.HelpfulLibraries.OrchardCore/Lombiq.HelpfulLibraries.OrchardCore.csproj b/Lombiq.HelpfulLibraries.OrchardCore/Lombiq.HelpfulLibraries.OrchardCore.csproj index b10ada79..3fea0805 100644 --- a/Lombiq.HelpfulLibraries.OrchardCore/Lombiq.HelpfulLibraries.OrchardCore.csproj +++ b/Lombiq.HelpfulLibraries.OrchardCore/Lombiq.HelpfulLibraries.OrchardCore.csproj @@ -24,35 +24,35 @@ - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + - - + + diff --git a/Lombiq.HelpfulLibraries.Samples/Lombiq.HelpfulLibraries.Samples.csproj b/Lombiq.HelpfulLibraries.Samples/Lombiq.HelpfulLibraries.Samples.csproj index 8247d382..bb533027 100644 --- a/Lombiq.HelpfulLibraries.Samples/Lombiq.HelpfulLibraries.Samples.csproj +++ b/Lombiq.HelpfulLibraries.Samples/Lombiq.HelpfulLibraries.Samples.csproj @@ -12,12 +12,12 @@ - - - - - - + + + + + + From 08c32ec8737fcbbb05bae4489c03de3795303f64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A1ra=20El-Saig?= Date: Sat, 11 Apr 2026 16:18:57 +0200 Subject: [PATCH 65/74] Fix obsolete "As". --- .../Lombiq.HelpfulLibraries.LinqToDb.csproj | 2 +- .../Contents/ContentEnumerableExtensions.cs | 10 ++++ .../Contents/ContentExtensions.cs | 3 +- .../Contents/ContentManagerExtensions.cs | 6 +-- .../Contents/TaxonomyHelper.cs | 2 +- .../Data/IndexExtensions.cs | 4 +- .../Data/QueryExtensions.cs | 4 +- ...Lombiq.HelpfulLibraries.OrchardCore.csproj | 50 +++++++++---------- .../Lombiq.HelpfulLibraries.Samples.csproj | 12 ++--- 9 files changed, 52 insertions(+), 41 deletions(-) diff --git a/Lombiq.HelpfulLibraries.LinqToDb/Lombiq.HelpfulLibraries.LinqToDb.csproj b/Lombiq.HelpfulLibraries.LinqToDb/Lombiq.HelpfulLibraries.LinqToDb.csproj index fb8a358e..985307f8 100644 --- a/Lombiq.HelpfulLibraries.LinqToDb/Lombiq.HelpfulLibraries.LinqToDb.csproj +++ b/Lombiq.HelpfulLibraries.LinqToDb/Lombiq.HelpfulLibraries.LinqToDb.csproj @@ -25,6 +25,6 @@ - + diff --git a/Lombiq.HelpfulLibraries.OrchardCore/Contents/ContentEnumerableExtensions.cs b/Lombiq.HelpfulLibraries.OrchardCore/Contents/ContentEnumerableExtensions.cs index 12808fc4..f287d8c6 100644 --- a/Lombiq.HelpfulLibraries.OrchardCore/Contents/ContentEnumerableExtensions.cs +++ b/Lombiq.HelpfulLibraries.OrchardCore/Contents/ContentEnumerableExtensions.cs @@ -1,3 +1,4 @@ +using System; using System.Collections.Generic; namespace OrchardCore.ContentManagement; @@ -8,7 +9,16 @@ public static class ContentEnumerableExtensions /// Retrieves an enumeration of a content part based on its type from an enumeration of content items. /// /// The content part enumeration or empty enumeration if it doesn't exist. + [Obsolete($"Use {nameof(GetOrCreate)} instead.")] public static IEnumerable As(this IEnumerable? contents) where TPart : ContentPart => (contents?.SelectWhere(content => content.As())).EmptyIfNull(); + + /// + /// Retrieves an enumeration of a content part based on its type from an enumeration of content items. + /// + /// The content part enumeration or empty enumeration if it doesn't exist. + public static IEnumerable GetOrCreate(this IEnumerable? contents) + where TPart : ContentPart, new() => + (contents?.SelectWhere(content => content.GetOrCreate())).EmptyIfNull(); } diff --git a/Lombiq.HelpfulLibraries.OrchardCore/Contents/ContentExtensions.cs b/Lombiq.HelpfulLibraries.OrchardCore/Contents/ContentExtensions.cs index 50a9d3c5..1cf1539b 100644 --- a/Lombiq.HelpfulLibraries.OrchardCore/Contents/ContentExtensions.cs +++ b/Lombiq.HelpfulLibraries.OrchardCore/Contents/ContentExtensions.cs @@ -16,6 +16,7 @@ public static class ContentExtensions /// Gets a content part by its type. /// /// The content part or if it doesn't exist. + [Obsolete($"Use {nameof(GetOrCreate)} instead.")] public static TPart? As(this IContent content) where TPart : ContentPart => content.ContentItem.As(); @@ -129,7 +130,7 @@ public static async Task SanitizeContentItemVersionsAsync(this IContent content, /// /// Content item containing . /// Alias of the content item. - public static string? GetAlias(this IContent content) => content.As()?.Alias; + public static string? GetAlias(this IContent content) => content.GetOrCreate().Alias; /// /// Provides the most essential data for a enough to identify it in a text format. Can be diff --git a/Lombiq.HelpfulLibraries.OrchardCore/Contents/ContentManagerExtensions.cs b/Lombiq.HelpfulLibraries.OrchardCore/Contents/ContentManagerExtensions.cs index 53219855..1ec6e5a7 100644 --- a/Lombiq.HelpfulLibraries.OrchardCore/Contents/ContentManagerExtensions.cs +++ b/Lombiq.HelpfulLibraries.OrchardCore/Contents/ContentManagerExtensions.cs @@ -15,7 +15,7 @@ public static class ContentManagerExtensions /// The version data of the content item to retrieve. public static async Task GetAsync(this IContentManager contentManager, string id, VersionOptions? versionOptions = null) where T : ContentPart => - (await contentManager.GetAsync(id, versionOptions))?.As(); + (await contentManager.GetAsync(id, versionOptions))?.TryGet(out var result) == true ? result : null; /// /// Persists the given with a new version if it does not exist yet, or updates it @@ -54,7 +54,7 @@ public static async Task> GetTaxonomyTermsAsync( ? null : await contentManager.GetAsync(taxonomyContentItemId); - return taxonomy?.As()?.Terms ?? []; + return taxonomy?.GetOrCreate()?.Terms ?? []; } /// @@ -68,7 +68,7 @@ public static async Task> GetTaxonomyTermsDisplayTex this IContentManager contentManager, string taxonomyId) => (await contentManager.GetAsync(taxonomyId)) - .As() + .GetOrCreate() .Terms .ToDictionary(term => term.ContentItemId, term => term.DisplayText); diff --git a/Lombiq.HelpfulLibraries.OrchardCore/Contents/TaxonomyHelper.cs b/Lombiq.HelpfulLibraries.OrchardCore/Contents/TaxonomyHelper.cs index cc7bd390..4215f5d4 100644 --- a/Lombiq.HelpfulLibraries.OrchardCore/Contents/TaxonomyHelper.cs +++ b/Lombiq.HelpfulLibraries.OrchardCore/Contents/TaxonomyHelper.cs @@ -54,7 +54,7 @@ public static IList GetAllChildren(ContentItem? contentItem, bool i if (contentItem == null) return results; if (includeSelf) results.Add(contentItem); - var partTerms = contentItem.As()?.Terms ?? Enumerable.Empty(); + var partTerms = contentItem.GetOrCreate()?.Terms ?? Enumerable.Empty(); var itemTerms = contentItem.GetProperty>(nameof(TaxonomyPart.Terms)) ?? Enumerable.Empty(); foreach (var child in partTerms.Concat(itemTerms)) { diff --git a/Lombiq.HelpfulLibraries.OrchardCore/Data/IndexExtensions.cs b/Lombiq.HelpfulLibraries.OrchardCore/Data/IndexExtensions.cs index eae597ee..0e327730 100644 --- a/Lombiq.HelpfulLibraries.OrchardCore/Data/IndexExtensions.cs +++ b/Lombiq.HelpfulLibraries.OrchardCore/Data/IndexExtensions.cs @@ -28,9 +28,9 @@ public static IGroupFor Map( this IMapFor mapFor, Func mapPartToIndex, bool latest = true) - where TPart : ContentPart + where TPart : ContentPart, new() where TIndex : IIndex => mapFor .When(item => item.Has() && (item.Latest || !latest)) - .Map(item => mapPartToIndex(item.As())); + .Map(item => mapPartToIndex(item.GetOrCreate())); } diff --git a/Lombiq.HelpfulLibraries.OrchardCore/Data/QueryExtensions.cs b/Lombiq.HelpfulLibraries.OrchardCore/Data/QueryExtensions.cs index 41d6014d..8c6e7471 100644 --- a/Lombiq.HelpfulLibraries.OrchardCore/Data/QueryExtensions.cs +++ b/Lombiq.HelpfulLibraries.OrchardCore/Data/QueryExtensions.cs @@ -52,9 +52,9 @@ public static Task> PaginateAsync( this IQuery query, int pageIndex = 0, int count = int.MaxValue) - where TPart : ContentPart => + where TPart : ContentPart, new() => PaginateAsync(query, pageIndex, count) - .ContinueWith(t => t.Result.As(), TaskScheduler.Default); + .ContinueWith(t => t.Result.GetOrCreate(), TaskScheduler.Default); /// /// Breaks the query up into pages and lists the page using the given zero-based index. If pageIndex is 0 and count diff --git a/Lombiq.HelpfulLibraries.OrchardCore/Lombiq.HelpfulLibraries.OrchardCore.csproj b/Lombiq.HelpfulLibraries.OrchardCore/Lombiq.HelpfulLibraries.OrchardCore.csproj index 3fea0805..5bc35698 100644 --- a/Lombiq.HelpfulLibraries.OrchardCore/Lombiq.HelpfulLibraries.OrchardCore.csproj +++ b/Lombiq.HelpfulLibraries.OrchardCore/Lombiq.HelpfulLibraries.OrchardCore.csproj @@ -24,35 +24,35 @@ - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + - - + + diff --git a/Lombiq.HelpfulLibraries.Samples/Lombiq.HelpfulLibraries.Samples.csproj b/Lombiq.HelpfulLibraries.Samples/Lombiq.HelpfulLibraries.Samples.csproj index bb533027..ed2a6e73 100644 --- a/Lombiq.HelpfulLibraries.Samples/Lombiq.HelpfulLibraries.Samples.csproj +++ b/Lombiq.HelpfulLibraries.Samples/Lombiq.HelpfulLibraries.Samples.csproj @@ -12,12 +12,12 @@ - - - - - - + + + + + + From 48972b593f98d4cea94eedde6ee3ff14b7c97b76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A1ra=20El-Saig?= Date: Sat, 11 Apr 2026 16:58:23 +0200 Subject: [PATCH 66/74] Fix new problems after OC update and merge from dev. --- Lombiq.HelpfulLibraries.OrchardCore/Data/IndexExtensions.cs | 2 +- .../Elasticsearch/ConfigurationExtensions.cs | 6 +++--- .../Elasticsearch/ElasticIndexManagerExtensions.cs | 1 + .../Elasticsearch/ElasticsearchClientExtensions.cs | 4 ++-- .../ElasticsearchIndexProfileStoreExtensions.cs | 2 +- .../Lombiq.HelpfulLibraries.OrchardCore.csproj | 4 ++-- 6 files changed, 10 insertions(+), 9 deletions(-) diff --git a/Lombiq.HelpfulLibraries.OrchardCore/Data/IndexExtensions.cs b/Lombiq.HelpfulLibraries.OrchardCore/Data/IndexExtensions.cs index 0e327730..ae903265 100644 --- a/Lombiq.HelpfulLibraries.OrchardCore/Data/IndexExtensions.cs +++ b/Lombiq.HelpfulLibraries.OrchardCore/Data/IndexExtensions.cs @@ -16,7 +16,7 @@ public static IGroupFor MapFor( this DescribeContext context, Func map, bool latest = true) - where TPart : ContentPart + where TPart : ContentPart, new() where TIndex : IIndex => context.For().Map(map, latest); diff --git a/Lombiq.HelpfulLibraries.OrchardCore/Elasticsearch/ConfigurationExtensions.cs b/Lombiq.HelpfulLibraries.OrchardCore/Elasticsearch/ConfigurationExtensions.cs index 8e585322..0f44e66d 100644 --- a/Lombiq.HelpfulLibraries.OrchardCore/Elasticsearch/ConfigurationExtensions.cs +++ b/Lombiq.HelpfulLibraries.OrchardCore/Elasticsearch/ConfigurationExtensions.cs @@ -1,8 +1,8 @@ using Elastic.Clients.Elasticsearch; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Logging.Abstractions; -using OrchardCore.Search.Elasticsearch.Core.Models; -using OrchardCore.Search.Elasticsearch.Core.Services; +using OrchardCore.Elasticsearch.Core.Models; +using OrchardCore.Elasticsearch.Core.Services; using System; namespace OrchardCore.Environment.Shell.Configuration; @@ -17,7 +17,7 @@ public static ElasticsearchClient CreateElasticClient(this IShellConfiguration s /// Returns a new instance of the client. /// /// - /// Same as the code found in . + /// Same as the code found in . /// public static ElasticsearchClient CreateElasticsearchClient( this IShellConfiguration shellConfiguration, diff --git a/Lombiq.HelpfulLibraries.OrchardCore/Elasticsearch/ElasticIndexManagerExtensions.cs b/Lombiq.HelpfulLibraries.OrchardCore/Elasticsearch/ElasticIndexManagerExtensions.cs index c65bebba..4b12e5d4 100644 --- a/Lombiq.HelpfulLibraries.OrchardCore/Elasticsearch/ElasticIndexManagerExtensions.cs +++ b/Lombiq.HelpfulLibraries.OrchardCore/Elasticsearch/ElasticIndexManagerExtensions.cs @@ -1,4 +1,5 @@ using Elastic.Clients.Elasticsearch; +using OrchardCore.Elasticsearch.Core.Services; using System; using System.Threading.Tasks; diff --git a/Lombiq.HelpfulLibraries.OrchardCore/Elasticsearch/ElasticsearchClientExtensions.cs b/Lombiq.HelpfulLibraries.OrchardCore/Elasticsearch/ElasticsearchClientExtensions.cs index bc8dbc7d..f5a2f17b 100644 --- a/Lombiq.HelpfulLibraries.OrchardCore/Elasticsearch/ElasticsearchClientExtensions.cs +++ b/Lombiq.HelpfulLibraries.OrchardCore/Elasticsearch/ElasticsearchClientExtensions.cs @@ -2,8 +2,8 @@ using Elastic.Clients.Elasticsearch.IndexManagement; using Microsoft.Extensions.Configuration; using OrchardCore.Environment.Shell.Configuration; -using OrchardCore.Search.Elasticsearch; -using OrchardCore.Search.Elasticsearch.Core.Services; +using OrchardCore.Elasticsearch; +using OrchardCore.Elasticsearch.Core.Services; using System.Linq; using System.Threading.Tasks; diff --git a/Lombiq.HelpfulLibraries.OrchardCore/Elasticsearch/ElasticsearchIndexProfileStoreExtensions.cs b/Lombiq.HelpfulLibraries.OrchardCore/Elasticsearch/ElasticsearchIndexProfileStoreExtensions.cs index 7c0c786f..ad7b918d 100644 --- a/Lombiq.HelpfulLibraries.OrchardCore/Elasticsearch/ElasticsearchIndexProfileStoreExtensions.cs +++ b/Lombiq.HelpfulLibraries.OrchardCore/Elasticsearch/ElasticsearchIndexProfileStoreExtensions.cs @@ -1,5 +1,5 @@ using OrchardCore.Indexing.Models; -using OrchardCore.Search.Elasticsearch; +using OrchardCore.Elasticsearch; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; diff --git a/Lombiq.HelpfulLibraries.OrchardCore/Lombiq.HelpfulLibraries.OrchardCore.csproj b/Lombiq.HelpfulLibraries.OrchardCore/Lombiq.HelpfulLibraries.OrchardCore.csproj index 5bc35698..8fd9645a 100644 --- a/Lombiq.HelpfulLibraries.OrchardCore/Lombiq.HelpfulLibraries.OrchardCore.csproj +++ b/Lombiq.HelpfulLibraries.OrchardCore/Lombiq.HelpfulLibraries.OrchardCore.csproj @@ -30,7 +30,7 @@ - + @@ -40,7 +40,7 @@ - + From d7e46281b935cf8593427d437ac135a47bd32974 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A1ra=20El-Saig?= Date: Sat, 11 Apr 2026 17:42:28 +0200 Subject: [PATCH 67/74] Fix new problems after OC update and merge from dev. --- .../Elasticsearch/ElasticIndexManagerExtensions.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Lombiq.HelpfulLibraries.OrchardCore/Elasticsearch/ElasticIndexManagerExtensions.cs b/Lombiq.HelpfulLibraries.OrchardCore/Elasticsearch/ElasticIndexManagerExtensions.cs index 4b12e5d4..864b5e2b 100644 --- a/Lombiq.HelpfulLibraries.OrchardCore/Elasticsearch/ElasticIndexManagerExtensions.cs +++ b/Lombiq.HelpfulLibraries.OrchardCore/Elasticsearch/ElasticIndexManagerExtensions.cs @@ -1,9 +1,8 @@ using Elastic.Clients.Elasticsearch; -using OrchardCore.Elasticsearch.Core.Services; using System; using System.Threading.Tasks; -namespace OrchardCore.Search.Elasticsearch.Core.Services; +namespace OrchardCore.Elasticsearch.Core.Services; public static class ElasticIndexManagerExtensions { From eccbb376a528bc6aee2e00f0a9aa7321d92a6b49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A1ra=20El-Saig?= Date: Sat, 11 Apr 2026 18:38:54 +0200 Subject: [PATCH 68/74] Fix SA1210, SA1210, MA0127. --- .../Elasticsearch/ElasticsearchClientExtensions.cs | 2 +- .../Elasticsearch/ElasticsearchIndexProfileStoreExtensions.cs | 3 ++- .../ResourceManagement/ResourceFilterBuilder.cs | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Lombiq.HelpfulLibraries.OrchardCore/Elasticsearch/ElasticsearchClientExtensions.cs b/Lombiq.HelpfulLibraries.OrchardCore/Elasticsearch/ElasticsearchClientExtensions.cs index f5a2f17b..638b72bc 100644 --- a/Lombiq.HelpfulLibraries.OrchardCore/Elasticsearch/ElasticsearchClientExtensions.cs +++ b/Lombiq.HelpfulLibraries.OrchardCore/Elasticsearch/ElasticsearchClientExtensions.cs @@ -1,9 +1,9 @@ using Elastic.Clients.Elasticsearch.Core; using Elastic.Clients.Elasticsearch.IndexManagement; using Microsoft.Extensions.Configuration; -using OrchardCore.Environment.Shell.Configuration; using OrchardCore.Elasticsearch; using OrchardCore.Elasticsearch.Core.Services; +using OrchardCore.Environment.Shell.Configuration; using System.Linq; using System.Threading.Tasks; diff --git a/Lombiq.HelpfulLibraries.OrchardCore/Elasticsearch/ElasticsearchIndexProfileStoreExtensions.cs b/Lombiq.HelpfulLibraries.OrchardCore/Elasticsearch/ElasticsearchIndexProfileStoreExtensions.cs index ad7b918d..970af9dc 100644 --- a/Lombiq.HelpfulLibraries.OrchardCore/Elasticsearch/ElasticsearchIndexProfileStoreExtensions.cs +++ b/Lombiq.HelpfulLibraries.OrchardCore/Elasticsearch/ElasticsearchIndexProfileStoreExtensions.cs @@ -1,8 +1,9 @@ -using OrchardCore.Indexing.Models; using OrchardCore.Elasticsearch; +using OrchardCore.Indexing.Models; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; + namespace OrchardCore.Indexing; public static class ElasticsearchIndexProfileStoreExtensions diff --git a/Lombiq.HelpfulLibraries.OrchardCore/ResourceManagement/ResourceFilterBuilder.cs b/Lombiq.HelpfulLibraries.OrchardCore/ResourceManagement/ResourceFilterBuilder.cs index 1f3c5b7f..b8225125 100644 --- a/Lombiq.HelpfulLibraries.OrchardCore/ResourceManagement/ResourceFilterBuilder.cs +++ b/Lombiq.HelpfulLibraries.OrchardCore/ResourceManagement/ResourceFilterBuilder.cs @@ -166,7 +166,7 @@ private ResourceFilter WhenContentTypeInner(string displayType, params string[] var session = context.RequestServices.GetRequiredService(); // In case of Edit, we check for both published and draft content items. - var query = displayType is "Edit" + var query = string.Equals(displayType, "Edit", StringComparison.Ordinal) ? session.QueryIndex(index => index.Published || (index.Latest && !index.Published)) : session.QueryContentItemIndex(PublicationStatus.Published); From 00aaca864a9a5f7e2e761a523f395e1be8884754 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A1ra=20El-Saig?= Date: Sat, 11 Apr 2026 22:35:12 +0200 Subject: [PATCH 69/74] Fix and clean up GetOrCreate usages. --- .../Contents/ContentEnumerableExtensions.cs | 2 +- .../Contents/ContentExtensions.cs | 11 ++++++++++- .../Contents/ContentManagerExtensions.cs | 2 +- .../Contents/TaxonomyHelper.cs | 2 +- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/Lombiq.HelpfulLibraries.OrchardCore/Contents/ContentEnumerableExtensions.cs b/Lombiq.HelpfulLibraries.OrchardCore/Contents/ContentEnumerableExtensions.cs index f287d8c6..ca6ad13a 100644 --- a/Lombiq.HelpfulLibraries.OrchardCore/Contents/ContentEnumerableExtensions.cs +++ b/Lombiq.HelpfulLibraries.OrchardCore/Contents/ContentEnumerableExtensions.cs @@ -20,5 +20,5 @@ public static IEnumerable As(this IEnumerable? contents) /// The content part enumeration or empty enumeration if it doesn't exist. public static IEnumerable GetOrCreate(this IEnumerable? contents) where TPart : ContentPart, new() => - (contents?.SelectWhere(content => content.GetOrCreate())).EmptyIfNull(); + (contents?.SelectWhere(content => content.GetMaybe())).EmptyIfNull(); } diff --git a/Lombiq.HelpfulLibraries.OrchardCore/Contents/ContentExtensions.cs b/Lombiq.HelpfulLibraries.OrchardCore/Contents/ContentExtensions.cs index 1cf1539b..5befb95a 100644 --- a/Lombiq.HelpfulLibraries.OrchardCore/Contents/ContentExtensions.cs +++ b/Lombiq.HelpfulLibraries.OrchardCore/Contents/ContentExtensions.cs @@ -21,6 +21,15 @@ public static class ContentExtensions where TPart : ContentPart => content.ContentItem.As(); + /// + /// Gets a content part by its type or create a new one. + /// + /// The type of the content part. + /// The content part instance or a new one if it doesn't exist. + public static TPart? GetMaybe(this IContent? content) + where TPart : ContentPart, new() => + content?.ContentItem?.TryGet(out var part) == true ? part : null; + /// /// Gets a content part by its type or create a new one. /// @@ -130,7 +139,7 @@ public static async Task SanitizeContentItemVersionsAsync(this IContent content, /// /// Content item containing . /// Alias of the content item. - public static string? GetAlias(this IContent content) => content.GetOrCreate().Alias; + public static string? GetAlias(this IContent content) => content.GetMaybe()?.Alias; /// /// Provides the most essential data for a enough to identify it in a text format. Can be diff --git a/Lombiq.HelpfulLibraries.OrchardCore/Contents/ContentManagerExtensions.cs b/Lombiq.HelpfulLibraries.OrchardCore/Contents/ContentManagerExtensions.cs index 1ec6e5a7..5cf9dd09 100644 --- a/Lombiq.HelpfulLibraries.OrchardCore/Contents/ContentManagerExtensions.cs +++ b/Lombiq.HelpfulLibraries.OrchardCore/Contents/ContentManagerExtensions.cs @@ -54,7 +54,7 @@ public static async Task> GetTaxonomyTermsAsync( ? null : await contentManager.GetAsync(taxonomyContentItemId); - return taxonomy?.GetOrCreate()?.Terms ?? []; + return taxonomy?.GetOrCreate().Terms ?? []; } /// diff --git a/Lombiq.HelpfulLibraries.OrchardCore/Contents/TaxonomyHelper.cs b/Lombiq.HelpfulLibraries.OrchardCore/Contents/TaxonomyHelper.cs index 4215f5d4..df051b58 100644 --- a/Lombiq.HelpfulLibraries.OrchardCore/Contents/TaxonomyHelper.cs +++ b/Lombiq.HelpfulLibraries.OrchardCore/Contents/TaxonomyHelper.cs @@ -54,7 +54,7 @@ public static IList GetAllChildren(ContentItem? contentItem, bool i if (contentItem == null) return results; if (includeSelf) results.Add(contentItem); - var partTerms = contentItem.GetOrCreate()?.Terms ?? Enumerable.Empty(); + var partTerms = contentItem.GetOrCreate().Terms ?? Enumerable.Empty(); var itemTerms = contentItem.GetProperty>(nameof(TaxonomyPart.Terms)) ?? Enumerable.Empty(); foreach (var child in partTerms.Concat(itemTerms)) { From f4674092070cb3d579712b9d9790522d5f436b63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A1ra=20El-Saig?= Date: Sun, 12 Apr 2026 00:59:16 +0200 Subject: [PATCH 70/74] AddDefaultTenantFeatures on BuildVersionDisplay. --- .../HostingDefaultsOrchardCoreBuilderExtensions.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Lombiq.HelpfulLibraries.OrchardCore/Environment/HostingDefaultsOrchardCoreBuilderExtensions.cs b/Lombiq.HelpfulLibraries.OrchardCore/Environment/HostingDefaultsOrchardCoreBuilderExtensions.cs index 7f5ee9dc..d143cb37 100644 --- a/Lombiq.HelpfulLibraries.OrchardCore/Environment/HostingDefaultsOrchardCoreBuilderExtensions.cs +++ b/Lombiq.HelpfulLibraries.OrchardCore/Environment/HostingDefaultsOrchardCoreBuilderExtensions.cs @@ -1,3 +1,4 @@ +using Lombiq.HelpfulLibraries.OrchardCore.DependencyInjection; using Microsoft.AspNetCore.Builder; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Hosting; @@ -122,9 +123,8 @@ public static OrchardCoreBuilder ConfigureAzureHostingDefaults( if (webApplicationBuilder.Configuration.IsAzureHosting()) { builder - .AddTenantFeatures( - "OrchardCore.DataProtection.Azure", - "Lombiq.Hosting.BuildVersionDisplay") + .AddDefaultTenantFeatures("Lombiq.Hosting.BuildVersionDisplay") + .AddTenantFeatures("OrchardCore.DataProtection.Azure") .DisableResourceDebugMode(); if (hostingConfiguration.AlwaysEnableAzureMediaStorage) From c76db74bf7c91a7975349b55e1ca946e68388e89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A1ra=20El-Saig?= Date: Mon, 13 Apr 2026 03:52:26 +0200 Subject: [PATCH 71/74] Prevent NRE. --- .../Elasticsearch/ConfigurationExtensions.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lombiq.HelpfulLibraries.OrchardCore/Elasticsearch/ConfigurationExtensions.cs b/Lombiq.HelpfulLibraries.OrchardCore/Elasticsearch/ConfigurationExtensions.cs index 0f44e66d..4950bdd2 100644 --- a/Lombiq.HelpfulLibraries.OrchardCore/Elasticsearch/ConfigurationExtensions.cs +++ b/Lombiq.HelpfulLibraries.OrchardCore/Elasticsearch/ConfigurationExtensions.cs @@ -26,7 +26,7 @@ public static ElasticsearchClient CreateElasticsearchClient( factory ??= new ElasticsearchClientFactory(NullLogger.Instance); var configuration = shellConfiguration.GetSection(ElasticsearchConnectionOptionsConfigurations.ConfigSectionName); - var connectionOptions = configuration.Get(); + var connectionOptions = configuration.Get() ?? new ElasticsearchConnectionOptions(); return factory.Create(connectionOptions); } From 74530be966cfa4b5f6e843110f2fd56fc934ed6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A1ra=20El-Saig?= Date: Mon, 13 Apr 2026 04:34:25 +0200 Subject: [PATCH 72/74] Try to fix NRE for real. --- .../Elasticsearch/ConfigurationExtensions.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Lombiq.HelpfulLibraries.OrchardCore/Elasticsearch/ConfigurationExtensions.cs b/Lombiq.HelpfulLibraries.OrchardCore/Elasticsearch/ConfigurationExtensions.cs index 4950bdd2..f9bc0355 100644 --- a/Lombiq.HelpfulLibraries.OrchardCore/Elasticsearch/ConfigurationExtensions.cs +++ b/Lombiq.HelpfulLibraries.OrchardCore/Elasticsearch/ConfigurationExtensions.cs @@ -26,8 +26,8 @@ public static ElasticsearchClient CreateElasticsearchClient( factory ??= new ElasticsearchClientFactory(NullLogger.Instance); var configuration = shellConfiguration.GetSection(ElasticsearchConnectionOptionsConfigurations.ConfigSectionName); - var connectionOptions = configuration.Get() ?? new ElasticsearchConnectionOptions(); + var connectionOptions = configuration.Get(); - return factory.Create(connectionOptions); + return connectionOptions == null ? new ElasticsearchClient() : factory.Create(connectionOptions); } } From 8f6693958204ddebcc6ac24ffadb671a6498e5b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A1ra=20El-Saig?= Date: Mon, 13 Apr 2026 14:14:56 +0200 Subject: [PATCH 73/74] Update OC preview. --- .../Lombiq.HelpfulLibraries.LinqToDb.csproj | 2 +- ...Lombiq.HelpfulLibraries.OrchardCore.csproj | 50 +++++++++---------- .../Lombiq.HelpfulLibraries.Samples.csproj | 12 ++--- 3 files changed, 32 insertions(+), 32 deletions(-) diff --git a/Lombiq.HelpfulLibraries.LinqToDb/Lombiq.HelpfulLibraries.LinqToDb.csproj b/Lombiq.HelpfulLibraries.LinqToDb/Lombiq.HelpfulLibraries.LinqToDb.csproj index 985307f8..d2aeac0e 100644 --- a/Lombiq.HelpfulLibraries.LinqToDb/Lombiq.HelpfulLibraries.LinqToDb.csproj +++ b/Lombiq.HelpfulLibraries.LinqToDb/Lombiq.HelpfulLibraries.LinqToDb.csproj @@ -25,6 +25,6 @@ - + diff --git a/Lombiq.HelpfulLibraries.OrchardCore/Lombiq.HelpfulLibraries.OrchardCore.csproj b/Lombiq.HelpfulLibraries.OrchardCore/Lombiq.HelpfulLibraries.OrchardCore.csproj index 8fd9645a..c1549197 100644 --- a/Lombiq.HelpfulLibraries.OrchardCore/Lombiq.HelpfulLibraries.OrchardCore.csproj +++ b/Lombiq.HelpfulLibraries.OrchardCore/Lombiq.HelpfulLibraries.OrchardCore.csproj @@ -24,35 +24,35 @@ - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + - - + + diff --git a/Lombiq.HelpfulLibraries.Samples/Lombiq.HelpfulLibraries.Samples.csproj b/Lombiq.HelpfulLibraries.Samples/Lombiq.HelpfulLibraries.Samples.csproj index ed2a6e73..a1f43b99 100644 --- a/Lombiq.HelpfulLibraries.Samples/Lombiq.HelpfulLibraries.Samples.csproj +++ b/Lombiq.HelpfulLibraries.Samples/Lombiq.HelpfulLibraries.Samples.csproj @@ -12,12 +12,12 @@ - - - - - - + + + + + + From a30771f3d119712cf516b5f007b133e5d46dfde0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A1ra=20El-Saig?= Date: Sat, 18 Apr 2026 13:47:13 +0200 Subject: [PATCH 74/74] Add EqualsOrdinal to fix CA1309. --- .../Extensions/StringExtensions.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Lombiq.HelpfulLibraries.Common/Extensions/StringExtensions.cs b/Lombiq.HelpfulLibraries.Common/Extensions/StringExtensions.cs index 8b3d53cf..e20e2fe6 100644 --- a/Lombiq.HelpfulLibraries.Common/Extensions/StringExtensions.cs +++ b/Lombiq.HelpfulLibraries.Common/Extensions/StringExtensions.cs @@ -98,6 +98,12 @@ public static string[] SplitByNewLines(this string? text) => public static bool ContainsLoose(this string? text, string? toFind) => text != null && toFind != null && text.Contains(toFind, StringComparison.InvariantCultureIgnoreCase); + /// + /// A shortcut for string.Equals(string, StringComparison.Ordinal). + /// + public static bool EqualsOrdinal(this string? text, string? value) => + text?.Equals(value, StringComparison.Ordinal) == true; + /// /// A shortcut for string.Equals(string, StringComparison.OrdinalIgnoreCase). ///