diff --git a/.editorconfig b/.editorconfig index 2cf117a4d88..7181698744e 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,3 +1,11 @@ +# Define rule severity for each diagnostic rule ID which should be displayed or hidden in the Error List window +# dotnet_diagnostic..severity = + +# Severity levels: (https://learn.microsoft.com/visualstudio/code-quality/use-roslyn-analyzers?view=vs-2019#rule-severity) +# suggestion, error, and warning show up in the editor and Error List. +# silent shows up only in the editor as a light bulb code-refactoring action. +# none shows up in neither. + root = true [*] @@ -22,14 +30,63 @@ csharp_new_line_before_finally = true csharp_new_line_before_members_in_object_initializers = true csharp_new_line_before_members_in_anonymous_types = true -dotnet_diagnostic.IDE0290.severity = none -dotnet_diagnostic.IDE0305.severity = none +dotnet_diagnostic.IDE0290.severity = none # Use primary constructor +csharp_style_prefer_primary_constructors = false + +dotnet_diagnostic.IDE0305.severity = none # Use collection expression for fluent +dotnet_style_prefer_collection_expression = when_types_exactly_match + +# Block bodies +dotnet_diagnostic.IDE0021.severity = none # Use block body for constructor +csharp_style_expression_bodied_constructors = false +dotnet_diagnostic.IDE0022.severity = none # Use block body for method +dotnet_diagnostic.IDE0023.severity = none # Use block body for conversion operator +csharp_style_expression_bodied_operators = when_on_single_line +dotnet_diagnostic.IDE0025.severity = silent # Use expression body for property +csharp_style_expression_bodied_properties = when_on_single_line +dotnet_diagnostic.IDE0026.severity = none # Use expression body for indexers +csharp_style_expression_bodied_indexers = when_on_single_line +dotnet_diagnostic.IDE0027.severity = none # Use block body for accessors +csharp_style_expression_bodied_accessors = when_on_single_line +dotnet_diagnostic.IDE0028.severity = silent # Collection initialization can be simplified +dotnet_diagnostic.IDE0061.severity = silent # Use body for local function + +dotnet_diagnostic.IDE0032.severity = silent # Use auto property +dotnet_diagnostic.IDE0040.severity = warning # Accessibility modifiers required +dotnet_diagnostic.IDE0041.severity = silent # Null check can be simplified +dotnet_diagnostic.IDE0051.severity = warning # Make field readonly +dotnet_diagnostic.IDE0074.severity = silent # Use compound assignment +dotnet_diagnostic.IDE0090.severity = silent # New expression can be simplified +dotnet_diagnostic.IDE1006.severity = silent # Name rule violation: missing prefix + +dotnet_diagnostic.IDE0011.severity = warning # If statement can be simplified +dotnet_diagnostic.IDE0045.severity = silent # If statement can be simplified +dotnet_diagnostic.IDE0046.severity = silent # If statement can be simplified +dotnet_diagnostic.IDE0047.severity = silent # Parentheses can be removed +dotnet_diagnostic.IDE0060.severity = warning # Use Remove unused parameter if not part of a shipped public API +dotnet_diagnostic.IDE0051.severity = warning # Private member is unused +dotnet_diagnostic.IDE0052.severity = warning # Private member can be removed as the value assigned to it is never read +dotnet_diagnostic.IDE0065.severity = warning # Using directives must be placed outside of a namespace declaration +csharp_using_directive_placement 4 = outside_namespace + +dotnet_diagnostic.IDE0100.severity = silent # Use block body for constructor +dotnet_diagnostic.IDE0200.severity = silent # Lambda expression can be removed +dotnet_diagnostic.IDE0300.severity = silent # Collection expression can be simplified +dotnet_diagnostic.IDE0301.severity = silent # Collection initialization can be simplified +dotnet_diagnostic.IDE0302.severity = silent # Collection initialization can be simplified +dotnet_diagnostic.IDE0303.severity = silent # Collection initialization can be simplified + +dotnet_diagnostic.IDE0078.severity = silent # Use pattern matching + +dotnet_style_prefer_conditional_expression_over_assignment = silent # Remove redundant equality, e.g. Disabled == false + +dotnet_diagnostic.CA2263.severity = warning # Prefer generic overload when type is known # Sort using and Import directives with System.* appearing first dotnet_sort_system_directives_first = true # Code-block preferences -csharp_prefer_braces = true +csharp_prefer_braces = true csharp_prefer_simple_using_statement = true csharp_style_namespace_declarations = file_scoped:warning # Note that currently both IDE* rules and csharp_style_* rules are necessary, because only IDE rules will be enforced diff --git a/src/OrchardCore.Modules/OrchardCore.Admin/Drivers/AdminSiteSettingsDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.Admin/Drivers/AdminSiteSettingsDisplayDriver.cs index ef8fb39f354..a0848bbc594 100644 --- a/src/OrchardCore.Modules/OrchardCore.Admin/Drivers/AdminSiteSettingsDisplayDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Admin/Drivers/AdminSiteSettingsDisplayDriver.cs @@ -1,4 +1,3 @@ -using System; using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Http; diff --git a/src/OrchardCore.Modules/OrchardCore.AdminDashboard/Drivers/DashboardPartDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.AdminDashboard/Drivers/DashboardPartDisplayDriver.cs index f105cb79fbd..80958365a60 100644 --- a/src/OrchardCore.Modules/OrchardCore.AdminDashboard/Drivers/DashboardPartDisplayDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.AdminDashboard/Drivers/DashboardPartDisplayDriver.cs @@ -3,7 +3,6 @@ using OrchardCore.AdminDashboard.ViewModels; using OrchardCore.ContentManagement.Display.ContentDisplay; using OrchardCore.ContentManagement.Display.Models; -using OrchardCore.DisplayManagement.ModelBinding; using OrchardCore.DisplayManagement.Views; namespace OrchardCore.AdminDashboard.Drivers; diff --git a/src/OrchardCore.Modules/OrchardCore.Apis.GraphQL/Json/GraphQLNamedQueryRequestJsonConverter.cs b/src/OrchardCore.Modules/OrchardCore.Apis.GraphQL/Json/GraphQLNamedQueryRequestJsonConverter.cs index 877e98afeb5..6f379a6bd66 100644 --- a/src/OrchardCore.Modules/OrchardCore.Apis.GraphQL/Json/GraphQLNamedQueryRequestJsonConverter.cs +++ b/src/OrchardCore.Modules/OrchardCore.Apis.GraphQL/Json/GraphQLNamedQueryRequestJsonConverter.cs @@ -11,25 +11,25 @@ public class GraphQLNamedQueryRequestJsonConverter : JsonConverter /// Name for the operation name parameter. - /// See https://github.com/graphql/graphql-over-http/blob/master/spec/GraphQLOverHTTP.md#request-parameters + /// See https://github.com/graphql/graphql-over-http/blob/master/spec/GraphQLOverHTTP.md#request-parameters. /// private const string _operationNameKey = "operationName"; /// /// Name for the query parameter. - /// See https://github.com/graphql/graphql-over-http/blob/master/spec/GraphQLOverHTTP.md#request-parameters + /// See https://github.com/graphql/graphql-over-http/blob/master/spec/GraphQLOverHTTP.md#request-parameters. /// private const string _queryKey = "query"; /// /// Name for the variables parameter. - /// See https://github.com/graphql/graphql-over-http/blob/master/spec/GraphQLOverHTTP.md#request-parameters + /// See https://github.com/graphql/graphql-over-http/blob/master/spec/GraphQLOverHTTP.md#request-parameters. /// private const string _variablesKey = "variables"; /// /// Name for the extensions parameter. - /// See https://github.com/graphql/graphql-over-http/blob/master/spec/GraphQLOverHTTP.md#request-parameters + /// See https://github.com/graphql/graphql-over-http/blob/master/spec/GraphQLOverHTTP.md#request-parameters. /// private const string _extensionsKey = "extensions"; @@ -99,7 +99,9 @@ public override GraphQLNamedQueryRequest Read(ref Utf8JsonReader reader, Type ty // Unexpected end of data. if (!reader.Read()) + { throw new JsonException(); + } switch (key) { diff --git a/src/OrchardCore.Modules/OrchardCore.Apis.GraphQL/ValidationRules/RequiresPermissionValidationRule.cs b/src/OrchardCore.Modules/OrchardCore.Apis.GraphQL/ValidationRules/RequiresPermissionValidationRule.cs index 729943e36d6..c98f3d9f224 100644 --- a/src/OrchardCore.Modules/OrchardCore.Apis.GraphQL/ValidationRules/RequiresPermissionValidationRule.cs +++ b/src/OrchardCore.Modules/OrchardCore.Apis.GraphQL/ValidationRules/RequiresPermissionValidationRule.cs @@ -47,7 +47,9 @@ public async ValueTask ValidateAsync(ValidationContext validationC var fieldDef = validationContext.TypeInfo.GetFieldDef(); if (fieldDef == null) + { return; + } // check target field await AuthorizeNodePermissionAsync(fieldAst, fieldDef, validationContext, userContext); diff --git a/src/OrchardCore.Modules/OrchardCore.ArchiveLater/Drivers/ArchiveLaterPartDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.ArchiveLater/Drivers/ArchiveLaterPartDisplayDriver.cs index 25a2b840b0f..2916625f30a 100644 --- a/src/OrchardCore.Modules/OrchardCore.ArchiveLater/Drivers/ArchiveLaterPartDisplayDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.ArchiveLater/Drivers/ArchiveLaterPartDisplayDriver.cs @@ -6,7 +6,6 @@ using OrchardCore.ContentManagement.Display.ContentDisplay; using OrchardCore.ContentManagement.Display.Models; using OrchardCore.Contents; -using OrchardCore.DisplayManagement.ModelBinding; using OrchardCore.DisplayManagement.Views; using OrchardCore.Modules; diff --git a/src/OrchardCore.Modules/OrchardCore.Autoroute/Drivers/AutoroutePartDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.Autoroute/Drivers/AutoroutePartDisplayDriver.cs index 1594a91b707..7b8c083f206 100644 --- a/src/OrchardCore.Modules/OrchardCore.Autoroute/Drivers/AutoroutePartDisplayDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Autoroute/Drivers/AutoroutePartDisplayDriver.cs @@ -11,7 +11,6 @@ using OrchardCore.ContentManagement.Display.ContentDisplay; using OrchardCore.ContentManagement.Display.Models; using OrchardCore.ContentManagement.Routing; -using OrchardCore.DisplayManagement.ModelBinding; using OrchardCore.DisplayManagement.Views; using OrchardCore.Mvc.ModelBinding; using OrchardCore.Settings; diff --git a/src/OrchardCore.Modules/OrchardCore.ContentFields/Drivers/BooleanFieldDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.ContentFields/Drivers/BooleanFieldDisplayDriver.cs index 686d7e923f7..109ef398ddd 100644 --- a/src/OrchardCore.Modules/OrchardCore.ContentFields/Drivers/BooleanFieldDisplayDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.ContentFields/Drivers/BooleanFieldDisplayDriver.cs @@ -4,7 +4,6 @@ using OrchardCore.ContentFields.ViewModels; using OrchardCore.ContentManagement.Display.ContentDisplay; using OrchardCore.ContentManagement.Display.Models; -using OrchardCore.DisplayManagement.ModelBinding; using OrchardCore.DisplayManagement.Views; namespace OrchardCore.ContentFields.Drivers; diff --git a/src/OrchardCore.Modules/OrchardCore.ContentFields/Drivers/ContentPickerFieldDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.ContentFields/Drivers/ContentPickerFieldDisplayDriver.cs index 0697696e050..e80609f5e04 100644 --- a/src/OrchardCore.Modules/OrchardCore.ContentFields/Drivers/ContentPickerFieldDisplayDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.ContentFields/Drivers/ContentPickerFieldDisplayDriver.cs @@ -15,7 +15,6 @@ using OrchardCore.ContentManagement.Display.Models; using OrchardCore.ContentManagement.Metadata.Models; using OrchardCore.Contents; -using OrchardCore.DisplayManagement.ModelBinding; using OrchardCore.DisplayManagement.Views; using OrchardCore.Liquid; using OrchardCore.Localization; diff --git a/src/OrchardCore.Modules/OrchardCore.ContentFields/Drivers/DateFieldDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.ContentFields/Drivers/DateFieldDisplayDriver.cs index a7f5f5639f5..094caa5d91b 100644 --- a/src/OrchardCore.Modules/OrchardCore.ContentFields/Drivers/DateFieldDisplayDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.ContentFields/Drivers/DateFieldDisplayDriver.cs @@ -6,7 +6,6 @@ using OrchardCore.ContentManagement.Display.ContentDisplay; using OrchardCore.ContentManagement.Display.Models; using OrchardCore.ContentManagement.Metadata.Models; -using OrchardCore.DisplayManagement.ModelBinding; using OrchardCore.DisplayManagement.Views; using OrchardCore.Mvc.ModelBinding; diff --git a/src/OrchardCore.Modules/OrchardCore.ContentFields/Drivers/DateTimeFieldDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.ContentFields/Drivers/DateTimeFieldDisplayDriver.cs index 38a618a37ee..e5c6aa074d3 100644 --- a/src/OrchardCore.Modules/OrchardCore.ContentFields/Drivers/DateTimeFieldDisplayDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.ContentFields/Drivers/DateTimeFieldDisplayDriver.cs @@ -6,7 +6,6 @@ using OrchardCore.ContentManagement.Display.ContentDisplay; using OrchardCore.ContentManagement.Display.Models; using OrchardCore.ContentManagement.Metadata.Models; -using OrchardCore.DisplayManagement.ModelBinding; using OrchardCore.DisplayManagement.Views; using OrchardCore.Modules; using OrchardCore.Mvc.ModelBinding; diff --git a/src/OrchardCore.Modules/OrchardCore.ContentFields/Drivers/HtmlFieldDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.ContentFields/Drivers/HtmlFieldDisplayDriver.cs index 09e3782c5ca..0dbf57a19f4 100644 --- a/src/OrchardCore.Modules/OrchardCore.ContentFields/Drivers/HtmlFieldDisplayDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.ContentFields/Drivers/HtmlFieldDisplayDriver.cs @@ -9,7 +9,6 @@ using OrchardCore.ContentManagement.Display.ContentDisplay; using OrchardCore.ContentManagement.Display.Models; using OrchardCore.ContentManagement.Metadata.Models; -using OrchardCore.DisplayManagement.ModelBinding; using OrchardCore.DisplayManagement.Views; using OrchardCore.Infrastructure.Html; using OrchardCore.Liquid; diff --git a/src/OrchardCore.Modules/OrchardCore.ContentFields/Drivers/LinkFieldDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.ContentFields/Drivers/LinkFieldDisplayDriver.cs index f4e8cbdfd79..d38bafafb3f 100644 --- a/src/OrchardCore.Modules/OrchardCore.ContentFields/Drivers/LinkFieldDisplayDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.ContentFields/Drivers/LinkFieldDisplayDriver.cs @@ -10,7 +10,6 @@ using OrchardCore.ContentManagement.Display.ContentDisplay; using OrchardCore.ContentManagement.Display.Models; using OrchardCore.ContentManagement.Metadata.Models; -using OrchardCore.DisplayManagement.ModelBinding; using OrchardCore.DisplayManagement.Views; using OrchardCore.Infrastructure.Html; using OrchardCore.Mvc.ModelBinding; diff --git a/src/OrchardCore.Modules/OrchardCore.ContentFields/Drivers/LocalizationSetContentPickerFieldDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.ContentFields/Drivers/LocalizationSetContentPickerFieldDisplayDriver.cs index 185b493796f..1c0105b920e 100644 --- a/src/OrchardCore.Modules/OrchardCore.ContentFields/Drivers/LocalizationSetContentPickerFieldDisplayDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.ContentFields/Drivers/LocalizationSetContentPickerFieldDisplayDriver.cs @@ -9,7 +9,6 @@ using OrchardCore.ContentManagement.Display.ContentDisplay; using OrchardCore.ContentManagement.Display.Models; using OrchardCore.ContentManagement.Metadata.Models; -using OrchardCore.DisplayManagement.ModelBinding; using OrchardCore.DisplayManagement.Views; using OrchardCore.Modules; using OrchardCore.Mvc.ModelBinding; diff --git a/src/OrchardCore.Modules/OrchardCore.ContentFields/Drivers/MultiTextFieldDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.ContentFields/Drivers/MultiTextFieldDisplayDriver.cs index 3ca02ac3e04..acef2e1031f 100644 --- a/src/OrchardCore.Modules/OrchardCore.ContentFields/Drivers/MultiTextFieldDisplayDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.ContentFields/Drivers/MultiTextFieldDisplayDriver.cs @@ -7,7 +7,6 @@ using OrchardCore.ContentManagement.Display.ContentDisplay; using OrchardCore.ContentManagement.Display.Models; using OrchardCore.ContentManagement.Metadata.Models; -using OrchardCore.DisplayManagement.ModelBinding; using OrchardCore.DisplayManagement.Views; using OrchardCore.Mvc.ModelBinding; diff --git a/src/OrchardCore.Modules/OrchardCore.ContentFields/Drivers/TextFieldDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.ContentFields/Drivers/TextFieldDisplayDriver.cs index 6bdfc67d3e2..f5db8320482 100644 --- a/src/OrchardCore.Modules/OrchardCore.ContentFields/Drivers/TextFieldDisplayDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.ContentFields/Drivers/TextFieldDisplayDriver.cs @@ -1,13 +1,11 @@ using System.Threading.Tasks; using Microsoft.Extensions.Localization; -using Microsoft.Win32.SafeHandles; using OrchardCore.ContentFields.Fields; using OrchardCore.ContentFields.Settings; using OrchardCore.ContentFields.ViewModels; using OrchardCore.ContentManagement.Display.ContentDisplay; using OrchardCore.ContentManagement.Display.Models; using OrchardCore.ContentManagement.Metadata.Models; -using OrchardCore.DisplayManagement.ModelBinding; using OrchardCore.DisplayManagement.Views; using OrchardCore.Mvc.ModelBinding; diff --git a/src/OrchardCore.Modules/OrchardCore.ContentFields/Drivers/UserPickerFieldDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.ContentFields/Drivers/UserPickerFieldDisplayDriver.cs index b646aab6490..ed9a56791e9 100644 --- a/src/OrchardCore.Modules/OrchardCore.ContentFields/Drivers/UserPickerFieldDisplayDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.ContentFields/Drivers/UserPickerFieldDisplayDriver.cs @@ -8,7 +8,6 @@ using OrchardCore.ContentManagement.Display.ContentDisplay; using OrchardCore.ContentManagement.Display.Models; using OrchardCore.ContentManagement.Metadata.Models; -using OrchardCore.DisplayManagement.ModelBinding; using OrchardCore.DisplayManagement.Views; using OrchardCore.Mvc.ModelBinding; using OrchardCore.Users.Indexes; diff --git a/src/OrchardCore.Modules/OrchardCore.ContentFields/Drivers/YoutubeFieldDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.ContentFields/Drivers/YoutubeFieldDisplayDriver.cs index b57bcd6d89e..c23ab195bb3 100644 --- a/src/OrchardCore.Modules/OrchardCore.ContentFields/Drivers/YoutubeFieldDisplayDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.ContentFields/Drivers/YoutubeFieldDisplayDriver.cs @@ -8,7 +8,6 @@ using OrchardCore.ContentManagement.Display.ContentDisplay; using OrchardCore.ContentManagement.Display.Models; using OrchardCore.ContentManagement.Metadata.Models; -using OrchardCore.DisplayManagement.ModelBinding; using OrchardCore.DisplayManagement.Views; using OrchardCore.Mvc.ModelBinding; diff --git a/src/OrchardCore.Modules/OrchardCore.ContentLocalization/Drivers/LocalizationPartDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.ContentLocalization/Drivers/LocalizationPartDisplayDriver.cs index 0a8f8b872fe..f1974594c70 100644 --- a/src/OrchardCore.Modules/OrchardCore.ContentLocalization/Drivers/LocalizationPartDisplayDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.ContentLocalization/Drivers/LocalizationPartDisplayDriver.cs @@ -6,7 +6,6 @@ using OrchardCore.ContentManagement; using OrchardCore.ContentManagement.Display.ContentDisplay; using OrchardCore.ContentManagement.Display.Models; -using OrchardCore.DisplayManagement.ModelBinding; using OrchardCore.DisplayManagement.Views; using OrchardCore.Entities; using OrchardCore.Localization; diff --git a/src/OrchardCore.Modules/OrchardCore.ContentTypes/Editors/ContentDefinitionDisplayCoordinator.cs b/src/OrchardCore.Modules/OrchardCore.ContentTypes/Editors/ContentDefinitionDisplayCoordinator.cs index f88069f33f7..9aafece1803 100644 --- a/src/OrchardCore.Modules/OrchardCore.ContentTypes/Editors/ContentDefinitionDisplayCoordinator.cs +++ b/src/OrchardCore.Modules/OrchardCore.ContentTypes/Editors/ContentDefinitionDisplayCoordinator.cs @@ -35,7 +35,9 @@ public Task BuildTypeEditorAsync(ContentTypeDefinition model, BuildEditorContext { var result = await contentDisplay.BuildEditorAsync(model, context); if (result != null) + { await result.ApplyAsync(context); + } }, model, context, _logger); } @@ -45,7 +47,9 @@ public Task UpdateTypeEditorAsync(ContentTypeDefinition model, UpdateTypeEditorC { var result = await contentDisplay.UpdateEditorAsync(model, context); if (result != null) + { await result.ApplyAsync(context); + } }, model, context, _logger); } @@ -55,7 +59,9 @@ public Task BuildTypePartEditorAsync(ContentTypePartDefinition model, BuildEdito { var result = await contentDisplay.BuildEditorAsync(model, context); if (result != null) + { await result.ApplyAsync(context); + } }, model, context, _logger); } @@ -65,7 +71,9 @@ public Task UpdateTypePartEditorAsync(ContentTypePartDefinition model, UpdateTyp { var result = await contentDisplay.UpdateEditorAsync(model, context); if (result != null) + { await result.ApplyAsync(context); + } }, model, context, _logger); } @@ -75,7 +83,9 @@ public Task BuildPartEditorAsync(ContentPartDefinition model, BuildEditorContext { var result = await contentDisplay.BuildEditorAsync(model, context); if (result != null) + { await result.ApplyAsync(context); + } }, model, context, _logger); } @@ -85,7 +95,9 @@ public Task UpdatePartEditorAsync(ContentPartDefinition model, UpdatePartEditorC { var result = await contentDisplay.UpdateEditorAsync(model, context); if (result != null) + { await result.ApplyAsync(context); + } }, model, context, _logger); } @@ -95,7 +107,9 @@ await _partFieldDisplayDrivers.InvokeAsync(async (contentDisplay, model, context { var result = await contentDisplay.BuildEditorAsync(model, context); if (result != null) + { await result.ApplyAsync(context); + } }, model, context, _logger); } @@ -105,7 +119,9 @@ await _partFieldDisplayDrivers.InvokeAsync(async (contentDisplay, model, context { var result = await contentDisplay.UpdateEditorAsync(model, context); if (result != null) + { await result.ApplyAsync(context); + } }, model, context, _logger); } } diff --git a/src/OrchardCore.Modules/OrchardCore.Contents/AuditTrail/Drivers/AuditTrailPartDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.Contents/AuditTrail/Drivers/AuditTrailPartDisplayDriver.cs index 00ec664ec65..2d31908ef76 100644 --- a/src/OrchardCore.Modules/OrchardCore.Contents/AuditTrail/Drivers/AuditTrailPartDisplayDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Contents/AuditTrail/Drivers/AuditTrailPartDisplayDriver.cs @@ -4,7 +4,6 @@ using OrchardCore.Contents.AuditTrail.Models; using OrchardCore.Contents.AuditTrail.Settings; using OrchardCore.Contents.AuditTrail.ViewModels; -using OrchardCore.DisplayManagement.ModelBinding; using OrchardCore.DisplayManagement.Views; namespace OrchardCore.Contents.AuditTrail.Drivers; diff --git a/src/OrchardCore.Modules/OrchardCore.Contents/Controllers/AdminController.cs b/src/OrchardCore.Modules/OrchardCore.Contents/Controllers/AdminController.cs index 28e997d21b9..21ee8e7e3a6 100644 --- a/src/OrchardCore.Modules/OrchardCore.Contents/Controllers/AdminController.cs +++ b/src/OrchardCore.Modules/OrchardCore.Contents/Controllers/AdminController.cs @@ -409,7 +409,7 @@ public async Task Display(string contentItemId) } [Admin("Contents/ContentItems/{contentItemId}/Edit", "EditContentItem")] - public async Task Edit(string contentItemId, string returnUrl = null) + public async Task Edit(string contentItemId) { var contentItem = await _contentManager.GetAsync(contentItemId, VersionOptions.Latest); diff --git a/src/OrchardCore.Modules/OrchardCore.Contents/Drivers/DateEditorDriver.cs b/src/OrchardCore.Modules/OrchardCore.Contents/Drivers/DateEditorDriver.cs index 5735ea8ea49..65e3828e7b7 100644 --- a/src/OrchardCore.Modules/OrchardCore.Contents/Drivers/DateEditorDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Contents/Drivers/DateEditorDriver.cs @@ -3,7 +3,6 @@ using OrchardCore.ContentManagement.Display.Models; using OrchardCore.Contents.Models; using OrchardCore.Contents.ViewModels; -using OrchardCore.DisplayManagement.ModelBinding; using OrchardCore.DisplayManagement.Views; using OrchardCore.Modules; diff --git a/src/OrchardCore.Modules/OrchardCore.Demo/ContentElementDisplays/TestContentElementDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.Demo/ContentElementDisplays/TestContentElementDisplayDriver.cs index d0d276b36ed..174f11840b2 100644 --- a/src/OrchardCore.Modules/OrchardCore.Demo/ContentElementDisplays/TestContentElementDisplayDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Demo/ContentElementDisplays/TestContentElementDisplayDriver.cs @@ -4,7 +4,6 @@ using OrchardCore.ContentManagement.Display.ContentDisplay; using OrchardCore.Demo.Models; using OrchardCore.DisplayManagement.Handlers; -using OrchardCore.DisplayManagement.ModelBinding; using OrchardCore.DisplayManagement.Views; namespace OrchardCore.Demo.ContentElementDisplays; diff --git a/src/OrchardCore.Modules/OrchardCore.Demo/Pages/Foo/List.cshtml.cs b/src/OrchardCore.Modules/OrchardCore.Demo/Pages/Foo/List.cshtml.cs index a57c5cd9d7a..d3eee7a3d25 100644 --- a/src/OrchardCore.Modules/OrchardCore.Demo/Pages/Foo/List.cshtml.cs +++ b/src/OrchardCore.Modules/OrchardCore.Demo/Pages/Foo/List.cshtml.cs @@ -5,7 +5,6 @@ using OrchardCore.ContentManagement; using OrchardCore.ContentManagement.Display; using OrchardCore.ContentManagement.Records; -using OrchardCore.DisplayManagement; using OrchardCore.DisplayManagement.ModelBinding; using OrchardCore.Modules; using YesSql; diff --git a/src/OrchardCore.Modules/OrchardCore.Email.Azure/Drivers/AzureEmailSettingsDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.Email.Azure/Drivers/AzureEmailSettingsDisplayDriver.cs index 2a6d463eed0..8906a29bdb3 100644 --- a/src/OrchardCore.Modules/OrchardCore.Email.Azure/Drivers/AzureEmailSettingsDisplayDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Email.Azure/Drivers/AzureEmailSettingsDisplayDriver.cs @@ -15,7 +15,6 @@ using OrchardCore.Email.Services; using OrchardCore.Entities; using OrchardCore.Environment.Shell; -using OrchardCore.Modules; using OrchardCore.Mvc.ModelBinding; using OrchardCore.Settings; diff --git a/src/OrchardCore.Modules/OrchardCore.Forms/Drivers/ButtonPartDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.Forms/Drivers/ButtonPartDisplayDriver.cs index 4c056e281fe..7827122638c 100644 --- a/src/OrchardCore.Modules/OrchardCore.Forms/Drivers/ButtonPartDisplayDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Forms/Drivers/ButtonPartDisplayDriver.cs @@ -1,7 +1,6 @@ using System.Threading.Tasks; using OrchardCore.ContentManagement.Display.ContentDisplay; using OrchardCore.ContentManagement.Display.Models; -using OrchardCore.DisplayManagement.ModelBinding; using OrchardCore.DisplayManagement.Views; using OrchardCore.Forms.Models; using OrchardCore.Forms.ViewModels; diff --git a/src/OrchardCore.Modules/OrchardCore.Forms/Drivers/FormElementPartDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.Forms/Drivers/FormElementPartDisplayDriver.cs index 25bbaeac495..b2550db56ef 100644 --- a/src/OrchardCore.Modules/OrchardCore.Forms/Drivers/FormElementPartDisplayDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Forms/Drivers/FormElementPartDisplayDriver.cs @@ -1,7 +1,6 @@ using System.Threading.Tasks; using OrchardCore.ContentManagement.Display.ContentDisplay; using OrchardCore.ContentManagement.Display.Models; -using OrchardCore.DisplayManagement.ModelBinding; using OrchardCore.DisplayManagement.Views; using OrchardCore.Forms.Models; using OrchardCore.Forms.ViewModels; diff --git a/src/OrchardCore.Modules/OrchardCore.Forms/Drivers/InputPartDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.Forms/Drivers/InputPartDisplayDriver.cs index 3b533e254d0..1f7ecbabb8b 100644 --- a/src/OrchardCore.Modules/OrchardCore.Forms/Drivers/InputPartDisplayDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Forms/Drivers/InputPartDisplayDriver.cs @@ -1,7 +1,6 @@ using System.Threading.Tasks; using OrchardCore.ContentManagement.Display.ContentDisplay; using OrchardCore.ContentManagement.Display.Models; -using OrchardCore.DisplayManagement.ModelBinding; using OrchardCore.DisplayManagement.Views; using OrchardCore.Forms.Models; using OrchardCore.Forms.ViewModels; diff --git a/src/OrchardCore.Modules/OrchardCore.Forms/Drivers/LabelPartDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.Forms/Drivers/LabelPartDisplayDriver.cs index 562938c04d9..c9d08eac52a 100644 --- a/src/OrchardCore.Modules/OrchardCore.Forms/Drivers/LabelPartDisplayDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Forms/Drivers/LabelPartDisplayDriver.cs @@ -1,7 +1,6 @@ using System.Threading.Tasks; using OrchardCore.ContentManagement.Display.ContentDisplay; using OrchardCore.ContentManagement.Display.Models; -using OrchardCore.DisplayManagement.ModelBinding; using OrchardCore.DisplayManagement.Views; using OrchardCore.Forms.Models; using OrchardCore.Forms.ViewModels; diff --git a/src/OrchardCore.Modules/OrchardCore.Forms/Drivers/SelectPartDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.Forms/Drivers/SelectPartDisplayDriver.cs index 41ec37caa51..8d62ae9f711 100644 --- a/src/OrchardCore.Modules/OrchardCore.Forms/Drivers/SelectPartDisplayDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Forms/Drivers/SelectPartDisplayDriver.cs @@ -3,7 +3,6 @@ using Microsoft.Extensions.Localization; using OrchardCore.ContentManagement.Display.ContentDisplay; using OrchardCore.ContentManagement.Display.Models; -using OrchardCore.DisplayManagement.ModelBinding; using OrchardCore.DisplayManagement.Views; using OrchardCore.Forms.Models; using OrchardCore.Forms.ViewModels; diff --git a/src/OrchardCore.Modules/OrchardCore.Html/Drivers/HtmlBodyPartDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.Html/Drivers/HtmlBodyPartDisplayDriver.cs index 0c5556a4e8e..e96cc9e8155 100644 --- a/src/OrchardCore.Modules/OrchardCore.Html/Drivers/HtmlBodyPartDisplayDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Html/Drivers/HtmlBodyPartDisplayDriver.cs @@ -6,7 +6,6 @@ using OrchardCore.ContentManagement.Display.ContentDisplay; using OrchardCore.ContentManagement.Display.Models; using OrchardCore.ContentManagement.Metadata.Models; -using OrchardCore.DisplayManagement.ModelBinding; using OrchardCore.DisplayManagement.Views; using OrchardCore.Html.Models; using OrchardCore.Html.Settings; diff --git a/src/OrchardCore.Modules/OrchardCore.Layers/Controllers/AdminController.cs b/src/OrchardCore.Modules/OrchardCore.Layers/Controllers/AdminController.cs index d1b2d49d48d..0c823a17cc9 100644 --- a/src/OrchardCore.Modules/OrchardCore.Layers/Controllers/AdminController.cs +++ b/src/OrchardCore.Modules/OrchardCore.Layers/Controllers/AdminController.cs @@ -128,7 +128,7 @@ public async Task Index() } [HttpPost] - public async Task Index(LayersIndexViewModel model) + public async Task Index(LayersIndexViewModel _) { if (!await _authorizationService.AuthorizeAsync(User, Permissions.ManageLayers)) { diff --git a/src/OrchardCore.Modules/OrchardCore.Layers/GraphQL/LayerQueryObjectType.cs b/src/OrchardCore.Modules/OrchardCore.Layers/GraphQL/LayerQueryObjectType.cs index 44ab2fde912..16171a175ed 100644 --- a/src/OrchardCore.Modules/OrchardCore.Layers/GraphQL/LayerQueryObjectType.cs +++ b/src/OrchardCore.Modules/OrchardCore.Layers/GraphQL/LayerQueryObjectType.cs @@ -42,7 +42,11 @@ async ValueTask> GetWidgetsForLayerAsync(IResolveFieldC var layerWidgets = widgets?.Where(item => { var metadata = item.As(); - if (metadata == null) return false; + if (metadata == null) + { + return false; + } + return metadata.Layer == context.Source.Name; }); diff --git a/src/OrchardCore.Modules/OrchardCore.Layers/Migrations.cs b/src/OrchardCore.Modules/OrchardCore.Layers/Migrations.cs index 47f48475e70..16ebff99882 100644 --- a/src/OrchardCore.Modules/OrchardCore.Layers/Migrations.cs +++ b/src/OrchardCore.Modules/OrchardCore.Layers/Migrations.cs @@ -1,25 +1,12 @@ using System.Threading.Tasks; using OrchardCore.Data.Migration; using OrchardCore.Layers.Indexes; -using OrchardCore.Layers.Services; -using OrchardCore.Rules.Services; using YesSql.Sql; namespace OrchardCore.Layers; public sealed class Migrations : DataMigration { - private readonly ILayerService _layerService; - private readonly IConditionIdGenerator _conditionIdGenerator; - - public Migrations( - ILayerService layerService, - IConditionIdGenerator conditionIdGenerator) - { - _layerService = layerService; - _conditionIdGenerator = conditionIdGenerator; - } - public async Task CreateAsync() { await SchemaBuilder.CreateMapIndexTableAsync(table => table diff --git a/src/OrchardCore.Modules/OrchardCore.Liquid/ScriptsMiddleware.cs b/src/OrchardCore.Modules/OrchardCore.Liquid/ScriptsMiddleware.cs index fa1d29c6ced..f21df69ae3b 100644 --- a/src/OrchardCore.Modules/OrchardCore.Liquid/ScriptsMiddleware.cs +++ b/src/OrchardCore.Modules/OrchardCore.Liquid/ScriptsMiddleware.cs @@ -18,9 +18,8 @@ namespace OrchardCore.Liquid; public class ScriptsMiddleware { private readonly RequestDelegate _next; - - byte[] _bytes; - string _etag; + private byte[] _bytes; + private string _etag; public ScriptsMiddleware(RequestDelegate next) { diff --git a/src/OrchardCore.Modules/OrchardCore.Lists/Feeds/ListPartFeedDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.Lists/Feeds/ListPartFeedDisplayDriver.cs index 0e2b5a03d40..c13c941eeb2 100644 --- a/src/OrchardCore.Modules/OrchardCore.Lists/Feeds/ListPartFeedDisplayDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Lists/Feeds/ListPartFeedDisplayDriver.cs @@ -1,7 +1,6 @@ using System.Threading.Tasks; using OrchardCore.ContentManagement.Display.ContentDisplay; using OrchardCore.ContentManagement.Display.Models; -using OrchardCore.DisplayManagement.ModelBinding; using OrchardCore.DisplayManagement.Views; using OrchardCore.Lists.Models; diff --git a/src/OrchardCore.Modules/OrchardCore.Markdown/Drivers/MarkdownBodyPartDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.Markdown/Drivers/MarkdownBodyPartDisplayDriver.cs index 457e651edef..7606f1b2869 100644 --- a/src/OrchardCore.Modules/OrchardCore.Markdown/Drivers/MarkdownBodyPartDisplayDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Markdown/Drivers/MarkdownBodyPartDisplayDriver.cs @@ -6,7 +6,6 @@ using OrchardCore.ContentManagement.Display.ContentDisplay; using OrchardCore.ContentManagement.Display.Models; using OrchardCore.ContentManagement.Metadata.Models; -using OrchardCore.DisplayManagement.ModelBinding; using OrchardCore.DisplayManagement.Views; using OrchardCore.Infrastructure.Html; using OrchardCore.Liquid; diff --git a/src/OrchardCore.Modules/OrchardCore.Markdown/Drivers/MarkdownFieldDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.Markdown/Drivers/MarkdownFieldDisplayDriver.cs index 8c429666560..10a4f19516a 100644 --- a/src/OrchardCore.Modules/OrchardCore.Markdown/Drivers/MarkdownFieldDisplayDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Markdown/Drivers/MarkdownFieldDisplayDriver.cs @@ -6,7 +6,6 @@ using OrchardCore.ContentManagement.Display.ContentDisplay; using OrchardCore.ContentManagement.Display.Models; using OrchardCore.ContentManagement.Metadata.Models; -using OrchardCore.DisplayManagement.ModelBinding; using OrchardCore.DisplayManagement.Views; using OrchardCore.Infrastructure.Html; using OrchardCore.Liquid; diff --git a/src/OrchardCore.Modules/OrchardCore.Media/Drivers/MediaFieldDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.Media/Drivers/MediaFieldDisplayDriver.cs index 26339d51a60..3a5b7eb4b09 100644 --- a/src/OrchardCore.Modules/OrchardCore.Media/Drivers/MediaFieldDisplayDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Media/Drivers/MediaFieldDisplayDriver.cs @@ -9,7 +9,6 @@ using OrchardCore.ContentManagement.Display.ContentDisplay; using OrchardCore.ContentManagement.Display.Models; using OrchardCore.ContentManagement.Metadata.Models; -using OrchardCore.DisplayManagement.ModelBinding; using OrchardCore.DisplayManagement.Views; using OrchardCore.Media.Fields; using OrchardCore.Media.Services; diff --git a/src/OrchardCore.Modules/OrchardCore.Media/SecureMediaPermissions.cs b/src/OrchardCore.Modules/OrchardCore.Media/SecureMediaPermissions.cs index 1e3694318df..2ac1b04231f 100644 --- a/src/OrchardCore.Modules/OrchardCore.Media/SecureMediaPermissions.cs +++ b/src/OrchardCore.Modules/OrchardCore.Media/SecureMediaPermissions.cs @@ -143,11 +143,15 @@ private async Task> GetPermissionsInternalAsync() await foreach (var entry in _fileStore.GetDirectoryContentAsync()) { if (!entry.IsDirectory) + { continue; + } if (entry.Name == _mediaOptions.AssetsUsersFolder || entry.Name == _attachedMediaFieldFileService.MediaFieldsFolder) + { continue; + } var folderPath = entry.Path; diff --git a/src/OrchardCore.Modules/OrchardCore.Media/Services/ViewMediaFolderAuthorizationHandler.cs b/src/OrchardCore.Modules/OrchardCore.Media/Services/ViewMediaFolderAuthorizationHandler.cs index e57fa97a929..7135a677cb1 100644 --- a/src/OrchardCore.Modules/OrchardCore.Media/Services/ViewMediaFolderAuthorizationHandler.cs +++ b/src/OrchardCore.Modules/OrchardCore.Media/Services/ViewMediaFolderAuthorizationHandler.cs @@ -134,7 +134,9 @@ private async Task AuthorizeAttachedMediaFieldsFolderAsync(AuthorizationHandlerC // Don't allow 'mediafields' directly. if (attachedMediaPathParts.Length == 0) + { return; + } if (string.Equals(attachedMediaPathParts[0], "temp", StringComparison.OrdinalIgnoreCase)) { diff --git a/src/OrchardCore.Modules/OrchardCore.Menu/Drivers/ContentMenuItemPartDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.Menu/Drivers/ContentMenuItemPartDisplayDriver.cs index 793e88619f1..0e704d7986a 100644 --- a/src/OrchardCore.Modules/OrchardCore.Menu/Drivers/ContentMenuItemPartDisplayDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Menu/Drivers/ContentMenuItemPartDisplayDriver.cs @@ -1,7 +1,6 @@ using System.Threading.Tasks; using OrchardCore.ContentManagement.Display.ContentDisplay; using OrchardCore.ContentManagement.Display.Models; -using OrchardCore.DisplayManagement.ModelBinding; using OrchardCore.DisplayManagement.Views; using OrchardCore.Menu.Models; using OrchardCore.Menu.ViewModels; diff --git a/src/OrchardCore.Modules/OrchardCore.Menu/Drivers/HtmlMenuItemPartDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.Menu/Drivers/HtmlMenuItemPartDisplayDriver.cs index db2c4909079..e1df24cd0ea 100644 --- a/src/OrchardCore.Modules/OrchardCore.Menu/Drivers/HtmlMenuItemPartDisplayDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Menu/Drivers/HtmlMenuItemPartDisplayDriver.cs @@ -6,7 +6,6 @@ using Microsoft.Extensions.Localization; using OrchardCore.ContentManagement.Display.ContentDisplay; using OrchardCore.ContentManagement.Display.Models; -using OrchardCore.DisplayManagement.ModelBinding; using OrchardCore.DisplayManagement.Views; using OrchardCore.Infrastructure.Html; using OrchardCore.Menu.Models; diff --git a/src/OrchardCore.Modules/OrchardCore.Menu/Drivers/LinkMenuItemPartDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.Menu/Drivers/LinkMenuItemPartDisplayDriver.cs index ca52cc2fb38..34178dcd544 100644 --- a/src/OrchardCore.Modules/OrchardCore.Menu/Drivers/LinkMenuItemPartDisplayDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Menu/Drivers/LinkMenuItemPartDisplayDriver.cs @@ -6,7 +6,6 @@ using Microsoft.Extensions.Localization; using OrchardCore.ContentManagement.Display.ContentDisplay; using OrchardCore.ContentManagement.Display.Models; -using OrchardCore.DisplayManagement.ModelBinding; using OrchardCore.DisplayManagement.Views; using OrchardCore.Infrastructure.Html; using OrchardCore.Menu.Models; diff --git a/src/OrchardCore.Modules/OrchardCore.Menu/Drivers/MenuPartDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.Menu/Drivers/MenuPartDisplayDriver.cs index 87c02fcacde..517ac3f0c5d 100644 --- a/src/OrchardCore.Modules/OrchardCore.Menu/Drivers/MenuPartDisplayDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Menu/Drivers/MenuPartDisplayDriver.cs @@ -10,7 +10,6 @@ using OrchardCore.ContentManagement.Display.Models; using OrchardCore.ContentManagement.Metadata; using OrchardCore.ContentManagement.Metadata.Models; -using OrchardCore.DisplayManagement.ModelBinding; using OrchardCore.DisplayManagement.Notify; using OrchardCore.DisplayManagement.Views; using OrchardCore.Menu.Models; diff --git a/src/OrchardCore.Modules/OrchardCore.Navigation/PagerShapesTableProvider.cs b/src/OrchardCore.Modules/OrchardCore.Navigation/PagerShapesTableProvider.cs index 3d7235a2c4f..3e4cd91f5d3 100644 --- a/src/OrchardCore.Modules/OrchardCore.Navigation/PagerShapesTableProvider.cs +++ b/src/OrchardCore.Modules/OrchardCore.Navigation/PagerShapesTableProvider.cs @@ -161,13 +161,17 @@ public async Task Pager_Links(Shape shape, DisplayContext displayC var noFollow = shape.Attributes.ContainsKey("rel") && shape.Attributes["rel"] == "no-follow"; var currentPage = Page; if (currentPage < 1) + { currentPage = 1; + } var pageSize = PageSize; var numberOfPagesToShow = Quantity ?? 0; if (Quantity == null || Quantity < 0) + { numberOfPagesToShow = 7; + } var totalPageCount = pageSize > 0 ? (int)Math.Ceiling(TotalItemCount / pageSize) : 1; diff --git a/src/OrchardCore.Modules/OrchardCore.OpenId/Services/OpenIdServerService.cs b/src/OrchardCore.Modules/OrchardCore.OpenId/Services/OpenIdServerService.cs index ba3649be61b..b9e26cd174c 100644 --- a/src/OrchardCore.Modules/OrchardCore.OpenId/Services/OpenIdServerService.cs +++ b/src/OrchardCore.Modules/OrchardCore.OpenId/Services/OpenIdServerService.cs @@ -239,9 +239,9 @@ public Task> ValidateSettingsAsync(OpenIdServer { var certificates = ImmutableArray.CreateBuilder<(X509Certificate2, StoreLocation, StoreName)>(); - foreach (StoreLocation location in Enum.GetValues()) + foreach (var location in Enum.GetValues()) { - foreach (StoreName name in Enum.GetValues()) + foreach (var name in Enum.GetValues()) { // Note: on non-Windows platforms, an exception can // be thrown if the store location/name doesn't exist. diff --git a/src/OrchardCore.Modules/OrchardCore.PublishLater/Drivers/PublishLaterPartDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.PublishLater/Drivers/PublishLaterPartDisplayDriver.cs index 220ca1b07b9..0fc1de35fa9 100644 --- a/src/OrchardCore.Modules/OrchardCore.PublishLater/Drivers/PublishLaterPartDisplayDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.PublishLater/Drivers/PublishLaterPartDisplayDriver.cs @@ -4,7 +4,6 @@ using OrchardCore.ContentManagement.Display.ContentDisplay; using OrchardCore.ContentManagement.Display.Models; using OrchardCore.Contents; -using OrchardCore.DisplayManagement.ModelBinding; using OrchardCore.DisplayManagement.Views; using OrchardCore.Modules; using OrchardCore.PublishLater.Models; diff --git a/src/OrchardCore.Modules/OrchardCore.Queries/Recipes/QueryStep.cs b/src/OrchardCore.Modules/OrchardCore.Queries/Recipes/QueryStep.cs index d24365d586f..ed4e232f253 100644 --- a/src/OrchardCore.Modules/OrchardCore.Queries/Recipes/QueryStep.cs +++ b/src/OrchardCore.Modules/OrchardCore.Queries/Recipes/QueryStep.cs @@ -5,7 +5,6 @@ using System.Text.Json.Nodes; using System.Threading.Tasks; using Microsoft.Extensions.Localization; -using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; using OrchardCore.Json; using OrchardCore.Recipes.Models; @@ -20,19 +19,16 @@ public sealed class QueryStep : IRecipeStepHandler { private readonly IQueryManager _queryManager; private readonly JsonSerializerOptions _jsonSerializerOptions; - private readonly ILogger _logger; internal readonly IStringLocalizer S; public QueryStep( IQueryManager queryManager, IOptions jsonSerializerOptions, - ILogger logger, IStringLocalizer stringLocalizer) { _queryManager = queryManager; _jsonSerializerOptions = jsonSerializerOptions.Value.SerializerOptions; - _logger = logger; S = stringLocalizer; } diff --git a/src/OrchardCore.Modules/OrchardCore.Resources/ResourceManagementOptionsConfiguration.cs b/src/OrchardCore.Modules/OrchardCore.Resources/ResourceManagementOptionsConfiguration.cs index 3a56ad057dc..645730b4d07 100644 --- a/src/OrchardCore.Modules/OrchardCore.Resources/ResourceManagementOptionsConfiguration.cs +++ b/src/OrchardCore.Modules/OrchardCore.Resources/ResourceManagementOptionsConfiguration.cs @@ -28,7 +28,7 @@ public ResourceManagementOptionsConfiguration( _pathBase = httpContextAccessor.HttpContext.Request.PathBase; } - ResourceManifest BuildManifest() + private ResourceManifest BuildManifest() { var manifest = new ResourceManifest(); diff --git a/src/OrchardCore.Modules/OrchardCore.Search.Elasticsearch/GraphQL/ElasticQueryFieldTypeProvider.cs b/src/OrchardCore.Modules/OrchardCore.Search.Elasticsearch/GraphQL/ElasticQueryFieldTypeProvider.cs index a5ed8a9673c..10e0ee6a22b 100644 --- a/src/OrchardCore.Modules/OrchardCore.Search.Elasticsearch/GraphQL/ElasticQueryFieldTypeProvider.cs +++ b/src/OrchardCore.Modules/OrchardCore.Search.Elasticsearch/GraphQL/ElasticQueryFieldTypeProvider.cs @@ -47,7 +47,9 @@ public async Task BuildAsync(ISchema schema) foreach (var query in queries) { if (string.IsNullOrWhiteSpace(query.Schema)) + { continue; + } var name = query.Name; diff --git a/src/OrchardCore.Modules/OrchardCore.Search/Drivers/SearchFormPartDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.Search/Drivers/SearchFormPartDisplayDriver.cs index 1c19a820a3d..c023cb20909 100644 --- a/src/OrchardCore.Modules/OrchardCore.Search/Drivers/SearchFormPartDisplayDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Search/Drivers/SearchFormPartDisplayDriver.cs @@ -1,7 +1,6 @@ using System.Threading.Tasks; using OrchardCore.ContentManagement.Display.ContentDisplay; using OrchardCore.ContentManagement.Display.Models; -using OrchardCore.DisplayManagement.ModelBinding; using OrchardCore.DisplayManagement.Views; using OrchardCore.Search.Models; using OrchardCore.Search.ViewModels; diff --git a/src/OrchardCore.Modules/OrchardCore.Seo/Drivers/SeoMetaPartDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.Seo/Drivers/SeoMetaPartDisplayDriver.cs index f1e6c12fded..b72715392ba 100644 --- a/src/OrchardCore.Modules/OrchardCore.Seo/Drivers/SeoMetaPartDisplayDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Seo/Drivers/SeoMetaPartDisplayDriver.cs @@ -4,7 +4,6 @@ using Microsoft.Extensions.Localization; using OrchardCore.ContentManagement.Display.ContentDisplay; using OrchardCore.ContentManagement.Display.Models; -using OrchardCore.DisplayManagement.ModelBinding; using OrchardCore.DisplayManagement.Views; using OrchardCore.Mvc.Utilities; using OrchardCore.ResourceManagement; diff --git a/src/OrchardCore.Modules/OrchardCore.Seo/Handlers/SeoMetaPartHandler.cs b/src/OrchardCore.Modules/OrchardCore.Seo/Handlers/SeoMetaPartHandler.cs index fadeedfa39d..5a34cf6ad44 100644 --- a/src/OrchardCore.Modules/OrchardCore.Seo/Handlers/SeoMetaPartHandler.cs +++ b/src/OrchardCore.Modules/OrchardCore.Seo/Handlers/SeoMetaPartHandler.cs @@ -179,4 +179,4 @@ public override Task GetContentItemAspectAsync(ContentItemAspectContext context, aspect.GoogleSchema = part.GoogleSchema; }); } - } +} diff --git a/src/OrchardCore.Modules/OrchardCore.Settings/Drivers/ButtonsSettingsDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.Settings/Drivers/ButtonsSettingsDisplayDriver.cs index 7e3462aca88..f4e144ea786 100644 --- a/src/OrchardCore.Modules/OrchardCore.Settings/Drivers/ButtonsSettingsDisplayDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Settings/Drivers/ButtonsSettingsDisplayDriver.cs @@ -1,4 +1,3 @@ -using System.Threading.Tasks; using OrchardCore.DisplayManagement.Handlers; using OrchardCore.DisplayManagement.Views; diff --git a/src/OrchardCore.Modules/OrchardCore.Sitemaps/Builders/CustomPathSitemapSourceBuilder.cs b/src/OrchardCore.Modules/OrchardCore.Sitemaps/Builders/CustomPathSitemapSourceBuilder.cs index f2c1468ab4b..9b8c149f44f 100644 --- a/src/OrchardCore.Modules/OrchardCore.Sitemaps/Builders/CustomPathSitemapSourceBuilder.cs +++ b/src/OrchardCore.Modules/OrchardCore.Sitemaps/Builders/CustomPathSitemapSourceBuilder.cs @@ -35,7 +35,9 @@ private static Task BuildUrlsetMetadataAsync(CustomPathSitemapSource sourc private static bool BuildUrl(SitemapBuilderContext context, CustomPathSitemapSource source, XElement url) { if (string.IsNullOrEmpty(source.Path)) + { return false; + } // Add ~/ to the path, because the it is inserted without leading /. var path = "~/" + source.Path; diff --git a/src/OrchardCore.Modules/OrchardCore.Sitemaps/Drivers/SitemapPartDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.Sitemaps/Drivers/SitemapPartDisplayDriver.cs index c17e4a8af03..477202c3a31 100644 --- a/src/OrchardCore.Modules/OrchardCore.Sitemaps/Drivers/SitemapPartDisplayDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Sitemaps/Drivers/SitemapPartDisplayDriver.cs @@ -1,7 +1,6 @@ using System.Threading.Tasks; using OrchardCore.ContentManagement.Display.ContentDisplay; using OrchardCore.ContentManagement.Display.Models; -using OrchardCore.DisplayManagement.ModelBinding; using OrchardCore.DisplayManagement.Views; using OrchardCore.Sitemaps.Models; using OrchardCore.Sitemaps.ViewModels; diff --git a/src/OrchardCore.Modules/OrchardCore.Spatial/Drivers/GeoPointFieldDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.Spatial/Drivers/GeoPointFieldDisplayDriver.cs index 968e2139617..ff235b0466b 100644 --- a/src/OrchardCore.Modules/OrchardCore.Spatial/Drivers/GeoPointFieldDisplayDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Spatial/Drivers/GeoPointFieldDisplayDriver.cs @@ -6,7 +6,6 @@ using OrchardCore.ContentManagement.Display.ContentDisplay; using OrchardCore.ContentManagement.Display.Models; using OrchardCore.ContentManagement.Metadata.Models; -using OrchardCore.DisplayManagement.ModelBinding; using OrchardCore.DisplayManagement.Views; using OrchardCore.Mvc.ModelBinding; using OrchardCore.Spatial.Fields; diff --git a/src/OrchardCore.Modules/OrchardCore.Taxonomies/Drivers/TaxonomyFieldDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.Taxonomies/Drivers/TaxonomyFieldDisplayDriver.cs index d776427569e..b24a3beea29 100644 --- a/src/OrchardCore.Modules/OrchardCore.Taxonomies/Drivers/TaxonomyFieldDisplayDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Taxonomies/Drivers/TaxonomyFieldDisplayDriver.cs @@ -6,7 +6,6 @@ using OrchardCore.ContentManagement.Display.ContentDisplay; using OrchardCore.ContentManagement.Display.Models; using OrchardCore.ContentManagement.Metadata.Models; -using OrchardCore.DisplayManagement.ModelBinding; using OrchardCore.DisplayManagement.Views; using OrchardCore.Taxonomies.Fields; using OrchardCore.Taxonomies.Models; diff --git a/src/OrchardCore.Modules/OrchardCore.Taxonomies/Drivers/TaxonomyFieldDriverHelper.cs b/src/OrchardCore.Modules/OrchardCore.Taxonomies/Drivers/TaxonomyFieldDriverHelper.cs index 3458616a52d..89fb9cfda4c 100644 --- a/src/OrchardCore.Modules/OrchardCore.Taxonomies/Drivers/TaxonomyFieldDriverHelper.cs +++ b/src/OrchardCore.Modules/OrchardCore.Taxonomies/Drivers/TaxonomyFieldDriverHelper.cs @@ -1,7 +1,6 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Text.Json; using System.Text.Json.Nodes; using OrchardCore.ContentManagement; using OrchardCore.Taxonomies.Fields; diff --git a/src/OrchardCore.Modules/OrchardCore.Taxonomies/Drivers/TaxonomyFieldTagsDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.Taxonomies/Drivers/TaxonomyFieldTagsDisplayDriver.cs index 2a2fef9e60f..71153d4b388 100644 --- a/src/OrchardCore.Modules/OrchardCore.Taxonomies/Drivers/TaxonomyFieldTagsDisplayDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Taxonomies/Drivers/TaxonomyFieldTagsDisplayDriver.cs @@ -9,7 +9,6 @@ using OrchardCore.ContentManagement.Display.ContentDisplay; using OrchardCore.ContentManagement.Display.Models; using OrchardCore.ContentManagement.Metadata.Models; -using OrchardCore.DisplayManagement.ModelBinding; using OrchardCore.DisplayManagement.Views; using OrchardCore.Taxonomies.Fields; using OrchardCore.Taxonomies.Models; diff --git a/src/OrchardCore.Modules/OrchardCore.Taxonomies/Drivers/TaxonomyPartDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.Taxonomies/Drivers/TaxonomyPartDisplayDriver.cs index f744f32c857..b8cacaf2a16 100644 --- a/src/OrchardCore.Modules/OrchardCore.Taxonomies/Drivers/TaxonomyPartDisplayDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Taxonomies/Drivers/TaxonomyPartDisplayDriver.cs @@ -7,7 +7,6 @@ using OrchardCore.ContentManagement; using OrchardCore.ContentManagement.Display.ContentDisplay; using OrchardCore.ContentManagement.Display.Models; -using OrchardCore.DisplayManagement.ModelBinding; using OrchardCore.DisplayManagement.Views; using OrchardCore.Mvc.ModelBinding; using OrchardCore.Taxonomies.Models; diff --git a/src/OrchardCore.Modules/OrchardCore.Templates/Services/TemplatesShapeBindingResolver.cs b/src/OrchardCore.Modules/OrchardCore.Templates/Services/TemplatesShapeBindingResolver.cs index 7982c1d5c2d..e157ac7e242 100644 --- a/src/OrchardCore.Modules/OrchardCore.Templates/Services/TemplatesShapeBindingResolver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Templates/Services/TemplatesShapeBindingResolver.cs @@ -1,4 +1,3 @@ -using System.Linq; using System.Text.Encodings.Web; using System.Threading.Tasks; using Microsoft.AspNetCore.Http; diff --git a/src/OrchardCore.Modules/OrchardCore.Themes/Services/ThemeService.cs b/src/OrchardCore.Modules/OrchardCore.Themes/Services/ThemeService.cs index 789da083697..0d601034653 100644 --- a/src/OrchardCore.Modules/OrchardCore.Themes/Services/ThemeService.cs +++ b/src/OrchardCore.Modules/OrchardCore.Themes/Services/ThemeService.cs @@ -39,10 +39,16 @@ public async Task DisableThemeFeaturesAsync(string themeName) while (themeName != null) { if (themes.Contains(themeName)) + { throw new InvalidOperationException(H["The theme \"{0}\" is already in the stack of themes that need features disabled.", themeName].ToString()); + } + var theme = _extensionManager.GetExtension(themeName); if (theme == null) + { break; + } + themes.Enqueue(themeName); themeName = !string.IsNullOrWhiteSpace(theme.Manifest.Name) @@ -70,7 +76,10 @@ public async Task EnableThemeFeaturesAsync(string themeName) while (themeName != null) { if (themes.Contains(themeName)) + { throw new InvalidOperationException(H["The theme \"{0}\" is already in the stack of themes that need features enabled.", themeName].ToString()); + } + themes.Push(themeName); // TODO: MWP: probably follow on issue: should this be recursive? maybe with a depth limit? i.e. base3->base2->base1 ... diff --git a/src/OrchardCore.Modules/OrchardCore.Title/Drivers/TitlePartDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.Title/Drivers/TitlePartDisplayDriver.cs index 230e23f7c45..4bdc22b39d2 100644 --- a/src/OrchardCore.Modules/OrchardCore.Title/Drivers/TitlePartDisplayDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Title/Drivers/TitlePartDisplayDriver.cs @@ -2,7 +2,6 @@ using Microsoft.Extensions.Localization; using OrchardCore.ContentManagement.Display.ContentDisplay; using OrchardCore.ContentManagement.Display.Models; -using OrchardCore.DisplayManagement.ModelBinding; using OrchardCore.DisplayManagement.Views; using OrchardCore.Mvc.ModelBinding; using OrchardCore.Title.Models; diff --git a/src/OrchardCore.Modules/OrchardCore.Workflows/UserTasks/Drivers/UserTaskEventContentDriver.cs b/src/OrchardCore.Modules/OrchardCore.Workflows/UserTasks/Drivers/UserTaskEventContentDriver.cs index d6af9da25c2..d729866f211 100644 --- a/src/OrchardCore.Modules/OrchardCore.Workflows/UserTasks/Drivers/UserTaskEventContentDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Workflows/UserTasks/Drivers/UserTaskEventContentDriver.cs @@ -126,7 +126,9 @@ private IEnumerable GetUserTaskActions(WorkflowState workflowState, stri var activity = _activityLibrary.InstantiateActivity(nameof(UserTaskEvent), activityState); if (activity.Roles.Count > 0 && !userRoles.Any(activity.Roles.Contains)) + { yield break; + } foreach (var action in activity.Actions) { diff --git a/src/OrchardCore.Modules/OrchardCore.Workflows/WorkflowPruning/AdminMenu.cs b/src/OrchardCore.Modules/OrchardCore.Workflows/WorkflowPruning/AdminMenu.cs index f6c38bd4415..2eaaf1ca6fc 100644 --- a/src/OrchardCore.Modules/OrchardCore.Workflows/WorkflowPruning/AdminMenu.cs +++ b/src/OrchardCore.Modules/OrchardCore.Workflows/WorkflowPruning/AdminMenu.cs @@ -1,4 +1,3 @@ -using System; using System.Threading.Tasks; using Microsoft.AspNetCore.Routing; using Microsoft.Extensions.Localization; diff --git a/src/OrchardCore.Modules/OrchardCore.Workflows/WorkflowPruning/Services/WorkflowStatusBuilder.cs b/src/OrchardCore.Modules/OrchardCore.Workflows/WorkflowPruning/Services/WorkflowStatusBuilder.cs index d43d4bda484..f0d630c7ab5 100644 --- a/src/OrchardCore.Modules/OrchardCore.Workflows/WorkflowPruning/Services/WorkflowStatusBuilder.cs +++ b/src/OrchardCore.Modules/OrchardCore.Workflows/WorkflowPruning/Services/WorkflowStatusBuilder.cs @@ -11,7 +11,7 @@ internal sealed class WorkflowStatusBuilder public string Value { get; set; } public static WorkflowStatusBuilder[] Build(WorkflowStatus[] selectedStatuses) => - Enum.GetValues(typeof(WorkflowStatus)) + Enum.GetValues() .Cast() .Select(x => new WorkflowStatusBuilder { diff --git a/src/OrchardCore/OrchardCore.Abstractions/Extensions/Utility/DependencyOrdering.cs b/src/OrchardCore/OrchardCore.Abstractions/Extensions/Utility/DependencyOrdering.cs index dab555c8e2a..bd8ed82cbc5 100644 --- a/src/OrchardCore/OrchardCore.Abstractions/Extensions/Utility/DependencyOrdering.cs +++ b/src/OrchardCore/OrchardCore.Abstractions/Extensions/Utility/DependencyOrdering.cs @@ -39,7 +39,9 @@ public static IEnumerable OrderByDependenciesAndPriorities(this IEnumerabl private static void Add(Node node, ICollection list, IEnumerable> nodes, Func hasDependency) { if (node.Used) + { return; + } node.Used = true; diff --git a/src/OrchardCore/OrchardCore.Abstractions/Json/Dynamic/JsonDynamicValue.cs b/src/OrchardCore/OrchardCore.Abstractions/Json/Dynamic/JsonDynamicValue.cs index 9ebd407573e..6905956e1df 100644 --- a/src/OrchardCore/OrchardCore.Abstractions/Json/Dynamic/JsonDynamicValue.cs +++ b/src/OrchardCore/OrchardCore.Abstractions/Json/Dynamic/JsonDynamicValue.cs @@ -225,30 +225,15 @@ ulong IConvertible.ToUInt64(IFormatProvider? provider) return left.Equals(right); } - public static bool operator !=(JsonDynamicValue left, JsonDynamicValue right) - { - return !(left == right); - } + public static bool operator !=(JsonDynamicValue left, JsonDynamicValue right) => !(left == right); - public static bool operator <(JsonDynamicValue left, JsonDynamicValue right) - { - return ReferenceEquals(left, null) ? !ReferenceEquals(right, null) : left.CompareTo(right) < 0; - } + public static bool operator <(JsonDynamicValue left, JsonDynamicValue right) => ReferenceEquals(left, null) ? !ReferenceEquals(right, null) : left.CompareTo(right) < 0; - public static bool operator <=(JsonDynamicValue left, JsonDynamicValue right) - { - return ReferenceEquals(left, null) || left.CompareTo(right) <= 0; - } + public static bool operator <=(JsonDynamicValue left, JsonDynamicValue right) => ReferenceEquals(left, null) || left.CompareTo(right) <= 0; - public static bool operator >(JsonDynamicValue left, JsonDynamicValue right) - { - return !ReferenceEquals(left, null) && left.CompareTo(right) > 0; - } + public static bool operator >(JsonDynamicValue left, JsonDynamicValue right) => !ReferenceEquals(left, null) && left.CompareTo(right) > 0; - public static bool operator >=(JsonDynamicValue left, JsonDynamicValue right) - { - return ReferenceEquals(left, null) ? ReferenceEquals(right, null) : left.CompareTo(right) >= 0; - } + public static bool operator >=(JsonDynamicValue left, JsonDynamicValue right) => ReferenceEquals(left, null) ? ReferenceEquals(right, null) : left.CompareTo(right) >= 0; public static explicit operator bool(JsonDynamicValue value) { @@ -722,7 +707,7 @@ private static int Compare(object? objA, object? objB, JsonValueKind valueType) private static int CompareBigInteger(BigInteger i1, object i2) { - int result = i1.CompareTo(ToBigInteger(i2)); + var result = i1.CompareTo(ToBigInteger(i2)); if (result != 0) { @@ -737,7 +722,7 @@ private static int CompareBigInteger(BigInteger i1, object i2) } else if (i2 is double || i2 is float) { - double d = Convert.ToDouble(i2, CultureInfo.InvariantCulture); + var d = Convert.ToDouble(i2, CultureInfo.InvariantCulture); return (0d).CompareTo(Math.Abs(d - Math.Truncate(d))); } diff --git a/src/OrchardCore/OrchardCore.Abstractions/Modules/Manifest/FeatureAttribute.cs b/src/OrchardCore/OrchardCore.Abstractions/Modules/Manifest/FeatureAttribute.cs index d47e123b849..a228359023a 100644 --- a/src/OrchardCore/OrchardCore.Abstractions/Modules/Manifest/FeatureAttribute.cs +++ b/src/OrchardCore/OrchardCore.Abstractions/Modules/Manifest/FeatureAttribute.cs @@ -2,9 +2,9 @@ using System.Collections.Generic; using System.Linq; -namespace OrchardCore.Modules.Manifest; +using static System.StringSplitOptions; -using static StringSplitOptions; +namespace OrchardCore.Modules.Manifest; /// /// Defines a Feature in a Module, can be used multiple times. diff --git a/src/OrchardCore/OrchardCore.Abstractions/Modules/Module.cs b/src/OrchardCore/OrchardCore.Abstractions/Modules/Module.cs index e012486abdb..564a191e917 100644 --- a/src/OrchardCore/OrchardCore.Abstractions/Modules/Module.cs +++ b/src/OrchardCore/OrchardCore.Abstractions/Modules/Module.cs @@ -5,11 +5,10 @@ using System.Reflection; using Microsoft.Extensions.FileProviders; using Microsoft.Extensions.FileProviders.Embedded; +using OrchardCore.Modules.Manifest; namespace OrchardCore.Modules; -using Manifest; - public class Module { public const string WebRootPath = "wwwroot"; diff --git a/src/OrchardCore/OrchardCore.ContentManagement.Display/ContentDisplay/ContentItemDisplayCoordinator.cs b/src/OrchardCore/OrchardCore.ContentManagement.Display/ContentDisplay/ContentItemDisplayCoordinator.cs index f2292e00481..4725c6f1fb8 100644 --- a/src/OrchardCore/OrchardCore.ContentManagement.Display/ContentDisplay/ContentItemDisplayCoordinator.cs +++ b/src/OrchardCore/OrchardCore.ContentManagement.Display/ContentDisplay/ContentItemDisplayCoordinator.cs @@ -287,7 +287,9 @@ public async Task UpdateEditorAsync(ContentItem contentItem, UpdateEditorContext { var contentTypeDefinition = await _contentDefinitionManager.LoadTypeDefinitionAsync(contentItem.ContentType); if (contentTypeDefinition == null) + { return; + } var contentShape = context.Shape as IZoneHolding; var partsShape = await context.ShapeFactory.CreateAsync("ContentZone", diff --git a/src/OrchardCore/OrchardCore.ContentManagement.GraphQL/Queries/Predicates/InExpression.cs b/src/OrchardCore/OrchardCore.ContentManagement.GraphQL/Queries/Predicates/InExpression.cs index 84aa919c42a..705387b3eca 100644 --- a/src/OrchardCore/OrchardCore.ContentManagement.GraphQL/Queries/Predicates/InExpression.cs +++ b/src/OrchardCore/OrchardCore.ContentManagement.GraphQL/Queries/Predicates/InExpression.cs @@ -25,7 +25,10 @@ public void SearchUsedAlias(IPredicateQuery predicateQuery) public string ToSqlString(IPredicateQuery predicateQuery) { // 'columnName in ()' is always false - if (Values.Length == 0) return "1=0"; + if (Values.Length == 0) + { + return "1=0"; + } // Generates: // columnName in (@p1, @p2, @p3) @@ -35,7 +38,11 @@ public string ToSqlString(IPredicateQuery predicateQuery) { var parameter = predicateQuery.NewQueryParameter(Values[i]); - if (i > 0) array.Append(", "); + if (i > 0) + { + array.Append(", "); + } + array.Append(parameter); } diff --git a/src/OrchardCore/OrchardCore.ContentManagement.GraphQL/Queries/Predicates/Junction.cs b/src/OrchardCore/OrchardCore.ContentManagement.GraphQL/Queries/Predicates/Junction.cs index 4004758439a..ed1db690565 100644 --- a/src/OrchardCore/OrchardCore.ContentManagement.GraphQL/Queries/Predicates/Junction.cs +++ b/src/OrchardCore/OrchardCore.ContentManagement.GraphQL/Queries/Predicates/Junction.cs @@ -23,8 +23,10 @@ public abstract class Junction : IPredicate public void SearchUsedAlias(IPredicateQuery predicateQuery) { - if (_predicates.Count == 0) return; - + if (_predicates.Count == 0) + { + return; + } for (var i = 0; i < _predicates.Count; i++) { @@ -35,7 +37,10 @@ public void SearchUsedAlias(IPredicateQuery predicateQuery) public string ToSqlString(IPredicateQuery predicateQuery) { - if (_predicates.Count == 0) return EmptyExpression; + if (_predicates.Count == 0) + { + return EmptyExpression; + } var sqlBuilder = new StringBuilder(); diff --git a/src/OrchardCore/OrchardCore.ContentManagement.GraphQL/Queries/Predicates/PredicateQuery.cs b/src/OrchardCore/OrchardCore.ContentManagement.GraphQL/Queries/Predicates/PredicateQuery.cs index 3ccf38f6eff..f5a8a400528 100644 --- a/src/OrchardCore/OrchardCore.ContentManagement.GraphQL/Queries/Predicates/PredicateQuery.cs +++ b/src/OrchardCore/OrchardCore.ContentManagement.GraphQL/Queries/Predicates/PredicateQuery.cs @@ -7,7 +7,6 @@ namespace OrchardCore.ContentManagement.GraphQL.Queries.Predicates; public class PredicateQuery : IPredicateQuery { - private readonly IConfiguration _configuration; private readonly IEnumerable _propertyProviders; private readonly HashSet _usedAliases = []; @@ -19,7 +18,6 @@ public PredicateQuery( IEnumerable propertyProviders) { Dialect = configuration.SqlDialect; - _configuration = configuration; _propertyProviders = propertyProviders; } diff --git a/src/OrchardCore/OrchardCore.ContentManagement.GraphQL/Queries/Types/DynamicContentFieldsIndexAliasProvider.cs b/src/OrchardCore/OrchardCore.ContentManagement.GraphQL/Queries/Types/DynamicContentFieldsIndexAliasProvider.cs index db883fa9388..6f5aaec157e 100644 --- a/src/OrchardCore/OrchardCore.ContentManagement.GraphQL/Queries/Types/DynamicContentFieldsIndexAliasProvider.cs +++ b/src/OrchardCore/OrchardCore.ContentManagement.GraphQL/Queries/Types/DynamicContentFieldsIndexAliasProvider.cs @@ -12,7 +12,7 @@ namespace OrchardCore.ContentManagement.GraphQL.Queries.Types; public class DynamicContentFieldsIndexAliasProvider : IIndexAliasProvider, IContentDefinitionEventHandler { - private static string _cacheKey = nameof(DynamicContentFieldsIndexAliasProvider); + private static readonly string _cacheKey = nameof(DynamicContentFieldsIndexAliasProvider); private readonly IContentDefinitionManager _contentDefinitionManager; private readonly IEnumerable _contentFieldProviders; diff --git a/src/OrchardCore/OrchardCore.ContentManagement.GraphQL/Queries/Types/TypedContentTypeBuilder.cs b/src/OrchardCore/OrchardCore.ContentManagement.GraphQL/Queries/Types/TypedContentTypeBuilder.cs index 02569f1789a..a34af732813 100644 --- a/src/OrchardCore/OrchardCore.ContentManagement.GraphQL/Queries/Types/TypedContentTypeBuilder.cs +++ b/src/OrchardCore/OrchardCore.ContentManagement.GraphQL/Queries/Types/TypedContentTypeBuilder.cs @@ -1,4 +1,3 @@ -using System; using System.Linq; using GraphQL; using GraphQL.Resolvers; diff --git a/src/OrchardCore/OrchardCore.DisplayManagement.Liquid/LiquidViewTemplate.cs b/src/OrchardCore/OrchardCore.DisplayManagement.Liquid/LiquidViewTemplate.cs index 6619a3497be..449093fc632 100644 --- a/src/OrchardCore/OrchardCore.DisplayManagement.Liquid/LiquidViewTemplate.cs +++ b/src/OrchardCore/OrchardCore.DisplayManagement.Liquid/LiquidViewTemplate.cs @@ -8,14 +8,12 @@ using Fluid.Values; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; -using Microsoft.AspNetCore.Mvc.Abstractions; using Microsoft.AspNetCore.Mvc.Infrastructure; using Microsoft.AspNetCore.Mvc.Localization; using Microsoft.AspNetCore.Mvc.ModelBinding; using Microsoft.AspNetCore.Mvc.Razor; using Microsoft.AspNetCore.Mvc.Rendering; using Microsoft.AspNetCore.Mvc.ViewFeatures; -using Microsoft.AspNetCore.Routing; using Microsoft.Extensions.Caching.Memory; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.FileProviders; diff --git a/src/OrchardCore/OrchardCore.DisplayManagement.Liquid/Tags/ZoneTag.cs b/src/OrchardCore/OrchardCore.DisplayManagement.Liquid/Tags/ZoneTag.cs index 842f078d163..59de447a452 100644 --- a/src/OrchardCore/OrchardCore.DisplayManagement.Liquid/Tags/ZoneTag.cs +++ b/src/OrchardCore/OrchardCore.DisplayManagement.Liquid/Tags/ZoneTag.cs @@ -17,7 +17,7 @@ public class ZoneTag public static async ValueTask WriteToAsync( IReadOnlyList argumentsList, IReadOnlyList statements, - TextWriter writer, + TextWriter _, TextEncoder encoder, TemplateContext context) { diff --git a/src/OrchardCore/OrchardCore.DisplayManagement/Extensions/ThemeExtensionDependencyStrategy.cs b/src/OrchardCore/OrchardCore.DisplayManagement/Extensions/ThemeExtensionDependencyStrategy.cs index 1c60c36e206..b4ee27a1abe 100644 --- a/src/OrchardCore/OrchardCore.DisplayManagement/Extensions/ThemeExtensionDependencyStrategy.cs +++ b/src/OrchardCore/OrchardCore.DisplayManagement/Extensions/ThemeExtensionDependencyStrategy.cs @@ -10,7 +10,9 @@ public bool HasDependency(IFeatureInfo observer, IFeatureInfo subject) if (observer.IsTheme()) { if (!subject.IsTheme()) + { return true; + } } return false; diff --git a/src/OrchardCore/OrchardCore.DisplayManagement/Html/CssOrchardHelperExtensions.cs b/src/OrchardCore/OrchardCore.DisplayManagement/Html/CssOrchardHelperExtensions.cs index a68933e49a4..333b71923b1 100644 --- a/src/OrchardCore/OrchardCore.DisplayManagement/Html/CssOrchardHelperExtensions.cs +++ b/src/OrchardCore/OrchardCore.DisplayManagement/Html/CssOrchardHelperExtensions.cs @@ -60,16 +60,6 @@ public static IHtmlContent GetOffsetClasses(this IOrchardHelper helper, params s public static TheAdminThemeOptions GetThemeOptions(this IOrchardHelper helper) => helper.HttpContext.RequestServices.GetService>().Value; - private static IEnumerable Combine(string optionClasses, string[] additionalClasses) - { - if (string.IsNullOrEmpty(optionClasses)) - { - return additionalClasses; - } - - return additionalClasses.Concat([optionClasses]); - } - private static HtmlContentBuilder GetHtmlContentBuilder(string optionClasses, IList values) { var builder = new HtmlContentBuilder(); diff --git a/src/OrchardCore/OrchardCore.DisplayManagement/IShapeFactory.cs b/src/OrchardCore/OrchardCore.DisplayManagement/IShapeFactory.cs index 5cd728305eb..b8c6a3726bb 100644 --- a/src/OrchardCore/OrchardCore.DisplayManagement/IShapeFactory.cs +++ b/src/OrchardCore/OrchardCore.DisplayManagement/IShapeFactory.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Concurrent; -using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Castle.DynamicProxy; diff --git a/src/OrchardCore/OrchardCore.DisplayManagement/Implementation/DefaultHtmlDisplay.cs b/src/OrchardCore/OrchardCore.DisplayManagement/Implementation/DefaultHtmlDisplay.cs index 01860bf4864..4164fe3cb52 100644 --- a/src/OrchardCore/OrchardCore.DisplayManagement/Implementation/DefaultHtmlDisplay.cs +++ b/src/OrchardCore/OrchardCore.DisplayManagement/Implementation/DefaultHtmlDisplay.cs @@ -1,5 +1,4 @@ using System; -using System.Buffers; using System.Collections.Concurrent; using System.Collections.Generic; using System.Threading.Tasks; diff --git a/src/OrchardCore/OrchardCore.DisplayManagement/Manifest/ThemeAttribute.cs b/src/OrchardCore/OrchardCore.DisplayManagement/Manifest/ThemeAttribute.cs index dd4e2ead4a9..c5b7cda8c30 100644 --- a/src/OrchardCore/OrchardCore.DisplayManagement/Manifest/ThemeAttribute.cs +++ b/src/OrchardCore/OrchardCore.DisplayManagement/Manifest/ThemeAttribute.cs @@ -1,9 +1,8 @@ using System; +using OrchardCore.Modules.Manifest; namespace OrchardCore.DisplayManagement.Manifest; -using Modules.Manifest; - /// /// Defines a Theme which is a dedicated Module for theming purposes. /// If the Theme has only one default feature, it may be defined there. diff --git a/src/OrchardCore/OrchardCore.DisplayManagement/Notify/INotifier.cs b/src/OrchardCore/OrchardCore.DisplayManagement/Notify/INotifier.cs index 548cc063dda..a6b8bba8e67 100644 --- a/src/OrchardCore/OrchardCore.DisplayManagement/Notify/INotifier.cs +++ b/src/OrchardCore/OrchardCore.DisplayManagement/Notify/INotifier.cs @@ -1,4 +1,3 @@ -using System; using System.Collections.Generic; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc.Localization; diff --git a/src/OrchardCore/OrchardCore.DisplayManagement/PositionWrapper.cs b/src/OrchardCore/OrchardCore.DisplayManagement/PositionWrapper.cs index f7905816e3d..cf088dbe1c0 100644 --- a/src/OrchardCore/OrchardCore.DisplayManagement/PositionWrapper.cs +++ b/src/OrchardCore/OrchardCore.DisplayManagement/PositionWrapper.cs @@ -1,4 +1,3 @@ -using System; using System.Collections.Generic; using System.IO; using System.Text.Encodings.Web; diff --git a/src/OrchardCore/OrchardCore.DisplayManagement/Shapes/Composite.cs b/src/OrchardCore/OrchardCore.DisplayManagement/Shapes/Composite.cs index 17e88d67ebd..068511c0929 100644 --- a/src/OrchardCore/OrchardCore.DisplayManagement/Shapes/Composite.cs +++ b/src/OrchardCore/OrchardCore.DisplayManagement/Shapes/Composite.cs @@ -116,15 +116,9 @@ public IDictionary Properties get { return _properties; } } - public static bool operator ==(Composite a, Nil _) - { - return null == a; - } + public static bool operator ==(Composite a, Nil _) => null == a; - public static bool operator !=(Composite a, Nil b) - { - return !(a == b); - } + public static bool operator !=(Composite a, Nil b) => !(a == b); protected bool Equals(Composite other) { @@ -199,25 +193,13 @@ public override bool TryBinaryOperation(BinaryOperationBinder binder, object arg return base.TryBinaryOperation(binder, arg, out result); } - public static bool operator ==(Nil _1, Nil _2) - { - return true; - } + public static bool operator ==(Nil _1, Nil _2) => true; - public static bool operator !=(Nil _1, Nil _2) - { - return false; - } + public static bool operator !=(Nil _1, Nil _2) => false; - public static bool operator ==(Nil a, object b) - { - return ReferenceEquals(a, b) || b == null; - } + public static bool operator ==(Nil a, object b) => ReferenceEquals(a, b) || b == null; - public static bool operator !=(Nil a, object b) - { - return !(a == b); - } + public static bool operator !=(Nil a, object b) => !(a == b); public override bool Equals(object obj) { diff --git a/src/OrchardCore/OrchardCore.DisplayManagement/Shapes/Shape.cs b/src/OrchardCore/OrchardCore.DisplayManagement/Shapes/Shape.cs index fa243d10b13..64d6fffbc1e 100644 --- a/src/OrchardCore/OrchardCore.DisplayManagement/Shapes/Shape.cs +++ b/src/OrchardCore/OrchardCore.DisplayManagement/Shapes/Shape.cs @@ -6,7 +6,6 @@ using System.Linq; using System.Text.Json; using System.Threading.Tasks; -using Microsoft.AspNetCore.Html; using OrchardCore.DisplayManagement.Zones; namespace OrchardCore.DisplayManagement.Shapes; diff --git a/src/OrchardCore/OrchardCore.DisplayManagement/Zones/ZoneOnDemand.cs b/src/OrchardCore/OrchardCore.DisplayManagement/Zones/ZoneOnDemand.cs index d63b8cc1063..722fe39f1b4 100644 --- a/src/OrchardCore/OrchardCore.DisplayManagement/Zones/ZoneOnDemand.cs +++ b/src/OrchardCore/OrchardCore.DisplayManagement/Zones/ZoneOnDemand.cs @@ -75,17 +75,13 @@ public override bool TryConvert(System.Dynamic.ConvertBinder binder, out object return true; } - public static bool operator ==(ZoneOnDemand _, object b) - { + public static bool operator ==(ZoneOnDemand _, object b) => // If ZoneOnDemand is compared to null it must return true. - return b == null || ReferenceEquals(b, Nil.Instance); - } + b == null || ReferenceEquals(b, Nil.Instance); - public static bool operator !=(ZoneOnDemand a, object b) - { + public static bool operator !=(ZoneOnDemand a, object b) => // If ZoneOnDemand is compared to null it must return true. - return !(a == b); - } + !(a == b); public override bool Equals(object obj) { diff --git a/src/OrchardCore/OrchardCore.FileStorage.Abstractions/IFileStore.cs b/src/OrchardCore/OrchardCore.FileStorage.Abstractions/IFileStore.cs index 02bf45ef88c..f8b47c411ae 100644 --- a/src/OrchardCore/OrchardCore.FileStorage.Abstractions/IFileStore.cs +++ b/src/OrchardCore/OrchardCore.FileStorage.Abstractions/IFileStore.cs @@ -129,7 +129,9 @@ public static class IFileStoreExtensions public static string Combine(this IFileStore fileStore, params string[] paths) { if (paths.Length == 0) + { return null; + } var normalizedParts = paths @@ -140,7 +142,9 @@ public static string Combine(this IFileStore fileStore, params string[] paths) // Preserve the initial '/' if it's present. if (paths[0]?.StartsWith('/') == true) + { combined = "/" + combined; + } return combined; } diff --git a/src/OrchardCore/OrchardCore.FileStorage.AmazonS3/AwsFileStorage.cs b/src/OrchardCore/OrchardCore.FileStorage.AmazonS3/AwsFileStorage.cs index e288f6c1176..1faeab068b3 100644 --- a/src/OrchardCore/OrchardCore.FileStorage.AmazonS3/AwsFileStorage.cs +++ b/src/OrchardCore/OrchardCore.FileStorage.AmazonS3/AwsFileStorage.cs @@ -10,9 +10,6 @@ using OrchardCore.Modules; namespace OrchardCore.FileStorage.AmazonS3; - -using static String; - /// /// Provides an implementation that targets an underlying Amazon S3 Bucket account. /// @@ -29,7 +26,7 @@ public AwsFileStore(IClock clock, AwsStorageOptions options, IAmazonS3 amazonS3C _options = options; _amazonS3Client = amazonS3Client; - if (!IsNullOrEmpty(_options.BasePath)) + if (!string.IsNullOrEmpty(_options.BasePath)) { _basePrefix = NormalizePrefix(_options.BasePath); } @@ -56,7 +53,7 @@ public async Task GetFileInfoAsync(string path) public async Task GetDirectoryInfoAsync(string path) { - if (IsNullOrEmpty(path)) + if (string.IsNullOrEmpty(path)) { return new AwsDirectory(path, _clock.UtcNow); } @@ -87,9 +84,9 @@ public async IAsyncEnumerable GetDirectoryContentAsync(string p { var itemName = Path.GetFileName(WebUtility.UrlDecode(file.Key)); - if (includeSubDirectories || !IsNullOrEmpty(itemName)) + if (includeSubDirectories || !string.IsNullOrEmpty(itemName)) { - if (IsNullOrEmpty(path)) + if (string.IsNullOrEmpty(path)) { path = "/"; } @@ -101,7 +98,7 @@ public async IAsyncEnumerable GetDirectoryContentAsync(string p foreach (var awsFolderPath in listObjectsResponse.CommonPrefixes) { var folderPath = awsFolderPath; - if (!IsNullOrEmpty(_basePrefix)) + if (!string.IsNullOrEmpty(_basePrefix)) { folderPath = folderPath[(_basePrefix.Length - 1)..]; } @@ -149,7 +146,7 @@ public async Task TryDeleteFileAsync(string path) public async Task TryDeleteDirectoryAsync(string path) { - if (IsNullOrWhiteSpace(path)) + if (string.IsNullOrWhiteSpace(path)) { throw new FileStoreException("Cannot delete root directory."); } @@ -296,7 +293,7 @@ private static string NormalizePrefix(string prefix) prefix = prefix.Trim('/') + '/'; if (prefix.Length == 1) { - return Empty; + return string.Empty; } return prefix; diff --git a/src/OrchardCore/OrchardCore.FileStorage.AzureBlob/BlobFileStore.cs b/src/OrchardCore/OrchardCore.FileStorage.AzureBlob/BlobFileStore.cs index 48f7ff683b4..1e447c882c2 100644 --- a/src/OrchardCore/OrchardCore.FileStorage.AzureBlob/BlobFileStore.cs +++ b/src/OrchardCore/OrchardCore.FileStorage.AzureBlob/BlobFileStore.cs @@ -2,7 +2,6 @@ using System.Collections.Generic; using System.IO; using System.Net; -using System.Text; using System.Threading.Tasks; using Azure; using Azure.Storage.Blobs; diff --git a/src/OrchardCore/OrchardCore.Infrastructure.Abstractions/Commands/DefaultCommandHandler.cs b/src/OrchardCore/OrchardCore.Infrastructure.Abstractions/Commands/DefaultCommandHandler.cs index edbd4f35f3b..f8e84203da0 100644 --- a/src/OrchardCore/OrchardCore.Infrastructure.Abstractions/Commands/DefaultCommandHandler.cs +++ b/src/OrchardCore/OrchardCore.Infrastructure.Abstractions/Commands/DefaultCommandHandler.cs @@ -119,8 +119,15 @@ private static object[] GetInvokeParametersForMethod(MethodInfo methodInfo, stri var requiredMethodParameters = methodParameters.Where(x => !x.HasDefaultValue).ToArray(); - if (!methodHasParams && args.Count < requiredMethodParameters.Length) return null; - if (methodHasParams && (methodParameters.Length - args.Count >= 2)) return null; + if (!methodHasParams && args.Count < requiredMethodParameters.Length) + { + return null; + } + + if (methodHasParams && (methodParameters.Length - args.Count >= 2)) + { + return null; + } for (var i = 0; i < methodParameters.Length; i++) { @@ -133,7 +140,10 @@ private static object[] GetInvokeParametersForMethod(MethodInfo methodInfo, stri if (i < arguments.Length) { var val = ConvertToType(methodParameters[i].ParameterType, arguments[i]); - if (val == null) return null; + if (val == null) + { + return null; + } invokeParameters.Add(val); } @@ -159,7 +169,9 @@ private static object[] GetInvokeParametersForMethod(MethodInfo methodInfo, stri private void CheckMethodForSwitches(MethodInfo methodInfo, IDictionary switches) { if (switches == null || switches.Count == 0) + { return; + } var supportedSwitches = new HashSet(StringComparer.OrdinalIgnoreCase); foreach (var switchesAttribute in methodInfo.GetCustomAttributes(typeof(OrchardSwitchesAttribute), false).Cast()) diff --git a/src/OrchardCore/OrchardCore.Infrastructure.Abstractions/Commands/Parameters/ICommandParser.cs b/src/OrchardCore/OrchardCore.Infrastructure.Abstractions/Commands/Parameters/ICommandParser.cs index 1d42cbfd71f..f30a8e3bedd 100644 --- a/src/OrchardCore/OrchardCore.Infrastructure.Abstractions/Commands/Parameters/ICommandParser.cs +++ b/src/OrchardCore/OrchardCore.Infrastructure.Abstractions/Commands/Parameters/ICommandParser.cs @@ -55,7 +55,9 @@ public void Append(char ch) public void MoveNext() { if (!EOF) + { _index++; + } } } @@ -88,7 +90,10 @@ private static IEnumerable SplitArgs(string commandLine) case ' ': case '\t': if (state.StringBuilder.Length > 0) + { state.AddArgument(); + } + state.MoveNext(); break; @@ -99,7 +104,10 @@ private static IEnumerable SplitArgs(string commandLine) } } if (state.StringBuilder.Length > 0) + { state.AddArgument(); + } + return state.Arguments; } diff --git a/src/OrchardCore/OrchardCore.Localization.Core/PortableObject/PoParser.cs b/src/OrchardCore/OrchardCore.Localization.Core/PortableObject/PoParser.cs index e1e73597f31..9991ed98933 100644 --- a/src/OrchardCore/OrchardCore.Localization.Core/PortableObject/PoParser.cs +++ b/src/OrchardCore/OrchardCore.Localization.Core/PortableObject/PoParser.cs @@ -3,7 +3,6 @@ using System.Collections.Generic; using System.IO; using System.Linq; -using System.Text; using Cysharp.Text; namespace OrchardCore.Localization.PortableObject; diff --git a/src/OrchardCore/OrchardCore.Logging.NLog/HostBuilderExtensions.cs b/src/OrchardCore/OrchardCore.Logging.NLog/HostBuilderExtensions.cs index 5afbe043be0..3ae13ed2053 100644 --- a/src/OrchardCore/OrchardCore.Logging.NLog/HostBuilderExtensions.cs +++ b/src/OrchardCore/OrchardCore.Logging.NLog/HostBuilderExtensions.cs @@ -1,7 +1,6 @@ using Microsoft.Extensions.Hosting; using NLog; using NLog.Web; -using OrchardCore.Abstractions.Setup; namespace OrchardCore.Logging; diff --git a/src/OrchardCore/OrchardCore.Logging.NLog/WebHostBuilderExtensions.cs b/src/OrchardCore/OrchardCore.Logging.NLog/WebHostBuilderExtensions.cs index b768c02d0e2..e1666de4c50 100644 --- a/src/OrchardCore/OrchardCore.Logging.NLog/WebHostBuilderExtensions.cs +++ b/src/OrchardCore/OrchardCore.Logging.NLog/WebHostBuilderExtensions.cs @@ -4,9 +4,6 @@ using NLog; using NLog.Config; using NLog.Web; -using OrchardCore.Abstractions.Setup; -using OrchardCore.Environment.Shell; -using OrchardCore.Environment.Shell.Builders.Models; namespace OrchardCore.Logging; diff --git a/src/OrchardCore/OrchardCore.Mvc.Core/ModularApplicationModelProvider.cs b/src/OrchardCore/OrchardCore.Mvc.Core/ModularApplicationModelProvider.cs index 4123c142c2a..266d55f437d 100644 --- a/src/OrchardCore/OrchardCore.Mvc.Core/ModularApplicationModelProvider.cs +++ b/src/OrchardCore/OrchardCore.Mvc.Core/ModularApplicationModelProvider.cs @@ -1,4 +1,3 @@ -using System.Linq; using Microsoft.AspNetCore.Mvc.ApplicationModels; using Microsoft.Extensions.Hosting; using OrchardCore.Environment.Extensions; diff --git a/src/OrchardCore/OrchardCore.Mvc.Core/Utilities/StringExtensions.cs b/src/OrchardCore/OrchardCore.Mvc.Core/Utilities/StringExtensions.cs index c7bbb2020d8..5325d08a63b 100644 --- a/src/OrchardCore/OrchardCore.Mvc.Core/Utilities/StringExtensions.cs +++ b/src/OrchardCore/OrchardCore.Mvc.Core/Utilities/StringExtensions.cs @@ -49,7 +49,9 @@ public static string Ellipsize(this string text, int characterCount, string elli } if (characterCount < 0 || text.Length <= characterCount) + { return text; + } // Search beginning of word. var backup = characterCount; diff --git a/src/OrchardCore/OrchardCore.ReCaptcha.Core/ActionFilters/ValidateReCaptchaAttribute.cs b/src/OrchardCore/OrchardCore.ReCaptcha.Core/ActionFilters/ValidateReCaptchaAttribute.cs index aa43961fdd1..46e54799ebf 100644 --- a/src/OrchardCore/OrchardCore.ReCaptcha.Core/ActionFilters/ValidateReCaptchaAttribute.cs +++ b/src/OrchardCore/OrchardCore.ReCaptcha.Core/ActionFilters/ValidateReCaptchaAttribute.cs @@ -25,7 +25,9 @@ public override async Task OnResultExecutionAsync(ResultExecutingContext context var reCaptchaResponse = context.HttpContext.Request?.Form?[Constants.ReCaptchaServerResponseHeaderName].ToString(); if (!string.IsNullOrWhiteSpace(reCaptchaResponse)) + { isValidCaptcha = await recaptchaService.VerifyCaptchaResponseAsync(reCaptchaResponse); + } var isRobot = false; diff --git a/src/OrchardCore/OrchardCore.ResourceManagement.Abstractions/ResourcesTagHelperProcessorContext.cs b/src/OrchardCore/OrchardCore.ResourceManagement.Abstractions/ResourcesTagHelperProcessorContext.cs index 5cbf130164b..fbb6c89400d 100644 --- a/src/OrchardCore/OrchardCore.ResourceManagement.Abstractions/ResourcesTagHelperProcessorContext.cs +++ b/src/OrchardCore/OrchardCore.ResourceManagement.Abstractions/ResourcesTagHelperProcessorContext.cs @@ -1,5 +1,4 @@ using System.IO; -using Microsoft.AspNetCore.Razor.TagHelpers; namespace OrchardCore.ResourceManagement; diff --git a/src/OrchardCore/OrchardCore.ResourceManagement/TagHelpers/ResourcesTagHelper.cs b/src/OrchardCore/OrchardCore.ResourceManagement/TagHelpers/ResourcesTagHelper.cs index 2c7d53d6614..b37eb25c63f 100644 --- a/src/OrchardCore/OrchardCore.ResourceManagement/TagHelpers/ResourcesTagHelper.cs +++ b/src/OrchardCore/OrchardCore.ResourceManagement/TagHelpers/ResourcesTagHelper.cs @@ -10,16 +10,13 @@ namespace OrchardCore.ResourceManagement.TagHelpers; [HtmlTargetElement("resources", Attributes = nameof(Type))] public class ResourcesTagHelper : TagHelper { - private readonly IResourceManager _resourceManager; private readonly ILogger _logger; private readonly IEnumerable _processors; public ResourcesTagHelper( - IResourceManager resourceManager, ILogger logger, IEnumerable processors) { - _resourceManager = resourceManager; _logger = logger; _processors = processors; } diff --git a/src/OrchardCore/OrchardCore.Search.Elasticsearch.Core/Services/ElasticIndexManager.cs b/src/OrchardCore/OrchardCore.Search.Elasticsearch.Core/Services/ElasticIndexManager.cs index 50dd0a6d1ee..8dbc8bdc446 100644 --- a/src/OrchardCore/OrchardCore.Search.Elasticsearch.Core/Services/ElasticIndexManager.cs +++ b/src/OrchardCore/OrchardCore.Search.Elasticsearch.Core/Services/ElasticIndexManager.cs @@ -329,10 +329,12 @@ public async Task DeleteDocumentsAsync(string indexName, IEnumerable>(d => d .Index(GetFullIndexName(indexName)) .Id(id) ); + } var response = await _elasticClient.BulkAsync(descriptor); diff --git a/src/OrchardCore/OrchardCore.Users.Core/Json/LoginInfoJsonConverter.cs b/src/OrchardCore/OrchardCore.Users.Core/Json/LoginInfoJsonConverter.cs index 151365c279b..0b7b7bd3724 100644 --- a/src/OrchardCore/OrchardCore.Users.Core/Json/LoginInfoJsonConverter.cs +++ b/src/OrchardCore/OrchardCore.Users.Core/Json/LoginInfoJsonConverter.cs @@ -1,6 +1,5 @@ using System; using System.Text.Json; -using System.Text.Json.Nodes; using System.Text.Json.Serialization; using Microsoft.AspNetCore.Identity; diff --git a/src/OrchardCore/OrchardCore.Users.Core/Services/PasswordResetTokenProvider.cs b/src/OrchardCore/OrchardCore.Users.Core/Services/PasswordResetTokenProvider.cs index 1557fdd29a8..7a64855ee8e 100644 --- a/src/OrchardCore/OrchardCore.Users.Core/Services/PasswordResetTokenProvider.cs +++ b/src/OrchardCore/OrchardCore.Users.Core/Services/PasswordResetTokenProvider.cs @@ -1,4 +1,3 @@ -using System.Threading.Tasks; using Microsoft.AspNetCore.DataProtection; using Microsoft.AspNetCore.Identity; using Microsoft.Extensions.Logging; diff --git a/src/OrchardCore/OrchardCore.Workflows.Abstractions/Options/WorkflowOptions.cs b/src/OrchardCore/OrchardCore.Workflows.Abstractions/Options/WorkflowOptions.cs index 1dff6f48472..26a60cbdaa2 100644 --- a/src/OrchardCore/OrchardCore.Workflows.Abstractions/Options/WorkflowOptions.cs +++ b/src/OrchardCore/OrchardCore.Workflows.Abstractions/Options/WorkflowOptions.cs @@ -40,7 +40,9 @@ public WorkflowOptions RegisterActivity(Type activityType, Type driverType = nul public WorkflowOptions UnregisterActivityType(Type activityType) { if (!ActivityDictionary.ContainsKey(activityType)) + { throw new InvalidOperationException("The specified activity type is not registered."); + } ActivityDictionary.Remove(activityType); return this; diff --git a/test/OrchardCore.Benchmarks/RuleBenchmark.cs b/test/OrchardCore.Benchmarks/RuleBenchmark.cs index ed565a73223..f19cebf6ac0 100644 --- a/test/OrchardCore.Benchmarks/RuleBenchmark.cs +++ b/test/OrchardCore.Benchmarks/RuleBenchmark.cs @@ -1,4 +1,3 @@ -using System; using System.Linq; using System.Threading.Tasks; using BenchmarkDotNet.Attributes; diff --git a/test/OrchardCore.Tests.Modules/BaseThemeSample/DependentTypes.cs b/test/OrchardCore.Tests.Modules/BaseThemeSample/DependentTypes.cs index 572bb052aad..647074ae4a4 100644 --- a/test/OrchardCore.Tests.Modules/BaseThemeSample/DependentTypes.cs +++ b/test/OrchardCore.Tests.Modules/BaseThemeSample/DependentTypes.cs @@ -1,8 +1,3 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using OrchardCore.Modules; namespace BaseThemeSample; diff --git a/test/OrchardCore.Tests/Usings.cs b/test/OrchardCore.Tests/Usings.cs index 14f952e7ea9..3c759cde1dd 100644 --- a/test/OrchardCore.Tests/Usings.cs +++ b/test/OrchardCore.Tests/Usings.cs @@ -30,8 +30,6 @@ global using Microsoft.AspNetCore.Localization; global using Microsoft.AspNetCore.Mvc; global using Microsoft.AspNetCore.Mvc.Localization; -global using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; -global using Microsoft.AspNetCore.Mvc.Routing; global using Microsoft.AspNetCore.Mvc.Testing; global using Microsoft.AspNetCore.Mvc.ViewFeatures; global using Microsoft.AspNetCore.Routing;