From 4cc65fd42a847d1591ed08bb254ae35c372e3b11 Mon Sep 17 00:00:00 2001 From: Mike Alhayek Date: Sun, 28 Jan 2024 15:03:35 -0800 Subject: [PATCH] use 'var' instead of explicit type (IDE0007 and IDE0008) (#15189) --- .../OrchardCore.Admin/AdminThemeSelector.cs | 2 +- .../OrchardCore.Admin/AdminThemeService.cs | 2 +- .../Routing/AutorouteValuesAddressScheme.cs | 2 +- .../Services/StereotypeDescription.cs | 2 +- .../OpenIdValidationConfiguration.cs | 2 +- .../OpenIdApplicationSettings.cs | 4 +-- .../Activities/UnassignUserRoleTask.cs | 2 +- .../DefaultSiteSettingsDisplayDriver.cs | 2 +- .../Recipes/SettingsStep.cs | 2 +- .../Routing/SitemapValuesAddressScheme.cs | 2 +- .../Services/SiteThemeSelector.cs | 2 +- .../Services/SiteThemeService.cs | 2 +- .../Recipes/CustomUserSettingsStep.cs | 4 +-- .../Controllers/AdminController.cs | 2 +- .../MethodCallModelBinder.cs | 2 +- .../Queries/Predicates/PredicateQuery.cs | 2 +- .../Html/CssOrchardHelperExtensions.cs | 30 +++++++++---------- .../TagHelpers/DateTimeTagHelper.cs | 4 +-- .../TagHelpers/TimeSpanTagHelper.cs | 4 +-- .../Zones/ZoneOnDemand.cs | 2 +- .../AwsDirectory.cs | 2 +- .../AwsFile.cs | 2 +- .../Commands/CommandNameAttribute.cs | 2 +- .../Files/PathExtensions.cs | 2 +- .../RolesCacheContextProvider.cs | 2 +- .../ModelBinding/SafeBoolModelBinder.cs | 2 +- .../Razor/TenantRazorCompiledItemLoader.cs | 2 +- .../NavigationHelper.cs | 2 +- .../AzureAISearchIndexCreateContext.cs | 2 +- .../AzureAISearchIndexRebuildContext.cs | 2 +- .../AzureAISearchIndexRemoveContext.cs | 2 +- .../IAzureAISearchDocumentEvents.cs | 2 +- .../QueryProviders/BooleanQueryProvider.cs | 2 +- .../HttpClient/TenantHttpClientFactory.cs | 12 ++++---- 34 files changed, 57 insertions(+), 57 deletions(-) diff --git a/src/OrchardCore.Modules/OrchardCore.Admin/AdminThemeSelector.cs b/src/OrchardCore.Modules/OrchardCore.Admin/AdminThemeSelector.cs index baa0b9f1df2..3e4c5933751 100644 --- a/src/OrchardCore.Modules/OrchardCore.Admin/AdminThemeSelector.cs +++ b/src/OrchardCore.Modules/OrchardCore.Admin/AdminThemeSelector.cs @@ -28,7 +28,7 @@ public async Task GetThemeAsync() { if (AdminAttribute.IsApplied(_httpContextAccessor.HttpContext)) { - string adminThemeName = await _adminThemeService.GetAdminThemeNameAsync(); + var adminThemeName = await _adminThemeService.GetAdminThemeNameAsync(); if (string.IsNullOrEmpty(adminThemeName)) { return null; diff --git a/src/OrchardCore.Modules/OrchardCore.Admin/AdminThemeService.cs b/src/OrchardCore.Modules/OrchardCore.Admin/AdminThemeService.cs index 60863d09b55..453acbd6621 100644 --- a/src/OrchardCore.Modules/OrchardCore.Admin/AdminThemeService.cs +++ b/src/OrchardCore.Modules/OrchardCore.Admin/AdminThemeService.cs @@ -20,7 +20,7 @@ public AdminThemeService( public async Task GetAdminThemeAsync() { - string currentThemeName = await GetAdminThemeNameAsync(); + var currentThemeName = await GetAdminThemeNameAsync(); if (string.IsNullOrEmpty(currentThemeName)) { return null; diff --git a/src/OrchardCore.Modules/OrchardCore.Autoroute/Routing/AutorouteValuesAddressScheme.cs b/src/OrchardCore.Modules/OrchardCore.Autoroute/Routing/AutorouteValuesAddressScheme.cs index bcc119c2f6b..06a59185497 100644 --- a/src/OrchardCore.Modules/OrchardCore.Autoroute/Routing/AutorouteValuesAddressScheme.cs +++ b/src/OrchardCore.Modules/OrchardCore.Autoroute/Routing/AutorouteValuesAddressScheme.cs @@ -29,7 +29,7 @@ public IEnumerable FindEndpoints(RouteValuesAddress address) } // Try to get the contained item first, then the container content item - string contentItemId = address.ExplicitValues[_options.ContainedContentItemIdKey]?.ToString(); + var contentItemId = address.ExplicitValues[_options.ContainedContentItemIdKey]?.ToString(); if (string.IsNullOrEmpty(contentItemId)) { contentItemId = address.ExplicitValues[_options.ContentItemIdKey]?.ToString(); diff --git a/src/OrchardCore.Modules/OrchardCore.ContentTypes/Services/StereotypeDescription.cs b/src/OrchardCore.Modules/OrchardCore.ContentTypes/Services/StereotypeDescription.cs index fcf1ef3ff22..98e4cf532dc 100644 --- a/src/OrchardCore.Modules/OrchardCore.ContentTypes/Services/StereotypeDescription.cs +++ b/src/OrchardCore.Modules/OrchardCore.ContentTypes/Services/StereotypeDescription.cs @@ -1,4 +1,4 @@ -namespace OrchardCore.ContentTypes.Services; +namespace OrchardCore.ContentTypes.Services; public class StereotypeDescription { diff --git a/src/OrchardCore.Modules/OrchardCore.OpenId/Configuration/OpenIdValidationConfiguration.cs b/src/OrchardCore.Modules/OrchardCore.OpenId/Configuration/OpenIdValidationConfiguration.cs index 731c2093e13..efa76e848a0 100644 --- a/src/OrchardCore.Modules/OrchardCore.OpenId/Configuration/OpenIdValidationConfiguration.cs +++ b/src/OrchardCore.Modules/OrchardCore.OpenId/Configuration/OpenIdValidationConfiguration.cs @@ -174,7 +174,7 @@ public void Configure(OpenIddictValidationOptions options) { options.TokenValidationParameters.IssuerValidator = (issuer, token, parameters) => { - if (!Uri.TryCreate(issuer, UriKind.Absolute, out Uri uri)) + if (!Uri.TryCreate(issuer, UriKind.Absolute, out var uri)) { throw new SecurityTokenInvalidIssuerException("The token issuer is not valid."); } diff --git a/src/OrchardCore.Modules/OrchardCore.OpenId/OpenIdApplicationSettings.cs b/src/OrchardCore.Modules/OrchardCore.OpenId/OpenIdApplicationSettings.cs index a800a56f3b8..3816045ebbc 100644 --- a/src/OrchardCore.Modules/OrchardCore.OpenId/OpenIdApplicationSettings.cs +++ b/src/OrchardCore.Modules/OrchardCore.OpenId/OpenIdApplicationSettings.cs @@ -223,7 +223,7 @@ public static async Task UpdateDescriptorFromSettings(this IOpenIdApplicationMan } descriptor.PostLogoutRedirectUris.Clear(); - foreach (Uri uri in + foreach (var uri in (from uri in model.PostLogoutRedirectUris?.Split(new[] { " ", "," }, StringSplitOptions.RemoveEmptyEntries) ?? Array.Empty() select new Uri(uri, UriKind.Absolute))) { @@ -231,7 +231,7 @@ public static async Task UpdateDescriptorFromSettings(this IOpenIdApplicationMan } descriptor.RedirectUris.Clear(); - foreach (Uri uri in + foreach (var uri in (from uri in model.RedirectUris?.Split(new[] { " ", "," }, StringSplitOptions.RemoveEmptyEntries) ?? Array.Empty() select new Uri(uri, UriKind.Absolute))) { diff --git a/src/OrchardCore.Modules/OrchardCore.Roles/Views/Workflows/Activities/UnassignUserRoleTask.cs b/src/OrchardCore.Modules/OrchardCore.Roles/Views/Workflows/Activities/UnassignUserRoleTask.cs index 985a36ecabe..c978f0d7796 100644 --- a/src/OrchardCore.Modules/OrchardCore.Roles/Views/Workflows/Activities/UnassignUserRoleTask.cs +++ b/src/OrchardCore.Modules/OrchardCore.Roles/Views/Workflows/Activities/UnassignUserRoleTask.cs @@ -55,7 +55,7 @@ public override async Task ExecuteAsync(WorkflowExecuti if (u is User user) { - foreach(var role in Roles) + foreach (var role in Roles) { if (user.RoleNames.Contains(role)) { diff --git a/src/OrchardCore.Modules/OrchardCore.Settings/Drivers/DefaultSiteSettingsDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.Settings/Drivers/DefaultSiteSettingsDisplayDriver.cs index 654755eb8e9..fb1eb1120ec 100644 --- a/src/OrchardCore.Modules/OrchardCore.Settings/Drivers/DefaultSiteSettingsDisplayDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Settings/Drivers/DefaultSiteSettingsDisplayDriver.cs @@ -73,7 +73,7 @@ public override async Task UpdateAsync(ISite site, UpdateEditorC site.ResourceDebugMode = model.ResourceDebugMode; site.AppendVersion = model.AppendVersion; site.CacheMode = model.CacheMode; - + if (model.PageSize.Value < 1) { context.Updater.ModelState.AddModelError(Prefix, nameof(model.PageSize), S["The page size must be greater than zero."]); diff --git a/src/OrchardCore.Modules/OrchardCore.Settings/Recipes/SettingsStep.cs b/src/OrchardCore.Modules/OrchardCore.Settings/Recipes/SettingsStep.cs index 0d00b2bafc6..71e7d80fe19 100644 --- a/src/OrchardCore.Modules/OrchardCore.Settings/Recipes/SettingsStep.cs +++ b/src/OrchardCore.Modules/OrchardCore.Settings/Recipes/SettingsStep.cs @@ -29,7 +29,7 @@ public async Task ExecuteAsync(RecipeExecutionContext context) var model = context.Step; var site = await _siteService.LoadSiteSettingsAsync(); - foreach (JProperty property in model.Properties()) + foreach (var property in model.Properties()) { switch (property.Name) { diff --git a/src/OrchardCore.Modules/OrchardCore.Sitemaps/Routing/SitemapValuesAddressScheme.cs b/src/OrchardCore.Modules/OrchardCore.Sitemaps/Routing/SitemapValuesAddressScheme.cs index 15e37947ed6..d55f525f581 100644 --- a/src/OrchardCore.Modules/OrchardCore.Sitemaps/Routing/SitemapValuesAddressScheme.cs +++ b/src/OrchardCore.Modules/OrchardCore.Sitemaps/Routing/SitemapValuesAddressScheme.cs @@ -27,7 +27,7 @@ public IEnumerable FindEndpoints(RouteValuesAddress address) return Enumerable.Empty(); } - string sitemapId = address.ExplicitValues[_options.SitemapIdKey]?.ToString(); + var sitemapId = address.ExplicitValues[_options.SitemapIdKey]?.ToString(); if (string.IsNullOrEmpty(sitemapId)) { diff --git a/src/OrchardCore.Modules/OrchardCore.Themes/Services/SiteThemeSelector.cs b/src/OrchardCore.Modules/OrchardCore.Themes/Services/SiteThemeSelector.cs index a13e2080207..251b109548d 100644 --- a/src/OrchardCore.Modules/OrchardCore.Themes/Services/SiteThemeSelector.cs +++ b/src/OrchardCore.Modules/OrchardCore.Themes/Services/SiteThemeSelector.cs @@ -20,7 +20,7 @@ public SiteThemeSelector(ISiteThemeService siteThemeService) public async Task GetThemeAsync() { - string currentThemeName = await _siteThemeService.GetSiteThemeNameAsync(); + var currentThemeName = await _siteThemeService.GetSiteThemeNameAsync(); if (string.IsNullOrEmpty(currentThemeName)) { return null; diff --git a/src/OrchardCore.Modules/OrchardCore.Themes/Services/SiteThemeService.cs b/src/OrchardCore.Modules/OrchardCore.Themes/Services/SiteThemeService.cs index ae5c7ab413f..5be33e8f904 100644 --- a/src/OrchardCore.Modules/OrchardCore.Themes/Services/SiteThemeService.cs +++ b/src/OrchardCore.Modules/OrchardCore.Themes/Services/SiteThemeService.cs @@ -20,7 +20,7 @@ public SiteThemeService( public async Task GetSiteThemeAsync() { - string currentThemeName = await GetSiteThemeNameAsync(); + var currentThemeName = await GetSiteThemeNameAsync(); if (string.IsNullOrEmpty(currentThemeName)) { return null; diff --git a/src/OrchardCore.Modules/OrchardCore.Users/Recipes/CustomUserSettingsStep.cs b/src/OrchardCore.Modules/OrchardCore.Users/Recipes/CustomUserSettingsStep.cs index 858e38efcb1..6ba13c14627 100644 --- a/src/OrchardCore.Modules/OrchardCore.Users/Recipes/CustomUserSettingsStep.cs +++ b/src/OrchardCore.Modules/OrchardCore.Users/Recipes/CustomUserSettingsStep.cs @@ -39,7 +39,7 @@ public async Task ExecuteAsync(RecipeExecutionContext context) var allUsers = await _session.Query().ListAsync(); - foreach (JObject userCustomUserSettings in customUserSettingsList.Cast()) + foreach (var userCustomUserSettings in customUserSettingsList.Cast()) { var userId = userCustomUserSettings .Properties() @@ -58,7 +58,7 @@ public async Task ExecuteAsync(RecipeExecutionContext context) .FirstOrDefault(p => p.Name == "user-custom-user-settings") ?.Value; - foreach (JObject userSetting in userSettings.Cast()) + foreach (var userSetting in userSettings.Cast()) { var contentItem = userSetting.ToObject(); user.Properties[contentItem.ContentType] = userSetting; diff --git a/src/OrchardCore.Modules/OrchardCore.Widgets/Controllers/AdminController.cs b/src/OrchardCore.Modules/OrchardCore.Widgets/Controllers/AdminController.cs index ee4446fd372..4069a1b5821 100644 --- a/src/OrchardCore.Modules/OrchardCore.Widgets/Controllers/AdminController.cs +++ b/src/OrchardCore.Modules/OrchardCore.Widgets/Controllers/AdminController.cs @@ -40,7 +40,7 @@ public async Task BuildEditor(string id, string prefix, string pr contentItem.Weld(new WidgetMetadata()); - string cardCollectionType = nameof(WidgetsListPart); + var cardCollectionType = nameof(WidgetsListPart); //Create a Card Shape dynamic contentCard = await _shapeFactory.New.ContentCard( diff --git a/src/OrchardCore.Modules/OrchardCore.XmlRpc/MethodCallModelBinder.cs b/src/OrchardCore.Modules/OrchardCore.XmlRpc/MethodCallModelBinder.cs index 142f7cc2f09..a969ccf7a10 100644 --- a/src/OrchardCore.Modules/OrchardCore.XmlRpc/MethodCallModelBinder.cs +++ b/src/OrchardCore.Modules/OrchardCore.XmlRpc/MethodCallModelBinder.cs @@ -25,7 +25,7 @@ public async Task BindModelAsync(ModelBindingContext bindingContext) var bodyTextContent = string.Empty; // For some reasons we can't use XElement.LoadAsync. This method fails on big request body. I tested this with a picture with 2 MB of size. // This code is maybe bad. Because if someone send a very big XML to this endpoint the server will die a out of memory exception. - using (StreamReader reader = new StreamReader(bindingContext.HttpContext.Request.Body, Encoding.UTF8, true, 1024, true)) + using (var reader = new StreamReader(bindingContext.HttpContext.Request.Body, Encoding.UTF8, true, 1024, true)) { bodyTextContent = await reader.ReadToEndAsync(); } diff --git a/src/OrchardCore/OrchardCore.ContentManagement.GraphQL/Queries/Predicates/PredicateQuery.cs b/src/OrchardCore/OrchardCore.ContentManagement.GraphQL/Queries/Predicates/PredicateQuery.cs index 3d97502ae82..c28b3a1c548 100644 --- a/src/OrchardCore/OrchardCore.ContentManagement.GraphQL/Queries/Predicates/PredicateQuery.cs +++ b/src/OrchardCore/OrchardCore.ContentManagement.GraphQL/Queries/Predicates/PredicateQuery.cs @@ -77,7 +77,7 @@ public void SearchUsedAlias(string propertyPath) // Check if there's an alias for the full path // aliasPart.Alias -> AliasFieldIndex.Alias - if (_aliases.TryGetValue(propertyPath, out string alias)) + if (_aliases.TryGetValue(propertyPath, out var alias)) { _usedAliases.Add(alias); return; diff --git a/src/OrchardCore/OrchardCore.DisplayManagement/Html/CssOrchardHelperExtensions.cs b/src/OrchardCore/OrchardCore.DisplayManagement/Html/CssOrchardHelperExtensions.cs index 1a5eed5f195..85d0e5b4c77 100644 --- a/src/OrchardCore/OrchardCore.DisplayManagement/Html/CssOrchardHelperExtensions.cs +++ b/src/OrchardCore/OrchardCore.DisplayManagement/Html/CssOrchardHelperExtensions.cs @@ -12,22 +12,22 @@ public static class CssOrchardHelperExtensions { public static IHtmlContent GetLimitedWidthWrapperClasses(this IOrchardHelper helper, params string[] additionalClasses) => GetHtmlContentBuilder(helper.GetThemeOptions().LimitedWidthWrapperClasses, additionalClasses); - + public static IHtmlContent GetLimitedWidthClasses(this IOrchardHelper helper, params string[] additionalClasses) => GetHtmlContentBuilder(helper.GetThemeOptions().LimitedWidthClasses, additionalClasses); - + public static IHtmlContent GetStartClasses(this IOrchardHelper helper, params string[] additionalClasses) => GetHtmlContentBuilder(helper.GetThemeOptions().StartClasses, additionalClasses); - + public static IHtmlContent GetEndClasses(this IOrchardHelper helper, params string[] additionalClasses) => GetHtmlContentBuilder(helper.GetThemeOptions().EndClasses, additionalClasses); - + public static IHtmlContent GetLabelClasses(this IOrchardHelper helper, params string[] additionalClasses) => GetHtmlContentBuilder(helper.GetThemeOptions().LabelClasses, additionalClasses); - + public static IHtmlContent GetWrapperClasses(this IOrchardHelper helper, params string[] additionalClasses) => GetHtmlContentBuilder(helper.GetThemeOptions().WrapperClasses, additionalClasses); - + public static IHtmlContent GetEndClasses(this IOrchardHelper helper, bool withOffset, params string[] additionalClasses) { var options = helper.GetThemeOptions(); @@ -47,31 +47,31 @@ public static IHtmlContent GetEndClasses(this IOrchardHelper helper, bool withOf public static IHtmlContent GetOffsetClasses(this IOrchardHelper helper, params string[] additionalClasses) => GetHtmlContentBuilder(helper.GetThemeOptions().OffsetClasses, additionalClasses); - + [Obsolete($"Please use {nameof(GetLimitedWidthWrapperClasses)} instead, as this method is deprecated and will be removed in upcoming versions.")] public static string GetLimitedWidthWrapperCssClasses(this IOrchardHelper helper, params string[] additionalClasses) => string.Join(' ', Combine(helper.GetThemeOptions().LimitedWidthWrapperClasses, additionalClasses)); - + [Obsolete($"Please use {nameof(GetLimitedWidthClasses)} instead, as this method is deprecated and will be removed in upcoming versions.")] public static string GetLimitedWidthCssClasses(this IOrchardHelper helper, params string[] additionalClasses) => string.Join(' ', Combine(helper.GetThemeOptions().LimitedWidthClasses, additionalClasses)); - + [Obsolete($"Please use {nameof(GetLabelClasses)} instead, as this method is deprecated and will be removed in upcoming versions.")] public static string GetLabelCssClasses(this IOrchardHelper helper, params string[] additionalClasses) => string.Join(' ', Combine(helper.GetThemeOptions().LabelClasses, additionalClasses)); - + [Obsolete($"Please use {nameof(GetStartClasses)} instead, as this method is deprecated and will be removed in upcoming versions.")] public static string GetStartCssClasses(this IOrchardHelper helper, params string[] additionalClasses) => string.Join(' ', Combine(helper.GetThemeOptions().StartClasses, additionalClasses)); - + [Obsolete($"Please use {nameof(GetEndClasses)} instead, as this method is deprecated and will be removed in upcoming versions.")] public static string GetEndCssClasses(this IOrchardHelper helper, params string[] additionalClasses) => string.Join(' ', Combine(helper.GetThemeOptions().EndClasses, additionalClasses)); - + [Obsolete($"Please use {nameof(GetWrapperClasses)} instead, as this method is deprecated and will be removed in upcoming versions.")] public static string GetWrapperCssClasses(this IOrchardHelper helper, params string[] additionalClasses) => string.Join(' ', Combine(helper.GetThemeOptions().WrapperClasses, additionalClasses)); - + [Obsolete($"Please use {nameof(GetEndClasses)} instead, as this method is deprecated and will be removed in upcoming versions.")] public static string GetEndCssClasses(this IOrchardHelper helper, bool withOffset, params string[] additionalClasses) @@ -94,7 +94,7 @@ public static string GetEndCssClasses(this IOrchardHelper helper, bool withOffse [Obsolete($"Please use {nameof(GetOffsetClasses)} instead, as this method is deprecated and will be removed in upcoming versions.")] public static string GetOffsetCssClasses(this IOrchardHelper helper, params string[] additionalClasses) => string.Join(' ', Combine(helper.GetThemeOptions().OffsetClasses, additionalClasses)); - + public static TheAdminThemeOptions GetThemeOptions(this IOrchardHelper helper) => helper.HttpContext.RequestServices.GetService>().Value; @@ -111,7 +111,7 @@ private static IEnumerable Combine(string optionClasses, string[] additi private static HtmlContentBuilder GetHtmlContentBuilder(string optionClasses, IList values) { var builder = new HtmlContentBuilder(); - + builder.Append(optionClasses); builder.AppendSeparatedValues(values); diff --git a/src/OrchardCore/OrchardCore.DisplayManagement/TagHelpers/DateTimeTagHelper.cs b/src/OrchardCore/OrchardCore.DisplayManagement/TagHelpers/DateTimeTagHelper.cs index 89b8211cf19..9a585bebe92 100644 --- a/src/OrchardCore/OrchardCore.DisplayManagement/TagHelpers/DateTimeTagHelper.cs +++ b/src/OrchardCore/OrchardCore.DisplayManagement/TagHelpers/DateTimeTagHelper.cs @@ -31,11 +31,11 @@ public async override Task ProcessAsync(TagHelperContext context, TagHelperOutpu dynamic shape = await _shapeFactory.CreateAsync(shapeType); shape.Utc = Utc; shape.Format = Format; - + output.Content.SetHtmlContent(await _displayHelper.ShapeExecuteAsync(shape)); // We don't want any encapsulating tag around the shape output.TagName = null; } } -} \ No newline at end of file +} diff --git a/src/OrchardCore/OrchardCore.DisplayManagement/TagHelpers/TimeSpanTagHelper.cs b/src/OrchardCore/OrchardCore.DisplayManagement/TagHelpers/TimeSpanTagHelper.cs index 2a094b922c0..aeecb9c99c9 100644 --- a/src/OrchardCore/OrchardCore.DisplayManagement/TagHelpers/TimeSpanTagHelper.cs +++ b/src/OrchardCore/OrchardCore.DisplayManagement/TagHelpers/TimeSpanTagHelper.cs @@ -24,7 +24,7 @@ public TimeSpanTagHelper(IShapeFactory shapeFactory, IDisplayHelper displayHelpe [HtmlAttributeName(OriginAttribute)] public DateTime? Origin { set; get; } - + public async override Task ProcessAsync(TagHelperContext context, TagHelperOutput output) { var shapeType = "TimeSpan"; @@ -38,4 +38,4 @@ public async override Task ProcessAsync(TagHelperContext context, TagHelperOutpu output.TagName = null; } } -} \ No newline at end of file +} diff --git a/src/OrchardCore/OrchardCore.DisplayManagement/Zones/ZoneOnDemand.cs b/src/OrchardCore/OrchardCore.DisplayManagement/Zones/ZoneOnDemand.cs index fec166507c2..1cac235d46d 100644 --- a/src/OrchardCore/OrchardCore.DisplayManagement/Zones/ZoneOnDemand.cs +++ b/src/OrchardCore/OrchardCore.DisplayManagement/Zones/ZoneOnDemand.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Linq; using System.Threading.Tasks; using OrchardCore.DisplayManagement.Shapes; diff --git a/src/OrchardCore/OrchardCore.FileStorage.AmazonS3/AwsDirectory.cs b/src/OrchardCore/OrchardCore.FileStorage.AmazonS3/AwsDirectory.cs index bb1fac42b66..6809694d2b1 100644 --- a/src/OrchardCore/OrchardCore.FileStorage.AmazonS3/AwsDirectory.cs +++ b/src/OrchardCore/OrchardCore.FileStorage.AmazonS3/AwsDirectory.cs @@ -1,4 +1,4 @@ -using System; +using System; namespace OrchardCore.FileStorage.AmazonS3; diff --git a/src/OrchardCore/OrchardCore.FileStorage.AmazonS3/AwsFile.cs b/src/OrchardCore/OrchardCore.FileStorage.AmazonS3/AwsFile.cs index ff26a7604df..2c070cdca65 100644 --- a/src/OrchardCore/OrchardCore.FileStorage.AmazonS3/AwsFile.cs +++ b/src/OrchardCore/OrchardCore.FileStorage.AmazonS3/AwsFile.cs @@ -1,4 +1,4 @@ -using System; +using System; namespace OrchardCore.FileStorage.AmazonS3; diff --git a/src/OrchardCore/OrchardCore.Infrastructure.Abstractions/Commands/CommandNameAttribute.cs b/src/OrchardCore/OrchardCore.Infrastructure.Abstractions/Commands/CommandNameAttribute.cs index bcf2287b9f3..58515dd41a3 100644 --- a/src/OrchardCore/OrchardCore.Infrastructure.Abstractions/Commands/CommandNameAttribute.cs +++ b/src/OrchardCore/OrchardCore.Infrastructure.Abstractions/Commands/CommandNameAttribute.cs @@ -35,7 +35,7 @@ public CommandHelpAttribute(params string[] helpText) return; } - StringBuilder builder = new StringBuilder(); + var builder = new StringBuilder(); foreach (var value in helpText) { diff --git a/src/OrchardCore/OrchardCore.Infrastructure.Abstractions/Files/PathExtensions.cs b/src/OrchardCore/OrchardCore.Infrastructure.Abstractions/Files/PathExtensions.cs index 4c85e6482c3..9711ec3a139 100644 --- a/src/OrchardCore/OrchardCore.Infrastructure.Abstractions/Files/PathExtensions.cs +++ b/src/OrchardCore/OrchardCore.Infrastructure.Abstractions/Files/PathExtensions.cs @@ -49,7 +49,7 @@ public static string Combine(string path, string other = null) /// public static string Combine(string path, params string[] others) { - string result = path; + var result = path; for (var i = 0; i < others.Length; i++) { diff --git a/src/OrchardCore/OrchardCore.Infrastructure/Cache/CacheContextProviders/RolesCacheContextProvider.cs b/src/OrchardCore/OrchardCore.Infrastructure/Cache/CacheContextProviders/RolesCacheContextProvider.cs index e18265cf83f..443a1a177b2 100644 --- a/src/OrchardCore/OrchardCore.Infrastructure/Cache/CacheContextProviders/RolesCacheContextProvider.cs +++ b/src/OrchardCore/OrchardCore.Infrastructure/Cache/CacheContextProviders/RolesCacheContextProvider.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Security.Claims; diff --git a/src/OrchardCore/OrchardCore.Mvc.Core/ModelBinding/SafeBoolModelBinder.cs b/src/OrchardCore/OrchardCore.Mvc.Core/ModelBinding/SafeBoolModelBinder.cs index e5a54dfdb24..2a98a69bf37 100644 --- a/src/OrchardCore/OrchardCore.Mvc.Core/ModelBinding/SafeBoolModelBinder.cs +++ b/src/OrchardCore/OrchardCore.Mvc.Core/ModelBinding/SafeBoolModelBinder.cs @@ -24,7 +24,7 @@ public Task BindModelAsync(ModelBindingContext bindingContext) return Task.CompletedTask; } - if (bool.TryParse(valueProviderResult.FirstValue, out bool result)) + if (bool.TryParse(valueProviderResult.FirstValue, out var result)) { bindingContext.Result = ModelBindingResult.Success(result); diff --git a/src/OrchardCore/OrchardCore.Mvc.Core/Overrides/Razor/TenantRazorCompiledItemLoader.cs b/src/OrchardCore/OrchardCore.Mvc.Core/Overrides/Razor/TenantRazorCompiledItemLoader.cs index 1ac9997eb54..c545d4ebb45 100644 --- a/src/OrchardCore/OrchardCore.Mvc.Core/Overrides/Razor/TenantRazorCompiledItemLoader.cs +++ b/src/OrchardCore/OrchardCore.Mvc.Core/Overrides/Razor/TenantRazorCompiledItemLoader.cs @@ -1,8 +1,8 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System.Collections.Generic; using System; +using System.Collections.Generic; using System.Reflection; using Microsoft.AspNetCore.Mvc.Razor.Extensions; diff --git a/src/OrchardCore/OrchardCore.Navigation.Core/NavigationHelper.cs b/src/OrchardCore/OrchardCore.Navigation.Core/NavigationHelper.cs index 80c0ed6b519..c7e58fc58fa 100644 --- a/src/OrchardCore/OrchardCore.Navigation.Core/NavigationHelper.cs +++ b/src/OrchardCore/OrchardCore.Navigation.Core/NavigationHelper.cs @@ -35,7 +35,7 @@ public static async Task PopulateMenuAsync(dynamic shapeFactory, dynamic parentS /// The current . public static async Task PopulateMenuLevelAsync(dynamic shapeFactory, dynamic parentShape, dynamic menu, IEnumerable menuItems, ViewContext viewContext) { - foreach (MenuItem menuItem in menuItems) + foreach (var menuItem in menuItems) { dynamic menuItemShape = await BuildMenuItemShapeAsync(shapeFactory, parentShape, menu, menuItem, viewContext); diff --git a/src/OrchardCore/OrchardCore.Search.AzureAI.Core/AzureAISearchIndexCreateContext.cs b/src/OrchardCore/OrchardCore.Search.AzureAI.Core/AzureAISearchIndexCreateContext.cs index ae86f124de3..045e2a4d6d2 100644 --- a/src/OrchardCore/OrchardCore.Search.AzureAI.Core/AzureAISearchIndexCreateContext.cs +++ b/src/OrchardCore/OrchardCore.Search.AzureAI.Core/AzureAISearchIndexCreateContext.cs @@ -1,4 +1,4 @@ -using System; +using System; using OrchardCore.Search.AzureAI.Models; namespace OrchardCore.Search.AzureAI; diff --git a/src/OrchardCore/OrchardCore.Search.AzureAI.Core/AzureAISearchIndexRebuildContext.cs b/src/OrchardCore/OrchardCore.Search.AzureAI.Core/AzureAISearchIndexRebuildContext.cs index 18fdb89ce30..39bf11b91c9 100644 --- a/src/OrchardCore/OrchardCore.Search.AzureAI.Core/AzureAISearchIndexRebuildContext.cs +++ b/src/OrchardCore/OrchardCore.Search.AzureAI.Core/AzureAISearchIndexRebuildContext.cs @@ -1,4 +1,4 @@ -using System; +using System; using OrchardCore.Search.AzureAI.Models; namespace OrchardCore.Search.AzureAI; diff --git a/src/OrchardCore/OrchardCore.Search.AzureAI.Core/AzureAISearchIndexRemoveContext.cs b/src/OrchardCore/OrchardCore.Search.AzureAI.Core/AzureAISearchIndexRemoveContext.cs index fb7b1334ebf..c41ca5441b8 100644 --- a/src/OrchardCore/OrchardCore.Search.AzureAI.Core/AzureAISearchIndexRemoveContext.cs +++ b/src/OrchardCore/OrchardCore.Search.AzureAI.Core/AzureAISearchIndexRemoveContext.cs @@ -1,4 +1,4 @@ -namespace OrchardCore.Search.AzureAI; +namespace OrchardCore.Search.AzureAI; public class AzureAISearchIndexRemoveContext(string indexName, string indexFullName) { diff --git a/src/OrchardCore/OrchardCore.Search.AzureAI.Core/IAzureAISearchDocumentEvents.cs b/src/OrchardCore/OrchardCore.Search.AzureAI.Core/IAzureAISearchDocumentEvents.cs index 9b768facb2a..8c006c08a1f 100644 --- a/src/OrchardCore/OrchardCore.Search.AzureAI.Core/IAzureAISearchDocumentEvents.cs +++ b/src/OrchardCore/OrchardCore.Search.AzureAI.Core/IAzureAISearchDocumentEvents.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.Threading.Tasks; using Azure.Search.Documents.Models; diff --git a/src/OrchardCore/OrchardCore.Search.Lucene.Core/QueryProviders/BooleanQueryProvider.cs b/src/OrchardCore/OrchardCore.Search.Lucene.Core/QueryProviders/BooleanQueryProvider.cs index bbbf80f93af..e8aa6644483 100644 --- a/src/OrchardCore/OrchardCore.Search.Lucene.Core/QueryProviders/BooleanQueryProvider.cs +++ b/src/OrchardCore/OrchardCore.Search.Lucene.Core/QueryProviders/BooleanQueryProvider.cs @@ -28,7 +28,7 @@ public Query CreateQuery(ILuceneQueryService builder, LuceneQueryContext context foreach (var property in query.Properties()) { var occur = Occur.MUST; - bool isProps = false; + var isProps = false; switch (property.Name.ToLowerInvariant()) { diff --git a/src/OrchardCore/OrchardCore/Modules/Overrides/HttpClient/TenantHttpClientFactory.cs b/src/OrchardCore/OrchardCore/Modules/Overrides/HttpClient/TenantHttpClientFactory.cs index 88cb3dbc561..03af69d924a 100644 --- a/src/OrchardCore/OrchardCore/Modules/Overrides/HttpClient/TenantHttpClientFactory.cs +++ b/src/OrchardCore/OrchardCore/Modules/Overrides/HttpClient/TenantHttpClientFactory.cs @@ -223,7 +223,7 @@ internal void ExpiryTimer_Tick(object? state) // The timer callback should be the only one removing from the active collection. If we can't find // our entry in the collection, then this is a bug. - var removed = _activeHandlers.TryRemove(active.Name, out Lazy? found); + var removed = _activeHandlers.TryRemove(active.Name, out var found); Debug.Assert(removed, "Entry not found. We should always be able to remove the entry"); Debug.Assert(object.ReferenceEquals(active, found!.Value), "Different entry found. The entry should not have been replaced"); @@ -306,7 +306,7 @@ internal void CleanupTimer_Tick() for (var i = 0; i < initialCount; i++) { // Since we're the only one removing from _expired, TryDequeue must always succeed. - _expiredHandlers.TryDequeue(out ExpiredHandlerTrackingEntry? entry); + _expiredHandlers.TryDequeue(out var entry); Debug.Assert(entry != null, "Entry was null, we should always get an entry back from TryDequeue"); // OC: Also check if disposed. @@ -406,7 +406,7 @@ public static class EventIds public static void CleanupCycleStart(Lazy loggerLazy, int initialCount) { - if (TryGetLogger(loggerLazy, out ILogger? logger)) + if (TryGetLogger(loggerLazy, out var logger)) { _cleanupCycleStart(logger, initialCount, null); } @@ -414,7 +414,7 @@ public static void CleanupCycleStart(Lazy loggerLazy, int initialCount) public static void CleanupCycleEnd(Lazy loggerLazy, TimeSpan duration, int disposedCount, int finalCount) { - if (TryGetLogger(loggerLazy, out ILogger? logger)) + if (TryGetLogger(loggerLazy, out var logger)) { _cleanupCycleEnd(logger, duration.TotalMilliseconds, disposedCount, finalCount, null); } @@ -422,7 +422,7 @@ public static void CleanupCycleEnd(Lazy loggerLazy, TimeSpan duration, public static void CleanupItemFailed(Lazy loggerLazy, string clientName, Exception exception) { - if (TryGetLogger(loggerLazy, out ILogger? logger)) + if (TryGetLogger(loggerLazy, out var logger)) { _cleanupItemFailed(logger, clientName, exception); } @@ -430,7 +430,7 @@ public static void CleanupItemFailed(Lazy loggerLazy, string clientName public static void HandlerExpired(Lazy loggerLazy, string clientName, TimeSpan lifetime) { - if (TryGetLogger(loggerLazy, out ILogger? logger)) + if (TryGetLogger(loggerLazy, out var logger)) { _handlerExpired(logger, lifetime.TotalMilliseconds, clientName, null); }