diff --git a/.editorconfig b/.editorconfig index 2cd15b6196b..7edbe6b6043 100644 --- a/.editorconfig +++ b/.editorconfig @@ -39,7 +39,7 @@ dotnet_style_qualification_for_event = false : suggestion # Use language keywords instead of framework type names for type references dotnet_style_predefined_type_for_locals_parameters_members = true : suggestion -dotnet_style_predefined_type_for_member_access = false : suggestion +dotnet_style_predefined_type_for_member_access = true : suggestion # Suggest more modern language features when available csharp_style_pattern_matching_over_is_with_cast_check = true : none diff --git a/src/OrchardCore.Modules/OrchardCore.Admin/AdminMenu.cs b/src/OrchardCore.Modules/OrchardCore.Admin/AdminMenu.cs index fb34ec40a75..52eb6040747 100644 --- a/src/OrchardCore.Modules/OrchardCore.Admin/AdminMenu.cs +++ b/src/OrchardCore.Modules/OrchardCore.Admin/AdminMenu.cs @@ -17,7 +17,7 @@ public AdminMenu(IStringLocalizer localizer) public Task BuildNavigationAsync(string name, NavigationBuilder builder) { - if (!String.Equals(name, "admin", StringComparison.OrdinalIgnoreCase)) + if (!string.Equals(name, "admin", StringComparison.OrdinalIgnoreCase)) { return Task.CompletedTask; } diff --git a/src/OrchardCore.Modules/OrchardCore.Admin/AdminThemeSelector.cs b/src/OrchardCore.Modules/OrchardCore.Admin/AdminThemeSelector.cs index 2e8a6eaf40c..baa0b9f1df2 100644 --- a/src/OrchardCore.Modules/OrchardCore.Admin/AdminThemeSelector.cs +++ b/src/OrchardCore.Modules/OrchardCore.Admin/AdminThemeSelector.cs @@ -29,7 +29,7 @@ public async Task GetThemeAsync() if (AdminAttribute.IsApplied(_httpContextAccessor.HttpContext)) { string adminThemeName = await _adminThemeService.GetAdminThemeNameAsync(); - if (String.IsNullOrEmpty(adminThemeName)) + 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 f2b3c1b4c84..60863d09b55 100644 --- a/src/OrchardCore.Modules/OrchardCore.Admin/AdminThemeService.cs +++ b/src/OrchardCore.Modules/OrchardCore.Admin/AdminThemeService.cs @@ -21,7 +21,7 @@ public AdminThemeService( public async Task GetAdminThemeAsync() { string currentThemeName = await GetAdminThemeNameAsync(); - if (String.IsNullOrEmpty(currentThemeName)) + if (string.IsNullOrEmpty(currentThemeName)) { return null; } diff --git a/src/OrchardCore.Modules/OrchardCore.Admin/Properties/AssemblyInfo.cs b/src/OrchardCore.Modules/OrchardCore.Admin/Properties/AssemblyInfo.cs index 0bc36381619..b8e9281b53e 100644 --- a/src/OrchardCore.Modules/OrchardCore.Admin/Properties/AssemblyInfo.cs +++ b/src/OrchardCore.Modules/OrchardCore.Admin/Properties/AssemblyInfo.cs @@ -1,4 +1,4 @@ -using System.Reflection; +using System.Reflection; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following diff --git a/src/OrchardCore.Modules/OrchardCore.AdminMenu/AdminMenu.cs b/src/OrchardCore.Modules/OrchardCore.AdminMenu/AdminMenu.cs index 8b1f6145018..a24415a7b16 100644 --- a/src/OrchardCore.Modules/OrchardCore.AdminMenu/AdminMenu.cs +++ b/src/OrchardCore.Modules/OrchardCore.AdminMenu/AdminMenu.cs @@ -20,7 +20,7 @@ public AdminMenu(AdminMenuNavigationProvidersCoordinator adminMenuNavigationProv public async Task BuildNavigationAsync(string name, NavigationBuilder builder) { - if (!String.Equals(name, "admin", StringComparison.OrdinalIgnoreCase)) + if (!string.Equals(name, "admin", StringComparison.OrdinalIgnoreCase)) { return; } diff --git a/src/OrchardCore.Modules/OrchardCore.AdminMenu/AdminNodes/LinkAdminNodeNavigationBuilder.cs b/src/OrchardCore.Modules/OrchardCore.AdminMenu/AdminNodes/LinkAdminNodeNavigationBuilder.cs index 552d5167427..56803d572d1 100644 --- a/src/OrchardCore.Modules/OrchardCore.AdminMenu/AdminNodes/LinkAdminNodeNavigationBuilder.cs +++ b/src/OrchardCore.Modules/OrchardCore.AdminMenu/AdminNodes/LinkAdminNodeNavigationBuilder.cs @@ -33,7 +33,7 @@ public LinkAdminNodeNavigationBuilder( public Task BuildNavigationAsync(MenuItem menuItem, NavigationBuilder builder, IEnumerable treeNodeBuilders) { var node = menuItem as LinkAdminNode; - if (node == null || String.IsNullOrEmpty(node.LinkText) || !node.Enabled) + if (node == null || string.IsNullOrEmpty(node.LinkText) || !node.Enabled) { return Task.CompletedTask; } @@ -41,7 +41,7 @@ public Task BuildNavigationAsync(MenuItem menuItem, NavigationBuilder builder, I return builder.AddAsync(new LocalizedString(node.LinkText, node.LinkText), async itemBuilder => { var nodeLinkUrl = node.LinkUrl; - if (!String.IsNullOrEmpty(nodeLinkUrl) && nodeLinkUrl[0] != '/' && !nodeLinkUrl.Contains("://")) + if (!string.IsNullOrEmpty(nodeLinkUrl) && nodeLinkUrl[0] != '/' && !nodeLinkUrl.Contains("://")) { if (nodeLinkUrl.StartsWith("~/", StringComparison.Ordinal)) { diff --git a/src/OrchardCore.Modules/OrchardCore.AdminMenu/AdminNodes/PlaceholderAdminNodeNavigationBuilder.cs b/src/OrchardCore.Modules/OrchardCore.AdminMenu/AdminNodes/PlaceholderAdminNodeNavigationBuilder.cs index ed4465bd06c..3aedee31ee9 100644 --- a/src/OrchardCore.Modules/OrchardCore.AdminMenu/AdminNodes/PlaceholderAdminNodeNavigationBuilder.cs +++ b/src/OrchardCore.Modules/OrchardCore.AdminMenu/AdminNodes/PlaceholderAdminNodeNavigationBuilder.cs @@ -26,7 +26,7 @@ public Task BuildNavigationAsync(MenuItem menuItem, NavigationBuilder builder, I { var node = menuItem as PlaceholderAdminNode; - if (node == null || String.IsNullOrEmpty(node.LinkText) || !node.Enabled) + if (node == null || string.IsNullOrEmpty(node.LinkText) || !node.Enabled) { return Task.CompletedTask; } diff --git a/src/OrchardCore.Modules/OrchardCore.AdminMenu/Controllers/MenuController.cs b/src/OrchardCore.Modules/OrchardCore.AdminMenu/Controllers/MenuController.cs index b4e25948756..7b4a12a1a51 100644 --- a/src/OrchardCore.Modules/OrchardCore.AdminMenu/Controllers/MenuController.cs +++ b/src/OrchardCore.Modules/OrchardCore.AdminMenu/Controllers/MenuController.cs @@ -63,7 +63,7 @@ public async Task List(ContentOptions options, PagerParameters pa var adminMenuList = (await _adminMenuService.GetAdminMenuListAsync()).AdminMenu; - if (!String.IsNullOrWhiteSpace(options.Search)) + if (!string.IsNullOrWhiteSpace(options.Search)) { adminMenuList = adminMenuList.Where(x => x.Name.Contains(options.Search, StringComparison.OrdinalIgnoreCase)).ToList(); } @@ -254,7 +254,7 @@ public async Task IndexPost(ViewModels.ContentOptions options, IEn case ContentsBulkAction.Remove: foreach (var item in checkedContentItems) { - var adminMenu = adminMenuList.FirstOrDefault(x => String.Equals(x.Id, item.Id, StringComparison.OrdinalIgnoreCase)); + var adminMenu = adminMenuList.FirstOrDefault(x => string.Equals(x.Id, item.Id, StringComparison.OrdinalIgnoreCase)); await _adminMenuService.DeleteAsync(adminMenu); } await _notifier.SuccessAsync(H["Admin menus successfully removed."]); diff --git a/src/OrchardCore.Modules/OrchardCore.AdminMenu/Permissions.cs b/src/OrchardCore.Modules/OrchardCore.AdminMenu/Permissions.cs index 2d5d2ca558f..d4e7e084ef5 100644 --- a/src/OrchardCore.Modules/OrchardCore.AdminMenu/Permissions.cs +++ b/src/OrchardCore.Modules/OrchardCore.AdminMenu/Permissions.cs @@ -53,8 +53,8 @@ public IEnumerable GetDefaultStereotypes() public static Permission CreatePermissionForAdminMenu(string name) { return new Permission( - String.Format(_viewAdminMenu.Name, name), - String.Format(_viewAdminMenu.Description, name), + string.Format(_viewAdminMenu.Name, name), + string.Format(_viewAdminMenu.Description, name), _viewAdminMenu.ImpliedBy ); } diff --git a/src/OrchardCore.Modules/OrchardCore.AdminMenu/Recipes/AdminMenuStep.cs b/src/OrchardCore.Modules/OrchardCore.AdminMenu/Recipes/AdminMenuStep.cs index c40ff237106..efc4c7c01f9 100644 --- a/src/OrchardCore.Modules/OrchardCore.AdminMenu/Recipes/AdminMenuStep.cs +++ b/src/OrchardCore.Modules/OrchardCore.AdminMenu/Recipes/AdminMenuStep.cs @@ -23,7 +23,7 @@ public AdminMenuStep(IAdminMenuService adminMenuService) public async Task ExecuteAsync(RecipeExecutionContext context) { - if (!String.Equals(context.Name, "AdminMenu", StringComparison.OrdinalIgnoreCase)) + if (!string.Equals(context.Name, "AdminMenu", StringComparison.OrdinalIgnoreCase)) { return; } @@ -37,7 +37,7 @@ public async Task ExecuteAsync(RecipeExecutionContext context) var adminMenu = token.ToObject(serializer); // When the id is not supplied generate an id, otherwise replace the menu if it exists, or create a new menu. - if (String.IsNullOrEmpty(adminMenu.Id)) + if (string.IsNullOrEmpty(adminMenu.Id)) { adminMenu.Id = Guid.NewGuid().ToString("n"); } diff --git a/src/OrchardCore.Modules/OrchardCore.AdminMenu/Services/AdminMenuNavigationProvidersCoordinator.cs b/src/OrchardCore.Modules/OrchardCore.AdminMenu/Services/AdminMenuNavigationProvidersCoordinator.cs index 8f950ea5a94..4f9e2448515 100644 --- a/src/OrchardCore.Modules/OrchardCore.AdminMenu/Services/AdminMenuNavigationProvidersCoordinator.cs +++ b/src/OrchardCore.Modules/OrchardCore.AdminMenu/Services/AdminMenuNavigationProvidersCoordinator.cs @@ -39,7 +39,7 @@ public AdminMenuNavigationProvidersCoordinator( // todo: use a public constant for the string public async Task BuildNavigationAsync(string name, NavigationBuilder builder) { - if (!String.Equals(name, "adminMenu", StringComparison.OrdinalIgnoreCase)) + if (!string.Equals(name, "adminMenu", StringComparison.OrdinalIgnoreCase)) { return; } diff --git a/src/OrchardCore.Modules/OrchardCore.AdminMenu/Services/AdminMenuService.cs b/src/OrchardCore.Modules/OrchardCore.AdminMenu/Services/AdminMenuService.cs index c49aefe7e9a..6eec990cb21 100644 --- a/src/OrchardCore.Modules/OrchardCore.AdminMenu/Services/AdminMenuService.cs +++ b/src/OrchardCore.Modules/OrchardCore.AdminMenu/Services/AdminMenuService.cs @@ -26,7 +26,7 @@ public async Task SaveAsync(Models.AdminMenu tree) { var adminMenuList = await LoadAdminMenuListAsync(); - var preexisting = adminMenuList.AdminMenu.FirstOrDefault(x => String.Equals(x.Id, tree.Id, StringComparison.OrdinalIgnoreCase)); + var preexisting = adminMenuList.AdminMenu.FirstOrDefault(x => string.Equals(x.Id, tree.Id, StringComparison.OrdinalIgnoreCase)); // it's new? add it if (preexisting == null) @@ -44,14 +44,14 @@ public async Task SaveAsync(Models.AdminMenu tree) public Models.AdminMenu GetAdminMenuById(AdminMenuList adminMenuList, string id) { - return adminMenuList.AdminMenu.FirstOrDefault(x => String.Equals(x.Id, id, StringComparison.OrdinalIgnoreCase)); + return adminMenuList.AdminMenu.FirstOrDefault(x => string.Equals(x.Id, id, StringComparison.OrdinalIgnoreCase)); } public async Task DeleteAsync(Models.AdminMenu tree) { var adminMenuList = await LoadAdminMenuListAsync(); - var count = adminMenuList.AdminMenu.RemoveAll(x => String.Equals(x.Id, tree.Id, StringComparison.OrdinalIgnoreCase)); + var count = adminMenuList.AdminMenu.RemoveAll(x => string.Equals(x.Id, tree.Id, StringComparison.OrdinalIgnoreCase)); await _documentManager.UpdateAsync(adminMenuList); diff --git a/src/OrchardCore.Modules/OrchardCore.Alias/Handlers/AliasPartHandler.cs b/src/OrchardCore.Modules/OrchardCore.Alias/Handlers/AliasPartHandler.cs index 7cc9d97b0db..064d2afdd42 100644 --- a/src/OrchardCore.Modules/OrchardCore.Alias/Handlers/AliasPartHandler.cs +++ b/src/OrchardCore.Modules/OrchardCore.Alias/Handlers/AliasPartHandler.cs @@ -42,7 +42,7 @@ public AliasPartHandler( public override async Task ValidatingAsync(ValidateContentContext context, AliasPart part) { // Only validate the alias if it's not empty. - if (String.IsNullOrWhiteSpace(part.Alias)) + if (string.IsNullOrWhiteSpace(part.Alias)) { return; } @@ -56,14 +56,14 @@ public override async Task ValidatingAsync(ValidateContentContext context, Alias public async override Task UpdatedAsync(UpdateContentContext context, AliasPart part) { // Compute the Alias only if it's empty. - if (!String.IsNullOrEmpty(part.Alias)) + if (!string.IsNullOrEmpty(part.Alias)) { return; } var pattern = GetPattern(part); - if (!String.IsNullOrEmpty(pattern)) + if (!string.IsNullOrEmpty(pattern)) { var model = new AliasPartViewModel() { @@ -75,7 +75,7 @@ public async override Task UpdatedAsync(UpdateContentContext context, AliasPart part.Alias = await _liquidTemplateManager.RenderStringAsync(pattern, NullEncoder.Default, model, new Dictionary() { [nameof(ContentItem)] = new ObjectValue(model.ContentItem) }); - part.Alias = part.Alias.Replace("\r", String.Empty).Replace("\n", String.Empty); + part.Alias = part.Alias.Replace("\r", string.Empty).Replace("\n", string.Empty); if (part.Alias?.Length > AliasPart.MaxAliasLength) { @@ -125,7 +125,7 @@ public override async Task CloningAsync(CloneContentContext context, AliasPart p private string GetPattern(AliasPart part) { var contentTypeDefinition = _contentDefinitionManager.GetTypeDefinition(part.ContentItem.ContentType); - var contentTypePartDefinition = contentTypeDefinition.Parts.FirstOrDefault(x => String.Equals(x.PartDefinition.Name, nameof(AliasPart))); + var contentTypePartDefinition = contentTypeDefinition.Parts.FirstOrDefault(x => string.Equals(x.PartDefinition.Name, nameof(AliasPart))); var pattern = contentTypePartDefinition.GetSettings().Pattern; return pattern; @@ -137,7 +137,7 @@ private async Task GenerateUniqueAliasAsync(string alias, AliasPart cont var unversionedAlias = alias; var versionSeparatorPosition = alias.LastIndexOf('-'); - if (versionSeparatorPosition > -1 && Int32.TryParse(alias[versionSeparatorPosition..].TrimStart('-'), out version)) + if (versionSeparatorPosition > -1 && int.TryParse(alias[versionSeparatorPosition..].TrimStart('-'), out version)) { unversionedAlias = alias[..versionSeparatorPosition]; } diff --git a/src/OrchardCore.Modules/OrchardCore.Alias/Indexes/AliasPartIndex.cs b/src/OrchardCore.Modules/OrchardCore.Alias/Indexes/AliasPartIndex.cs index 95061c26fb1..e9b770d9081 100644 --- a/src/OrchardCore.Modules/OrchardCore.Alias/Indexes/AliasPartIndex.cs +++ b/src/OrchardCore.Modules/OrchardCore.Alias/Indexes/AliasPartIndex.cs @@ -71,7 +71,7 @@ public void Describe(DescribeContext context) } var part = contentItem.As(); - if (part == null || String.IsNullOrEmpty(part.Alias)) + if (part == null || string.IsNullOrEmpty(part.Alias)) { return null; } diff --git a/src/OrchardCore.Modules/OrchardCore.Alias/Properties/AssemblyInfo.cs b/src/OrchardCore.Modules/OrchardCore.Alias/Properties/AssemblyInfo.cs index 4c8ae6bd52d..ccc01419ee1 100644 --- a/src/OrchardCore.Modules/OrchardCore.Alias/Properties/AssemblyInfo.cs +++ b/src/OrchardCore.Modules/OrchardCore.Alias/Properties/AssemblyInfo.cs @@ -1,4 +1,4 @@ -using System.Reflection; +using System.Reflection; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following diff --git a/src/OrchardCore.Modules/OrchardCore.Alias/Razor/AliasPartRazorHelperExtensions.cs b/src/OrchardCore.Modules/OrchardCore.Alias/Razor/AliasPartRazorHelperExtensions.cs index 242cd24bf56..b3915ff9bd0 100644 --- a/src/OrchardCore.Modules/OrchardCore.Alias/Razor/AliasPartRazorHelperExtensions.cs +++ b/src/OrchardCore.Modules/OrchardCore.Alias/Razor/AliasPartRazorHelperExtensions.cs @@ -19,7 +19,7 @@ public static class AliasPartRazorHelperExtensions /// A content item id or null if it was not found. public static async Task GetContentItemIdByAliasAsync(this IOrchardHelper orchardHelper, string alias) { - if (String.IsNullOrEmpty(alias)) + if (string.IsNullOrEmpty(alias)) { return null; } diff --git a/src/OrchardCore.Modules/OrchardCore.Alias/Settings/AliasPartSettingsDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.Alias/Settings/AliasPartSettingsDisplayDriver.cs index 3ebaa4b3d95..d324a85de29 100644 --- a/src/OrchardCore.Modules/OrchardCore.Alias/Settings/AliasPartSettingsDisplayDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Alias/Settings/AliasPartSettingsDisplayDriver.cs @@ -39,9 +39,9 @@ public override async Task UpdateAsync(ContentTypePartDefinition if (await context.Updater.TryUpdateModelAsync(model, Prefix, m => m.Pattern, m => m.Options)) { - if (!String.IsNullOrEmpty(model.Pattern) && !_templateManager.Validate(model.Pattern, out var errors)) + if (!string.IsNullOrEmpty(model.Pattern) && !_templateManager.Validate(model.Pattern, out var errors)) { - context.Updater.ModelState.AddModelError(nameof(model.Pattern), S["Pattern doesn't contain a valid Liquid expression. Details: {0}", String.Join(" ", errors)]); + context.Updater.ModelState.AddModelError(nameof(model.Pattern), S["Pattern doesn't contain a valid Liquid expression. Details: {0}", string.Join(" ", errors)]); } else { diff --git a/src/OrchardCore.Modules/OrchardCore.Alias/Settings/AliasPartSettingsViewModel.cs b/src/OrchardCore.Modules/OrchardCore.Alias/Settings/AliasPartSettingsViewModel.cs index 771ebd573ac..55e8dfb5868 100644 --- a/src/OrchardCore.Modules/OrchardCore.Alias/Settings/AliasPartSettingsViewModel.cs +++ b/src/OrchardCore.Modules/OrchardCore.Alias/Settings/AliasPartSettingsViewModel.cs @@ -1,4 +1,4 @@ -using Microsoft.AspNetCore.Mvc.ModelBinding; +using Microsoft.AspNetCore.Mvc.ModelBinding; namespace OrchardCore.Alias.Settings { diff --git a/src/OrchardCore.Modules/OrchardCore.Apis.GraphQL/AdminMenu.cs b/src/OrchardCore.Modules/OrchardCore.Apis.GraphQL/AdminMenu.cs index 48bd16d7cac..bcc0c6cc80d 100644 --- a/src/OrchardCore.Modules/OrchardCore.Apis.GraphQL/AdminMenu.cs +++ b/src/OrchardCore.Modules/OrchardCore.Apis.GraphQL/AdminMenu.cs @@ -16,7 +16,7 @@ public AdminMenu(IStringLocalizer localizer) public Task BuildNavigationAsync(string name, NavigationBuilder builder) { - if (!String.Equals(name, "admin", StringComparison.OrdinalIgnoreCase)) + if (!string.Equals(name, "admin", StringComparison.OrdinalIgnoreCase)) { return Task.CompletedTask; } diff --git a/src/OrchardCore.Modules/OrchardCore.Apis.GraphQL/GraphQLMiddleware.cs b/src/OrchardCore.Modules/OrchardCore.Apis.GraphQL/GraphQLMiddleware.cs index fde49534deb..91e12c5dca2 100644 --- a/src/OrchardCore.Modules/OrchardCore.Apis.GraphQL/GraphQLMiddleware.cs +++ b/src/OrchardCore.Modules/OrchardCore.Apis.GraphQL/GraphQLMiddleware.cs @@ -127,7 +127,7 @@ private async Task ExecuteAsync(HttpContext context, ISchemaFactory schemaServic var queryToExecute = request.Query; - if (!String.IsNullOrEmpty(request.NamedQuery)) + if (!string.IsNullOrEmpty(request.NamedQuery)) { var namedQueries = context.RequestServices.GetServices(); diff --git a/src/OrchardCore.Modules/OrchardCore.Apis.GraphQL/Services/SchemaService.cs b/src/OrchardCore.Modules/OrchardCore.Apis.GraphQL/Services/SchemaService.cs index 615d5dec285..bda808c37f6 100644 --- a/src/OrchardCore.Modules/OrchardCore.Apis.GraphQL/Services/SchemaService.cs +++ b/src/OrchardCore.Modules/OrchardCore.Apis.GraphQL/Services/SchemaService.cs @@ -87,7 +87,7 @@ public async Task GetSchemaAsync() var identifier = await builder.GetIdentifierAsync(); // Null being a valid value not yet updated. - if (identifier != String.Empty) + if (identifier != string.Empty) { _identifiers[builder] = identifier; } diff --git a/src/OrchardCore.Modules/OrchardCore.AuditTrail/Controllers/AdminController.cs b/src/OrchardCore.Modules/OrchardCore.AuditTrail/Controllers/AdminController.cs index 0d9daba7e38..65afeff6842 100644 --- a/src/OrchardCore.Modules/OrchardCore.AuditTrail/Controllers/AdminController.cs +++ b/src/OrchardCore.Modules/OrchardCore.AuditTrail/Controllers/AdminController.cs @@ -64,7 +64,7 @@ public async Task Index([ModelBinder(BinderType = typeof(AuditTrai }; // This is used by Contents feature for routing so needs to be passed into the options. - if (!String.IsNullOrEmpty(correlationId)) + if (!string.IsNullOrEmpty(correlationId)) { options.CorrelationId = correlationId; options.CorrelationIdFromRoute = true; @@ -129,7 +129,7 @@ public async Task IndexFilterPOST(AuditTrailIndexOptions options) { await _auditTrailOptionsDisplayManager.UpdateEditorAsync(options, _updateModelAccessor.ModelUpdater, false, "", ""); // When the user has typed something into the search input no further evaluation of the form post is required. - if (!String.Equals(options.SearchText, options.OriginalSearchText, StringComparison.OrdinalIgnoreCase)) + if (!string.Equals(options.SearchText, options.OriginalSearchText, StringComparison.OrdinalIgnoreCase)) { return RedirectToAction(nameof(Index), new RouteValueDictionary { { "q", options.SearchText } }); } diff --git a/src/OrchardCore.Modules/OrchardCore.AuditTrail/Navigation/AuditTrailAdminMenu.cs b/src/OrchardCore.Modules/OrchardCore.AuditTrail/Navigation/AuditTrailAdminMenu.cs index 0b7bb692d07..8df6344cd12 100644 --- a/src/OrchardCore.Modules/OrchardCore.AuditTrail/Navigation/AuditTrailAdminMenu.cs +++ b/src/OrchardCore.Modules/OrchardCore.AuditTrail/Navigation/AuditTrailAdminMenu.cs @@ -17,7 +17,7 @@ public AuditTrailAdminMenu(IStringLocalizer stringLocalizer public Task BuildNavigationAsync(string name, NavigationBuilder builder) { - if (!String.Equals(name, "admin", StringComparison.OrdinalIgnoreCase)) + if (!string.Equals(name, "admin", StringComparison.OrdinalIgnoreCase)) { return Task.CompletedTask; } diff --git a/src/OrchardCore.Modules/OrchardCore.AuditTrail/Navigation/AuditTrailSettingsAdminMenu.cs b/src/OrchardCore.Modules/OrchardCore.AuditTrail/Navigation/AuditTrailSettingsAdminMenu.cs index 5ee672015b0..1ffa49a4c44 100644 --- a/src/OrchardCore.Modules/OrchardCore.AuditTrail/Navigation/AuditTrailSettingsAdminMenu.cs +++ b/src/OrchardCore.Modules/OrchardCore.AuditTrail/Navigation/AuditTrailSettingsAdminMenu.cs @@ -17,7 +17,7 @@ public AuditTrailSettingsAdminMenu(IStringLocalizer public Task BuildNavigationAsync(string name, NavigationBuilder builder) { - if (!String.Equals(name, "admin", StringComparison.OrdinalIgnoreCase)) + if (!string.Equals(name, "admin", StringComparison.OrdinalIgnoreCase)) { return Task.CompletedTask; } diff --git a/src/OrchardCore.Modules/OrchardCore.AuditTrail/Services/AuditTrailManager.cs b/src/OrchardCore.Modules/OrchardCore.AuditTrail/Services/AuditTrailManager.cs index 97e0270d3db..aa0ef3f4450 100644 --- a/src/OrchardCore.Modules/OrchardCore.AuditTrail/Services/AuditTrailManager.cs +++ b/src/OrchardCore.Modules/OrchardCore.AuditTrail/Services/AuditTrailManager.cs @@ -62,7 +62,7 @@ public AuditTrailManager( public async Task RecordEventAsync(AuditTrailContext context) where TEvent : class, new() { - if (_shellSettings.IsInitializing() && String.IsNullOrEmpty(context.UserName)) + if (_shellSettings.IsInitializing() && string.IsNullOrEmpty(context.UserName)) { var feature = _httpContextAccessor.HttpContext.Features.Get(); if (feature != null && feature.Properties.TryGetValue(SetupConstants.AdminUsername, out var adminUsername)) @@ -96,8 +96,8 @@ public AuditTrailManager( CorrelationId = createContext.CorrelationId, UserId = createContext.UserId, UserName = createContext.UserName ?? "", - NormalizedUserName = String.IsNullOrEmpty(createContext.UserName) ? "" : _keyNormalizer.NormalizeName(createContext.UserName), - ClientIpAddress = String.IsNullOrEmpty(createContext.ClientIpAddress) + NormalizedUserName = string.IsNullOrEmpty(createContext.UserName) ? "" : _keyNormalizer.NormalizeName(createContext.UserName), + ClientIpAddress = string.IsNullOrEmpty(createContext.ClientIpAddress) ? await GetClientIpAddressAsync() : createContext.ClientIpAddress, CreatedUtc = createContext.CreatedUtc ?? _clock.UtcNow diff --git a/src/OrchardCore.Modules/OrchardCore.AuditTrail/Services/CorrelationIdFilterNode.cs b/src/OrchardCore.Modules/OrchardCore.AuditTrail/Services/CorrelationIdFilterNode.cs index 662afd4861c..b81a08386a1 100644 --- a/src/OrchardCore.Modules/OrchardCore.AuditTrail/Services/CorrelationIdFilterNode.cs +++ b/src/OrchardCore.Modules/OrchardCore.AuditTrail/Services/CorrelationIdFilterNode.cs @@ -13,9 +13,9 @@ public class CorrelationIdFilterNode : TermOperationNode } public override string ToNormalizedString() - => String.Empty; + => string.Empty; public override string ToString() - => String.Empty; + => string.Empty; } } diff --git a/src/OrchardCore.Modules/OrchardCore.AuditTrail/Services/DateTimeParser.cs b/src/OrchardCore.Modules/OrchardCore.AuditTrail/Services/DateTimeParser.cs index cb6f562c3c6..ae0557f8d74 100644 --- a/src/OrchardCore.Modules/OrchardCore.AuditTrail/Services/DateTimeParser.cs +++ b/src/OrchardCore.Modules/OrchardCore.AuditTrail/Services/DateTimeParser.cs @@ -35,7 +35,7 @@ public abstract class OperatorNode : Node public Expression BuildOperation(in BuildExpressionContext context, ConstantExpression constant) { - if (String.IsNullOrEmpty(Operator)) + if (string.IsNullOrEmpty(Operator)) { return constant; } @@ -64,7 +64,7 @@ public override Expression BuildExpression(in BuildExpressionContext context) => BuildOperation(context, Expression.Constant(DateTime.UtcDateTime, typeof(DateTime))); public override string ToString() - => $"{(String.IsNullOrEmpty(Operator) ? String.Empty : Operator)}{DateTime:o}"; + => $"{(string.IsNullOrEmpty(Operator) ? string.Empty : Operator)}{DateTime:o}"; } public class DateNode2 : OperatorNode @@ -80,7 +80,7 @@ public override Expression BuildExpression(in BuildExpressionContext context) => BuildOperation(context, Expression.Constant(DateTime, typeof(DateTime))); public override string ToString() - => $"{(String.IsNullOrEmpty(Operator) ? String.Empty : Operator)}{DateTime:o}"; + => $"{(string.IsNullOrEmpty(Operator) ? string.Empty : Operator)}{DateTime:o}"; } public class NowNode : OperatorNode @@ -99,7 +99,7 @@ public override Expression BuildExpression(in BuildExpressionContext context) => BuildOperation(context, Expression.Constant(context.UtcNow.AddDays(Arithmetic.GetValueOrDefault()), typeof(DateTime))); public override string ToString() - => $"{(String.IsNullOrEmpty(Operator) ? String.Empty : Operator)}@now{(Arithmetic.HasValue ? Arithmetic.Value.ToString() : String.Empty)}"; + => $"{(string.IsNullOrEmpty(Operator) ? string.Empty : Operator)}@now{(Arithmetic.HasValue ? Arithmetic.Value.ToString() : string.Empty)}"; } public class TodayNode : NowNode @@ -113,7 +113,7 @@ public TodayNode(long arithmetic) : base(arithmetic) } public override string ToString() - => $"{(String.IsNullOrEmpty(Operator) ? String.Empty : Operator)}@today{(Arithmetic.HasValue ? Arithmetic.Value.ToString() : String.Empty)}"; + => $"{(string.IsNullOrEmpty(Operator) ? string.Empty : Operator)}@today{(Arithmetic.HasValue ? Arithmetic.Value.ToString() : string.Empty)}"; } diff --git a/src/OrchardCore.Modules/OrchardCore.AuditTrail/Services/DefaultAuditTrailAdminListFilterProvider.cs b/src/OrchardCore.Modules/OrchardCore.AuditTrail/Services/DefaultAuditTrailAdminListFilterProvider.cs index 960f0a337a6..768c13e9969 100644 --- a/src/OrchardCore.Modules/OrchardCore.AuditTrail/Services/DefaultAuditTrailAdminListFilterProvider.cs +++ b/src/OrchardCore.Modules/OrchardCore.AuditTrail/Services/DefaultAuditTrailAdminListFilterProvider.cs @@ -32,7 +32,7 @@ public void Build(QueryEngineBuilder builder) .WithNamedTerm("id", builder => builder .OneCondition((val, query) => { - if (!String.IsNullOrEmpty(val)) + if (!string.IsNullOrEmpty(val)) { query.With(x => x.CorrelationId == val); } @@ -45,17 +45,17 @@ public void Build(QueryEngineBuilder builder) }) .MapFrom((model) => { - if (!String.IsNullOrEmpty(model.CorrelationId)) + if (!string.IsNullOrEmpty(model.CorrelationId)) { return (true, model.CorrelationId); } - return (false, String.Empty); + return (false, string.Empty); }) ) .WithNamedTerm("category", builder => builder .OneCondition((val, query) => { - if (!String.IsNullOrEmpty(val)) + if (!string.IsNullOrEmpty(val)) { query.With(x => x.Category == val); } @@ -68,17 +68,17 @@ public void Build(QueryEngineBuilder builder) }) .MapFrom((model) => { - if (!String.IsNullOrEmpty(model.Category)) + if (!string.IsNullOrEmpty(model.Category)) { return (true, model.Category); } - return (false, String.Empty); + return (false, string.Empty); }) ) .WithNamedTerm("event", builder => builder .OneCondition((val, query) => { - if (!String.IsNullOrEmpty(val)) + if (!string.IsNullOrEmpty(val)) { query.With(x => x.Name == val); } @@ -91,17 +91,17 @@ public void Build(QueryEngineBuilder builder) }) .MapFrom((model) => { - if (!String.IsNullOrEmpty(model.Event)) + if (!string.IsNullOrEmpty(model.Event)) { return (true, model.Event); } - return (false, String.Empty); + return (false, string.Empty); }) ) .WithNamedTerm("date", builder => builder .OneCondition(async (val, query, ctx) => { - if (String.IsNullOrEmpty(val)) + if (string.IsNullOrEmpty(val)) { return query; } @@ -131,11 +131,11 @@ public void Build(QueryEngineBuilder builder) }) .MapFrom((model) => { - if (!String.IsNullOrEmpty(model.Date)) + if (!string.IsNullOrEmpty(model.Date)) { return (true, model.Date); } - return (false, String.Empty); + return (false, string.Empty); }) ) .WithNamedTerm("sort", builder => builder @@ -154,7 +154,7 @@ public void Build(QueryEngineBuilder builder) .MapTo((val, model) => { // TODO add a context property to the mapping func. - if (!String.IsNullOrEmpty(val) && _options.Value.SortOptions.TryGetValue(val, out var sortOption)) + if (!string.IsNullOrEmpty(val) && _options.Value.SortOptions.TryGetValue(val, out var sortOption)) { model.Sort = sortOption.Value; } @@ -167,7 +167,7 @@ public void Build(QueryEngineBuilder builder) return (true, model.Sort); } - return (false, String.Empty); + return (false, string.Empty); }) .AlwaysRun() ) diff --git a/src/OrchardCore.Modules/OrchardCore.AuditTrail/Services/DefaultAuditTrailAdminListQueryService.cs b/src/OrchardCore.Modules/OrchardCore.AuditTrail/Services/DefaultAuditTrailAdminListQueryService.cs index ec6e14fdbf0..3982d5a5158 100644 --- a/src/OrchardCore.Modules/OrchardCore.AuditTrail/Services/DefaultAuditTrailAdminListQueryService.cs +++ b/src/OrchardCore.Modules/OrchardCore.AuditTrail/Services/DefaultAuditTrailAdminListQueryService.cs @@ -75,7 +75,7 @@ public async Task QueryAsync(int page, int pageSize, .Select(category => new SelectListItem(category.LocalizedName(_serviceProvider), category.Name, category.Name == options.Category)) .ToList(); - options.Categories.Insert(0, new SelectListItem(S["All categories"], String.Empty, String.IsNullOrEmpty(options.Category))); + options.Categories.Insert(0, new SelectListItem(S["All categories"], string.Empty, string.IsNullOrEmpty(options.Category))); if (options.CorrelationIdFromRoute) { @@ -95,7 +95,7 @@ public async Task QueryAsync(int page, int pageSize, var startOfWeek = CultureInfo.CurrentUICulture.DateTimeFormat.FirstDayOfWeek; options.AuditTrailDates = new List() { - new SelectListItem(S["Any date"], String.Empty, options.Date == String.Empty), + new SelectListItem(S["Any date"], string.Empty, options.Date == string.Empty), }; var dateTimeValue = ">@now-1"; diff --git a/src/OrchardCore.Modules/OrchardCore.AuditTrail/Startup.cs b/src/OrchardCore.Modules/OrchardCore.AuditTrail/Startup.cs index 86ef4b35cba..bcb73334e87 100644 --- a/src/OrchardCore.Modules/OrchardCore.AuditTrail/Startup.cs +++ b/src/OrchardCore.Modules/OrchardCore.AuditTrail/Startup.cs @@ -91,7 +91,7 @@ public override void ConfigureServices(IServiceCollection services) options .ForSort("time-desc", b => b .WithQuery((val, query) => query.With().OrderByDescending(i => i.CreatedUtc)) - .WithSelectListItem((S, opt, model) => new SelectListItem(S["Newest"], opt.Value, model.Sort == String.Empty)) + .WithSelectListItem((S, opt, model) => new SelectListItem(S["Newest"], opt.Value, model.Sort == string.Empty)) .AsDefault()) .ForSort("time-asc", b => b diff --git a/src/OrchardCore.Modules/OrchardCore.AutoSetup/Options/AutoSetupOptions.cs b/src/OrchardCore.Modules/OrchardCore.AutoSetup/Options/AutoSetupOptions.cs index ae1ff68c77a..ef790237b3f 100644 --- a/src/OrchardCore.Modules/OrchardCore.AutoSetup/Options/AutoSetupOptions.cs +++ b/src/OrchardCore.Modules/OrchardCore.AutoSetup/Options/AutoSetupOptions.cs @@ -38,7 +38,7 @@ public class AutoSetupOptions : IValidatableObject /// The collection of errors. public IEnumerable Validate(ValidationContext validationContext) { - if (!String.IsNullOrWhiteSpace(AutoSetupPath) && !AutoSetupPath.StartsWith("/")) + if (!string.IsNullOrWhiteSpace(AutoSetupPath) && !AutoSetupPath.StartsWith("/")) { yield return new ValidationResult($"The field '{nameof(AutoSetupPath)}' should be empty or start with '/'."); } diff --git a/src/OrchardCore.Modules/OrchardCore.AutoSetup/Options/TenantSetupOptions.cs b/src/OrchardCore.Modules/OrchardCore.AutoSetup/Options/TenantSetupOptions.cs index 19add68e15e..a880d1b49c9 100644 --- a/src/OrchardCore.Modules/OrchardCore.AutoSetup/Options/TenantSetupOptions.cs +++ b/src/OrchardCore.Modules/OrchardCore.AutoSetup/Options/TenantSetupOptions.cs @@ -101,7 +101,7 @@ public class TenantSetupOptions /// The collection of errors. public virtual IEnumerable Validate(ValidationContext validationContext) { - if (String.IsNullOrEmpty(ShellName) || !Regex.IsMatch(ShellName, @"^\w+$")) + if (string.IsNullOrEmpty(ShellName) || !Regex.IsMatch(ShellName, @"^\w+$")) { yield return new ValidationResult("ShellName Can not be empty and must contain characters only and no spaces."); } @@ -111,50 +111,50 @@ public virtual IEnumerable Validate(ValidationContext validati yield return new ValidationResult("The tenant name is in conflict with the 'Default' tenant name."); } - if (!String.IsNullOrWhiteSpace(RequestUrlPrefix) && RequestUrlPrefix.Contains('/')) + if (!string.IsNullOrWhiteSpace(RequestUrlPrefix) && RequestUrlPrefix.Contains('/')) { yield return new ValidationResult("The RequestUrlPrefix can not contain more than one segment."); } - if (String.IsNullOrWhiteSpace(SiteName)) + if (string.IsNullOrWhiteSpace(SiteName)) { - yield return new ValidationResult(String.Format(_requiredErrorMessageFormat, nameof(SiteName))); + yield return new ValidationResult(string.Format(_requiredErrorMessageFormat, nameof(SiteName))); } - if (String.IsNullOrWhiteSpace(AdminUsername)) + if (string.IsNullOrWhiteSpace(AdminUsername)) { - yield return new ValidationResult(String.Format(_requiredErrorMessageFormat, nameof(AdminUsername))); + yield return new ValidationResult(string.Format(_requiredErrorMessageFormat, nameof(AdminUsername))); } - if (String.IsNullOrWhiteSpace(AdminEmail)) + if (string.IsNullOrWhiteSpace(AdminEmail)) { - yield return new ValidationResult(String.Format(_requiredErrorMessageFormat, nameof(AdminEmail))); + yield return new ValidationResult(string.Format(_requiredErrorMessageFormat, nameof(AdminEmail))); } - if (String.IsNullOrWhiteSpace(AdminPassword)) + if (string.IsNullOrWhiteSpace(AdminPassword)) { - yield return new ValidationResult(String.Format(_requiredErrorMessageFormat, nameof(AdminPassword))); + yield return new ValidationResult(string.Format(_requiredErrorMessageFormat, nameof(AdminPassword))); } var selectedProvider = validationContext.GetServices().FirstOrDefault(x => x.Value == DatabaseProvider); if (selectedProvider == null) { - yield return new ValidationResult(String.Format(_requiredErrorMessageFormat, nameof(DatabaseProvider))); + yield return new ValidationResult(string.Format(_requiredErrorMessageFormat, nameof(DatabaseProvider))); } - if (selectedProvider != null && selectedProvider.HasConnectionString && String.IsNullOrWhiteSpace(DatabaseConnectionString)) + if (selectedProvider != null && selectedProvider.HasConnectionString && string.IsNullOrWhiteSpace(DatabaseConnectionString)) { - yield return new ValidationResult(String.Format(_requiredErrorMessageFormat, nameof(DatabaseConnectionString))); + yield return new ValidationResult(string.Format(_requiredErrorMessageFormat, nameof(DatabaseConnectionString))); } - if (String.IsNullOrWhiteSpace(RecipeName)) + if (string.IsNullOrWhiteSpace(RecipeName)) { - yield return new ValidationResult(String.Format(_requiredErrorMessageFormat, nameof(RecipeName))); + yield return new ValidationResult(string.Format(_requiredErrorMessageFormat, nameof(RecipeName))); } - if (String.IsNullOrWhiteSpace(SiteTimeZone)) + if (string.IsNullOrWhiteSpace(SiteTimeZone)) { - yield return new ValidationResult(String.Format(_requiredErrorMessageFormat, nameof(SiteTimeZone))); + yield return new ValidationResult(string.Format(_requiredErrorMessageFormat, nameof(SiteTimeZone))); } } } diff --git a/src/OrchardCore.Modules/OrchardCore.AutoSetup/Startup.cs b/src/OrchardCore.Modules/OrchardCore.AutoSetup/Startup.cs index f36700afedc..5ab8fd246ae 100644 --- a/src/OrchardCore.Modules/OrchardCore.AutoSetup/Startup.cs +++ b/src/OrchardCore.Modules/OrchardCore.AutoSetup/Startup.cs @@ -106,7 +106,7 @@ public override void Configure(IApplicationBuilder app, IEndpointRouteBuilder ro _logger.LogError("AutoSetup did not start, configuration has following errors: {errors}", stringBuilder.ToString()); } - else if (String.IsNullOrWhiteSpace(options.AutoSetupPath)) + else if (string.IsNullOrWhiteSpace(options.AutoSetupPath)) { app.UseMiddleware(); } diff --git a/src/OrchardCore.Modules/OrchardCore.Autoroute/Drivers/AutoroutePartDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.Autoroute/Drivers/AutoroutePartDisplayDriver.cs index 74a6f975a08..aa5c62d6a44 100644 --- a/src/OrchardCore.Modules/OrchardCore.Autoroute/Drivers/AutoroutePartDisplayDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Autoroute/Drivers/AutoroutePartDisplayDriver.cs @@ -60,12 +60,12 @@ public override IDisplayResult Edit(AutoroutePart autoroutePart, BuildPartEditor if (homeRoute != null && homeRoute.TryGetValue(_options.ContainedContentItemIdKey, out var containedContentItemId)) { - if (String.Equals(autoroutePart.ContentItem.ContentItemId, containedContentItemId.ToString(), StringComparison.OrdinalIgnoreCase)) + if (string.Equals(autoroutePart.ContentItem.ContentItemId, containedContentItemId.ToString(), StringComparison.OrdinalIgnoreCase)) { model.IsHomepage = true; } } - else if (String.Equals(autoroutePart.ContentItem.ContentItemId, homeRoute?[_options.ContentItemIdKey]?.ToString(), StringComparison.OrdinalIgnoreCase)) + else if (string.Equals(autoroutePart.ContentItem.ContentItemId, homeRoute?[_options.ContentItemIdKey]?.ToString(), StringComparison.OrdinalIgnoreCase)) { model.IsHomepage = true; } @@ -114,7 +114,7 @@ public override async Task UpdateAsync(AutoroutePart model, IUpd updater.ModelState.BindValidationResults(Prefix, model.ValidatePathFieldValue(S)); // This can only validate the path if the Autoroute is not managing content item routes or the path is absolute. - if (!String.IsNullOrEmpty(model.Path) && (!settings.ManageContainedItemRoutes || (settings.ManageContainedItemRoutes && model.Absolute))) + if (!string.IsNullOrEmpty(model.Path) && (!settings.ManageContainedItemRoutes || (settings.ManageContainedItemRoutes && model.Absolute))) { var path = model.Path.Trim('/'); var paths = new string[] { path, "/" + path, path + "/", "/" + path + "/" }; diff --git a/src/OrchardCore.Modules/OrchardCore.Autoroute/Handlers/AutoroutePartHandler.cs b/src/OrchardCore.Modules/OrchardCore.Autoroute/Handlers/AutoroutePartHandler.cs index 8d92d939c58..c74b245a37d 100644 --- a/src/OrchardCore.Modules/OrchardCore.Autoroute/Handlers/AutoroutePartHandler.cs +++ b/src/OrchardCore.Modules/OrchardCore.Autoroute/Handlers/AutoroutePartHandler.cs @@ -64,7 +64,7 @@ public AutoroutePartHandler( public override async Task PublishedAsync(PublishContentContext context, AutoroutePart part) { - if (!String.IsNullOrWhiteSpace(part.Path)) + if (!string.IsNullOrWhiteSpace(part.Path)) { if (part.RouteContainedItems) { @@ -77,7 +77,7 @@ public override async Task PublishedAsync(PublishContentContext context, Autorou await _entries.UpdateEntriesAsync(); } - if (!String.IsNullOrWhiteSpace(part.Path) && !part.Disabled && part.SetHomepage) + if (!string.IsNullOrWhiteSpace(part.Path) && !part.Disabled && part.SetHomepage) { await SetHomeRouteAsync(part, homeRoute => { @@ -92,7 +92,7 @@ await SetHomeRouteAsync(part, homeRoute => public override async Task UnpublishedAsync(PublishContentContext context, AutoroutePart part) { - if (!String.IsNullOrWhiteSpace(part.Path)) + if (!string.IsNullOrWhiteSpace(part.Path)) { // Update entries from the index table after the session is committed. await _entries.UpdateEntriesAsync(); @@ -104,7 +104,7 @@ public override async Task UnpublishedAsync(PublishContentContext context, Autor public override async Task RemovedAsync(RemoveContentContext context, AutoroutePart part) { - if (!String.IsNullOrWhiteSpace(part.Path) && context.NoActiveVersionLeft) + if (!string.IsNullOrWhiteSpace(part.Path) && context.NoActiveVersionLeft) { // Update entries from the index table after the session is committed. await _entries.UpdateEntriesAsync(); @@ -117,7 +117,7 @@ public override async Task RemovedAsync(RemoveContentContext context, AutorouteP public override async Task ValidatingAsync(ValidateContentContext context, AutoroutePart part) { // Only validate the path if it's not empty. - if (String.IsNullOrWhiteSpace(part.Path)) + if (string.IsNullOrWhiteSpace(part.Path)) { return; } @@ -155,7 +155,7 @@ public override Task GetContentItemAspectAsync(ContentItemAspectContext context, return context.ForAsync(aspect => { var contentTypeDefinition = _contentDefinitionManager.GetTypeDefinition(part.ContentItem.ContentType); - var contentTypePartDefinition = contentTypeDefinition.Parts.FirstOrDefault(x => String.Equals(x.PartDefinition.Name, "AutoroutePart")); + var contentTypePartDefinition = contentTypeDefinition.Parts.FirstOrDefault(x => string.Equals(x.PartDefinition.Name, "AutoroutePart")); var settings = contentTypePartDefinition.GetSettings(); if (settings.ManageContainedItemRoutes) { @@ -228,7 +228,7 @@ await SetHomeRouteAsync(autoroutePart, homeRoute => private async Task GenerateContainedPathsFromPatternAsync(ContentItem contentItem, AutoroutePart part) { // Validate contained content item routes if container has valid path. - if (String.IsNullOrWhiteSpace(part.Path) || !part.RouteContainedItems) + if (string.IsNullOrWhiteSpace(part.Path) || !part.RouteContainedItems) { return; } @@ -337,7 +337,7 @@ private async Task ValidateContainedContentItemRoutesAsync(List private static bool IsRelativePathUnique(List entries, string path, AutoroutePart context) { - var result = !entries.Any(e => context.ContentItem.ContentItemId != e.ContainedContentItemId && String.Equals(e.Path.Trim('/'), path.Trim('/'), StringComparison.OrdinalIgnoreCase)); + var result = !entries.Any(e => context.ContentItem.ContentItemId != e.ContainedContentItemId && string.Equals(e.Path.Trim('/'), path.Trim('/'), StringComparison.OrdinalIgnoreCase)); return result; } @@ -347,7 +347,7 @@ private static string GenerateRelativeUniquePath(List entries, s var unversionedPath = path; var versionSeparatorPosition = path.LastIndexOf('-'); - if (versionSeparatorPosition > -1 && Int32.TryParse(path[versionSeparatorPosition..].TrimStart('-'), out version)) + if (versionSeparatorPosition > -1 && int.TryParse(path[versionSeparatorPosition..].TrimStart('-'), out version)) { unversionedPath = path[..versionSeparatorPosition]; } @@ -375,14 +375,14 @@ private static string GenerateRelativeUniquePath(List entries, s private async Task GenerateContainerPathFromPatternAsync(AutoroutePart part) { // Compute the Path only if it's empty. - if (!String.IsNullOrWhiteSpace(part.Path)) + if (!string.IsNullOrWhiteSpace(part.Path)) { return; } var pattern = GetPattern(part); - if (!String.IsNullOrEmpty(pattern)) + if (!string.IsNullOrEmpty(pattern)) { var model = new AutoroutePartViewModel() { @@ -403,7 +403,7 @@ private async Task GenerateContainerPathFromPatternAsync(AutoroutePart part) new Dictionary() { [nameof(ContentItem)] = new ObjectValue(model.ContentItem) }); } - part.Path = part.Path.Replace("\r", String.Empty).Replace("\n", String.Empty); + part.Path = part.Path.Replace("\r", string.Empty).Replace("\n", string.Empty); if (part.Path?.Length > AutoroutePart.MaxPathLength) { @@ -425,7 +425,7 @@ private async Task GenerateContainerPathFromPatternAsync(AutoroutePart part) private string GetPattern(AutoroutePart part) { var contentTypeDefinition = _contentDefinitionManager.GetTypeDefinition(part.ContentItem.ContentType); - var contentTypePartDefinition = contentTypeDefinition.Parts.FirstOrDefault(x => String.Equals(x.PartDefinition.Name, nameof(AutoroutePart))); + var contentTypePartDefinition = contentTypeDefinition.Parts.FirstOrDefault(x => string.Equals(x.PartDefinition.Name, nameof(AutoroutePart))); var pattern = contentTypePartDefinition.GetSettings().Pattern; return pattern; @@ -437,7 +437,7 @@ private async Task GenerateUniqueAbsolutePathAsync(string path, string c var unversionedPath = path; var versionSeparatorPosition = path.LastIndexOf('-'); - if (versionSeparatorPosition > -1 && Int32.TryParse(path[versionSeparatorPosition..].TrimStart('-'), out version)) + if (versionSeparatorPosition > -1 && int.TryParse(path[versionSeparatorPosition..].TrimStart('-'), out version)) { unversionedPath = path[..versionSeparatorPosition]; } diff --git a/src/OrchardCore.Modules/OrchardCore.Autoroute/Handlers/DefaultRouteContentHandler.cs b/src/OrchardCore.Modules/OrchardCore.Autoroute/Handlers/DefaultRouteContentHandler.cs index 19305014e85..15b030fb10a 100644 --- a/src/OrchardCore.Modules/OrchardCore.Autoroute/Handlers/DefaultRouteContentHandler.cs +++ b/src/OrchardCore.Modules/OrchardCore.Autoroute/Handlers/DefaultRouteContentHandler.cs @@ -20,11 +20,11 @@ public override Task GetContentItemAspectAsync(ContentItemAspectContext context) return context.ForAsync(aspect => { // Only use default aspect if no other handler has set the aspect. - if (String.IsNullOrEmpty(aspect.Path)) + if (string.IsNullOrEmpty(aspect.Path)) { // By default contained route is content item id + display text, if present. var path = context.ContentItem.ContentItemId; - if (!String.IsNullOrEmpty(context.ContentItem.DisplayText)) + if (!string.IsNullOrEmpty(context.ContentItem.DisplayText)) { path = path + "-" + context.ContentItem.DisplayText; } diff --git a/src/OrchardCore.Modules/OrchardCore.Autoroute/Properties/AssemblyInfo.cs b/src/OrchardCore.Modules/OrchardCore.Autoroute/Properties/AssemblyInfo.cs index 0669feb5298..ddedd4fe35c 100644 --- a/src/OrchardCore.Modules/OrchardCore.Autoroute/Properties/AssemblyInfo.cs +++ b/src/OrchardCore.Modules/OrchardCore.Autoroute/Properties/AssemblyInfo.cs @@ -1,4 +1,4 @@ -using System.Reflection; +using System.Reflection; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following diff --git a/src/OrchardCore.Modules/OrchardCore.Autoroute/Razor/AutoroutePartRazorHelperExtensions.cs b/src/OrchardCore.Modules/OrchardCore.Autoroute/Razor/AutoroutePartRazorHelperExtensions.cs index f62a4841c54..b9348f9e2ff 100644 --- a/src/OrchardCore.Modules/OrchardCore.Autoroute/Razor/AutoroutePartRazorHelperExtensions.cs +++ b/src/OrchardCore.Modules/OrchardCore.Autoroute/Razor/AutoroutePartRazorHelperExtensions.cs @@ -18,7 +18,7 @@ public static class AutoroutePartRazorHelperExtensions /// A content item id or null if it was not found. public static async Task GetContentItemIdBySlugAsync(this IOrchardHelper orchardHelper, string slug) { - if (String.IsNullOrEmpty(slug)) + if (string.IsNullOrEmpty(slug)) { return null; } diff --git a/src/OrchardCore.Modules/OrchardCore.Autoroute/Routing/AutorouteValuesAddressScheme.cs b/src/OrchardCore.Modules/OrchardCore.Autoroute/Routing/AutorouteValuesAddressScheme.cs index 69e0d4a4d1a..bcc119c2f6b 100644 --- a/src/OrchardCore.Modules/OrchardCore.Autoroute/Routing/AutorouteValuesAddressScheme.cs +++ b/src/OrchardCore.Modules/OrchardCore.Autoroute/Routing/AutorouteValuesAddressScheme.cs @@ -58,7 +58,7 @@ public IEnumerable FindEndpoints(RouteValuesAddress address) { foreach (var entry in address.ExplicitValues) { - if (String.Equals(entry.Key, _options.ContentItemIdKey, StringComparison.OrdinalIgnoreCase)) + if (string.Equals(entry.Key, _options.ContentItemIdKey, StringComparison.OrdinalIgnoreCase)) { continue; } @@ -89,7 +89,7 @@ private bool Match(RouteValueDictionary explicitValues) { foreach (var entry in _options.GlobalRouteValues) { - if (!String.Equals(explicitValues[entry.Key]?.ToString(), entry.Value?.ToString(), StringComparison.OrdinalIgnoreCase)) + if (!string.Equals(explicitValues[entry.Key]?.ToString(), entry.Value?.ToString(), StringComparison.OrdinalIgnoreCase)) { return false; } diff --git a/src/OrchardCore.Modules/OrchardCore.Autoroute/Settings/AutoroutePartSettingsDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.Autoroute/Settings/AutoroutePartSettingsDisplayDriver.cs index 3c18332de12..29b951d8eb6 100644 --- a/src/OrchardCore.Modules/OrchardCore.Autoroute/Settings/AutoroutePartSettingsDisplayDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Autoroute/Settings/AutoroutePartSettingsDisplayDriver.cs @@ -54,9 +54,9 @@ await context.Updater.TryUpdateModelAsync(model, Prefix, m => m.ManageContainedItemRoutes, m => m.AllowAbsolutePath); - if (!String.IsNullOrEmpty(model.Pattern) && !_templateManager.Validate(model.Pattern, out var errors)) + if (!string.IsNullOrEmpty(model.Pattern) && !_templateManager.Validate(model.Pattern, out var errors)) { - context.Updater.ModelState.AddModelError(nameof(model.Pattern), S["Pattern doesn't contain a valid Liquid expression. Details: {0}", String.Join(" ", errors)]); + context.Updater.ModelState.AddModelError(nameof(model.Pattern), S["Pattern doesn't contain a valid Liquid expression. Details: {0}", string.Join(" ", errors)]); } else { diff --git a/src/OrchardCore.Modules/OrchardCore.BackgroundTasks/AdminMenu.cs b/src/OrchardCore.Modules/OrchardCore.BackgroundTasks/AdminMenu.cs index 38a08c5f752..b09d182d14c 100644 --- a/src/OrchardCore.Modules/OrchardCore.BackgroundTasks/AdminMenu.cs +++ b/src/OrchardCore.Modules/OrchardCore.BackgroundTasks/AdminMenu.cs @@ -13,7 +13,7 @@ public class AdminMenu : INavigationProvider public Task BuildNavigationAsync(string name, NavigationBuilder builder) { - if (!String.Equals(name, "admin", StringComparison.OrdinalIgnoreCase)) + if (!string.Equals(name, "admin", StringComparison.OrdinalIgnoreCase)) { return Task.CompletedTask; } diff --git a/src/OrchardCore.Modules/OrchardCore.BackgroundTasks/Controllers/BackgroundTaskController.cs b/src/OrchardCore.Modules/OrchardCore.BackgroundTasks/Controllers/BackgroundTaskController.cs index ccb43c4937e..0dd2f97c0ba 100644 --- a/src/OrchardCore.Modules/OrchardCore.BackgroundTasks/Controllers/BackgroundTaskController.cs +++ b/src/OrchardCore.Modules/OrchardCore.BackgroundTasks/Controllers/BackgroundTaskController.cs @@ -86,18 +86,18 @@ public async Task Index(AdminIndexOptions options, PagerParameter }; }); - if (!String.IsNullOrWhiteSpace(options.Search)) + if (!string.IsNullOrWhiteSpace(options.Search)) { items = items.Where(entry => entry.Title != null && entry.Title.Contains(options.Search, StringComparison.OrdinalIgnoreCase) || (entry.Description != null && entry.Description.Contains(options.Search, StringComparison.OrdinalIgnoreCase)) ); } - if (String.Equals(options.Status, "enabled", StringComparison.OrdinalIgnoreCase)) + if (string.Equals(options.Status, "enabled", StringComparison.OrdinalIgnoreCase)) { items = items.Where(entry => entry.Enable); } - else if (String.Equals(options.Status, "disabled", StringComparison.OrdinalIgnoreCase)) + else if (string.Equals(options.Status, "disabled", StringComparison.OrdinalIgnoreCase)) { items = items.Where(entry => !entry.Enable); } diff --git a/src/OrchardCore.Modules/OrchardCore.ContentFields/Controllers/ContentPickerAdminController.cs b/src/OrchardCore.Modules/OrchardCore.ContentFields/Controllers/ContentPickerAdminController.cs index c9ec472155e..1ce879f427d 100644 --- a/src/OrchardCore.Modules/OrchardCore.ContentFields/Controllers/ContentPickerAdminController.cs +++ b/src/OrchardCore.Modules/OrchardCore.ContentFields/Controllers/ContentPickerAdminController.cs @@ -29,7 +29,7 @@ IEnumerable resultProviders public async Task SearchContentItems(string part, string field, string query) { - if (String.IsNullOrWhiteSpace(part) || String.IsNullOrWhiteSpace(field)) + if (string.IsNullOrWhiteSpace(part) || string.IsNullOrWhiteSpace(field)) { return BadRequest("Part and field are required parameters"); } diff --git a/src/OrchardCore.Modules/OrchardCore.ContentFields/Controllers/UserPickerAdminController.cs b/src/OrchardCore.Modules/OrchardCore.ContentFields/Controllers/UserPickerAdminController.cs index 216c8d2189e..2ce08072687 100644 --- a/src/OrchardCore.Modules/OrchardCore.ContentFields/Controllers/UserPickerAdminController.cs +++ b/src/OrchardCore.Modules/OrchardCore.ContentFields/Controllers/UserPickerAdminController.cs @@ -40,7 +40,7 @@ IEnumerable resultProviders public async Task SearchUsers(string part, string field, string contentType, string query) { - if (string.IsNullOrWhiteSpace(part) || String.IsNullOrWhiteSpace(field) || string.IsNullOrWhiteSpace(contentType)) + if (string.IsNullOrWhiteSpace(part) || string.IsNullOrWhiteSpace(field) || string.IsNullOrWhiteSpace(contentType)) { return BadRequest("Part, field and contentType are required parameters"); } diff --git a/src/OrchardCore.Modules/OrchardCore.ContentFields/Drivers/ContentPickerFieldDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.ContentFields/Drivers/ContentPickerFieldDisplayDriver.cs index fd1423d6407..67a3fa70c2c 100644 --- a/src/OrchardCore.Modules/OrchardCore.ContentFields/Drivers/ContentPickerFieldDisplayDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.ContentFields/Drivers/ContentPickerFieldDisplayDriver.cs @@ -53,7 +53,7 @@ public override IDisplayResult Edit(ContentPickerField field, BuildFieldEditorCo { return Initialize(GetEditorShapeType(context), async model => { - model.ContentItemIds = String.Join(",", field.ContentItemIds); + model.ContentItemIds = string.Join(",", field.ContentItemIds); model.Field = field; model.Part = context.ContentPart; diff --git a/src/OrchardCore.Modules/OrchardCore.ContentFields/Drivers/HtmlFieldDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.ContentFields/Drivers/HtmlFieldDisplayDriver.cs index 0bf06e1b205..fd9e9f4cdd8 100644 --- a/src/OrchardCore.Modules/OrchardCore.ContentFields/Drivers/HtmlFieldDisplayDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.ContentFields/Drivers/HtmlFieldDisplayDriver.cs @@ -88,14 +88,14 @@ public override async Task UpdateAsync(HtmlField field, IUpdateM if (await updater.TryUpdateModelAsync(viewModel, Prefix, f => f.Html)) { - if (!String.IsNullOrEmpty(viewModel.Html) && !_liquidTemplateManager.Validate(viewModel.Html, out var errors)) + if (!string.IsNullOrEmpty(viewModel.Html) && !_liquidTemplateManager.Validate(viewModel.Html, out var errors)) { var fieldName = context.PartFieldDefinition.DisplayName(); context.Updater.ModelState.AddModelError( Prefix, nameof(viewModel.Html), S["{0} doesn't contain a valid Liquid expression. Details: {1}", fieldName, - String.Join(' ', errors)]); + string.Join(' ', errors)]); } else { diff --git a/src/OrchardCore.Modules/OrchardCore.ContentFields/Drivers/LinkFieldDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.ContentFields/Drivers/LinkFieldDisplayDriver.cs index 9db36504645..37dc4529e8e 100644 --- a/src/OrchardCore.Modules/OrchardCore.ContentFields/Drivers/LinkFieldDisplayDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.ContentFields/Drivers/LinkFieldDisplayDriver.cs @@ -74,7 +74,7 @@ public override async Task UpdateAsync(LinkField field, IUpdateM var settings = context.PartFieldDefinition.GetSettings(); var urlToValidate = field.Url; - if (!String.IsNullOrEmpty(urlToValidate)) + if (!string.IsNullOrEmpty(urlToValidate)) { var indexAnchor = urlToValidate.IndexOf('#'); if (indexAnchor > -1) @@ -92,11 +92,11 @@ public override async Task UpdateAsync(LinkField field, IUpdateM } // Validate Url - if (settings.Required && String.IsNullOrWhiteSpace(field.Url)) + if (settings.Required && string.IsNullOrWhiteSpace(field.Url)) { updater.ModelState.AddModelError(Prefix, nameof(field.Url), S["The url is required for {0}.", context.PartFieldDefinition.DisplayName()]); } - else if (!String.IsNullOrWhiteSpace(field.Url)) + else if (!string.IsNullOrWhiteSpace(field.Url)) { if (!Uri.IsWellFormedUriString(urlToValidate, UriKind.RelativeOrAbsolute)) { @@ -106,7 +106,7 @@ public override async Task UpdateAsync(LinkField field, IUpdateM { var link = $""; - if (!String.Equals(link, _htmlSanitizerService.Sanitize(link), StringComparison.OrdinalIgnoreCase)) + if (!string.Equals(link, _htmlSanitizerService.Sanitize(link), StringComparison.OrdinalIgnoreCase)) { updater.ModelState.AddModelError(Prefix, nameof(field.Url), S["{0} is an invalid url.", field.Url]); } @@ -114,11 +114,11 @@ public override async Task UpdateAsync(LinkField field, IUpdateM } // Validate Text - if (settings.LinkTextMode == LinkTextMode.Required && String.IsNullOrWhiteSpace(field.Text)) + if (settings.LinkTextMode == LinkTextMode.Required && string.IsNullOrWhiteSpace(field.Text)) { updater.ModelState.AddModelError(Prefix, nameof(field.Text), S["The link text is required for {0}.", context.PartFieldDefinition.DisplayName()]); } - else if (settings.LinkTextMode == LinkTextMode.Static && String.IsNullOrWhiteSpace(settings.DefaultText)) + else if (settings.LinkTextMode == LinkTextMode.Static && string.IsNullOrWhiteSpace(settings.DefaultText)) { updater.ModelState.AddModelError(Prefix, nameof(field.Text), S["The text default value is required for {0}.", context.PartFieldDefinition.DisplayName()]); } diff --git a/src/OrchardCore.Modules/OrchardCore.ContentFields/Drivers/LocalizationSetContentPickerFieldDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.ContentFields/Drivers/LocalizationSetContentPickerFieldDisplayDriver.cs index 81b35b41c86..054dec96e00 100644 --- a/src/OrchardCore.Modules/OrchardCore.ContentFields/Drivers/LocalizationSetContentPickerFieldDisplayDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.ContentFields/Drivers/LocalizationSetContentPickerFieldDisplayDriver.cs @@ -50,7 +50,7 @@ public override IDisplayResult Edit(LocalizationSetContentPickerField field, Bui { return Initialize(GetEditorShapeType(context), async model => { - model.LocalizationSets = String.Join(",", field.LocalizationSets); + model.LocalizationSets = string.Join(",", field.LocalizationSets); model.Field = field; model.Part = context.ContentPart; diff --git a/src/OrchardCore.Modules/OrchardCore.ContentFields/Drivers/NumericFieldDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.ContentFields/Drivers/NumericFieldDisplayDriver.cs index a22c7e3a184..61f63cbef0a 100644 --- a/src/OrchardCore.Modules/OrchardCore.ContentFields/Drivers/NumericFieldDisplayDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.ContentFields/Drivers/NumericFieldDisplayDriver.cs @@ -73,14 +73,14 @@ public override async Task UpdateAsync(NumericField field, IUpda field.Value = null; - if (String.IsNullOrWhiteSpace(viewModel.Value)) + if (string.IsNullOrWhiteSpace(viewModel.Value)) { if (settings.Required) { updater.ModelState.AddModelError(Prefix, nameof(field.Value), S["The {0} field is required.", context.PartFieldDefinition.DisplayName()]); } } - else if (!Decimal.TryParse(viewModel.Value, NumberStyles.Any, CultureInfo.CurrentUICulture, out var value)) + else if (!decimal.TryParse(viewModel.Value, NumberStyles.Any, CultureInfo.CurrentUICulture, out var value)) { updater.ModelState.AddModelError(Prefix, nameof(field.Value), S["{0} is an invalid number.", context.PartFieldDefinition.DisplayName()]); } diff --git a/src/OrchardCore.Modules/OrchardCore.ContentFields/Drivers/TextFieldDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.ContentFields/Drivers/TextFieldDisplayDriver.cs index e062abd3b6a..93e7a5cf7b6 100644 --- a/src/OrchardCore.Modules/OrchardCore.ContentFields/Drivers/TextFieldDisplayDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.ContentFields/Drivers/TextFieldDisplayDriver.cs @@ -51,7 +51,7 @@ public override async Task UpdateAsync(TextField field, IUpdateM if (await updater.TryUpdateModelAsync(field, Prefix, f => f.Text)) { var settings = context.PartFieldDefinition.GetSettings(); - if (settings.Required && String.IsNullOrWhiteSpace(field.Text)) + if (settings.Required && string.IsNullOrWhiteSpace(field.Text)) { updater.ModelState.AddModelError(Prefix, nameof(field.Text), S["A value is required for {0}.", context.PartFieldDefinition.DisplayName()]); } diff --git a/src/OrchardCore.Modules/OrchardCore.ContentFields/Drivers/UserPickerFieldDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.ContentFields/Drivers/UserPickerFieldDisplayDriver.cs index 333f8286222..cd740cef130 100644 --- a/src/OrchardCore.Modules/OrchardCore.ContentFields/Drivers/UserPickerFieldDisplayDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.ContentFields/Drivers/UserPickerFieldDisplayDriver.cs @@ -47,7 +47,7 @@ public override IDisplayResult Edit(UserPickerField field, BuildFieldEditorConte { return Initialize(GetEditorShapeType(context), async model => { - model.UserIds = String.Join(",", field.UserIds); + model.UserIds = string.Join(",", field.UserIds); model.Field = field; model.Part = context.ContentPart; @@ -57,7 +57,7 @@ public override IDisplayResult Edit(UserPickerField field, BuildFieldEditorConte if (field.UserIds.Length > 0) { var users = (await _session.Query().Where(x => x.UserId.IsIn(field.UserIds)).ListAsync()) - .OrderBy(o => Array.FindIndex(field.UserIds, x => String.Equals(o.UserId, x, StringComparison.OrdinalIgnoreCase))); + .OrderBy(o => Array.FindIndex(field.UserIds, x => string.Equals(o.UserId, x, StringComparison.OrdinalIgnoreCase))); foreach (var user in users) { diff --git a/src/OrchardCore.Modules/OrchardCore.ContentFields/Drivers/YoutubeFieldDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.ContentFields/Drivers/YoutubeFieldDisplayDriver.cs index 33354154bf5..83bbe74cee3 100644 --- a/src/OrchardCore.Modules/OrchardCore.ContentFields/Drivers/YoutubeFieldDisplayDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.ContentFields/Drivers/YoutubeFieldDisplayDriver.cs @@ -54,7 +54,7 @@ public override async Task UpdateAsync(YoutubeField field, IUpda if (await updater.TryUpdateModelAsync(model, Prefix)) { var settings = context.PartFieldDefinition.GetSettings(); - if (settings.Required && String.IsNullOrWhiteSpace(model.RawAddress)) + if (settings.Required && string.IsNullOrWhiteSpace(model.RawAddress)) { updater.ModelState.AddModelError(Prefix, nameof(model.RawAddress), S["A value is required for '{0}'.", context.PartFieldDefinition.DisplayName()]); } @@ -65,7 +65,7 @@ public override async Task UpdateAsync(YoutubeField field, IUpda var uri = new Uri(model.RawAddress); // If it is a url with QueryString. - if (!String.IsNullOrWhiteSpace(uri.Query)) + if (!string.IsNullOrWhiteSpace(uri.Query)) { var query = QueryHelpers.ParseQuery(uri.Query); if (query.TryGetValue("v", out var values)) diff --git a/src/OrchardCore.Modules/OrchardCore.ContentFields/Extensions/ContentPartFieldDefinitionExtensions.cs b/src/OrchardCore.Modules/OrchardCore.ContentFields/Extensions/ContentPartFieldDefinitionExtensions.cs index 5d642b7ec30..143688b62ba 100644 --- a/src/OrchardCore.Modules/OrchardCore.ContentFields/Extensions/ContentPartFieldDefinitionExtensions.cs +++ b/src/OrchardCore.Modules/OrchardCore.ContentFields/Extensions/ContentPartFieldDefinitionExtensions.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using Newtonsoft.Json.Linq; namespace OrchardCore.ContentManagement.Metadata.Models; diff --git a/src/OrchardCore.Modules/OrchardCore.ContentFields/Fields/BooleanField.cs b/src/OrchardCore.Modules/OrchardCore.ContentFields/Fields/BooleanField.cs index 20c201c7476..4952fa7f69f 100644 --- a/src/OrchardCore.Modules/OrchardCore.ContentFields/Fields/BooleanField.cs +++ b/src/OrchardCore.Modules/OrchardCore.ContentFields/Fields/BooleanField.cs @@ -1,4 +1,4 @@ -using OrchardCore.ContentManagement; +using OrchardCore.ContentManagement; namespace OrchardCore.ContentFields.Fields { diff --git a/src/OrchardCore.Modules/OrchardCore.ContentFields/Fields/HtmlField.cs b/src/OrchardCore.Modules/OrchardCore.ContentFields/Fields/HtmlField.cs index 67b307a9640..fd25e7388a5 100644 --- a/src/OrchardCore.Modules/OrchardCore.ContentFields/Fields/HtmlField.cs +++ b/src/OrchardCore.Modules/OrchardCore.ContentFields/Fields/HtmlField.cs @@ -1,4 +1,4 @@ -using OrchardCore.ContentManagement; +using OrchardCore.ContentManagement; namespace OrchardCore.ContentFields.Fields { diff --git a/src/OrchardCore.Modules/OrchardCore.ContentFields/Fields/LinkField.cs b/src/OrchardCore.Modules/OrchardCore.ContentFields/Fields/LinkField.cs index e03fe225070..88d15b0bf86 100644 --- a/src/OrchardCore.Modules/OrchardCore.ContentFields/Fields/LinkField.cs +++ b/src/OrchardCore.Modules/OrchardCore.ContentFields/Fields/LinkField.cs @@ -1,4 +1,4 @@ -using OrchardCore.ContentManagement; +using OrchardCore.ContentManagement; namespace OrchardCore.ContentFields.Fields { diff --git a/src/OrchardCore.Modules/OrchardCore.ContentFields/Fields/NumericField.cs b/src/OrchardCore.Modules/OrchardCore.ContentFields/Fields/NumericField.cs index c34435be168..0e9e889f1e6 100644 --- a/src/OrchardCore.Modules/OrchardCore.ContentFields/Fields/NumericField.cs +++ b/src/OrchardCore.Modules/OrchardCore.ContentFields/Fields/NumericField.cs @@ -1,4 +1,4 @@ -using OrchardCore.ContentManagement; +using OrchardCore.ContentManagement; namespace OrchardCore.ContentFields.Fields { diff --git a/src/OrchardCore.Modules/OrchardCore.ContentFields/GraphQL/Types/TimeSpanGraphType.cs b/src/OrchardCore.Modules/OrchardCore.ContentFields/GraphQL/Types/TimeSpanGraphType.cs index bcd8365f7e6..cdad4acf9a2 100644 --- a/src/OrchardCore.Modules/OrchardCore.ContentFields/GraphQL/Types/TimeSpanGraphType.cs +++ b/src/OrchardCore.Modules/OrchardCore.ContentFields/GraphQL/Types/TimeSpanGraphType.cs @@ -21,7 +21,7 @@ public override object Serialize(object value) public override object ParseValue(object value) { var timespan = value?.ToString().StripQuotes(); - return String.IsNullOrWhiteSpace(timespan) + return string.IsNullOrWhiteSpace(timespan) ? null : (TimeSpan?)TimeSpan.Parse(timespan, CultureInfo.CurrentCulture); } @@ -42,7 +42,7 @@ public static class ScalarGraphTypeExtensions { public static string StripQuotes(this string value) { - if (!String.IsNullOrEmpty(value) && value.Length > 2 && value.StartsWith('\"') && value.EndsWith('\"')) + if (!string.IsNullOrEmpty(value) && value.Length > 2 && value.StartsWith('\"') && value.EndsWith('\"')) { return value[1..^1]; } diff --git a/src/OrchardCore.Modules/OrchardCore.ContentFields/Handlers/LinkFieldHandler.cs b/src/OrchardCore.Modules/OrchardCore.ContentFields/Handlers/LinkFieldHandler.cs index 759b8da750b..2fca7f884e4 100644 --- a/src/OrchardCore.Modules/OrchardCore.ContentFields/Handlers/LinkFieldHandler.cs +++ b/src/OrchardCore.Modules/OrchardCore.ContentFields/Handlers/LinkFieldHandler.cs @@ -39,7 +39,7 @@ public override Task ValidatingAsync(ValidateContentFieldContext context, LinkFi var settings = context.ContentPartFieldDefinition.GetSettings(); var urlToValidate = field.Url; - if (!String.IsNullOrEmpty(urlToValidate)) + if (!string.IsNullOrEmpty(urlToValidate)) { var indexAnchor = urlToValidate.IndexOf('#'); if (indexAnchor > -1) @@ -57,11 +57,11 @@ public override Task ValidatingAsync(ValidateContentFieldContext context, LinkFi } // Validate Url - if (settings.Required && String.IsNullOrWhiteSpace(field.Url)) + if (settings.Required && string.IsNullOrWhiteSpace(field.Url)) { context.Fail(S["The url is required for {0}.", context.ContentPartFieldDefinition.DisplayName()], nameof(field.Url)); } - else if (!String.IsNullOrWhiteSpace(field.Url)) + else if (!string.IsNullOrWhiteSpace(field.Url)) { if (!Uri.IsWellFormedUriString(urlToValidate, UriKind.RelativeOrAbsolute)) { @@ -71,18 +71,18 @@ public override Task ValidatingAsync(ValidateContentFieldContext context, LinkFi { var link = $""; - if (!String.Equals(link, _htmlSanitizerService.Sanitize(link), StringComparison.OrdinalIgnoreCase)) + if (!string.Equals(link, _htmlSanitizerService.Sanitize(link), StringComparison.OrdinalIgnoreCase)) { context.Fail(S["{0} is an invalid url.", field.Url], nameof(field.Url)); } } } - if (settings.LinkTextMode == LinkTextMode.Required && String.IsNullOrWhiteSpace(field.Text)) + if (settings.LinkTextMode == LinkTextMode.Required && string.IsNullOrWhiteSpace(field.Text)) { context.Fail(S["The link text is required for {0}.", context.ContentPartFieldDefinition.DisplayName()], nameof(field.Text)); } - else if (settings.LinkTextMode == LinkTextMode.Static && String.IsNullOrWhiteSpace(settings.DefaultText)) + else if (settings.LinkTextMode == LinkTextMode.Static && string.IsNullOrWhiteSpace(settings.DefaultText)) { context.Fail(S["The text default value is required for {0}.", context.ContentPartFieldDefinition.DisplayName()], nameof(field.Text)); } diff --git a/src/OrchardCore.Modules/OrchardCore.ContentFields/Handlers/TextFieldHandler.cs b/src/OrchardCore.Modules/OrchardCore.ContentFields/Handlers/TextFieldHandler.cs index 757f35c38f8..e5a12e2874a 100644 --- a/src/OrchardCore.Modules/OrchardCore.ContentFields/Handlers/TextFieldHandler.cs +++ b/src/OrchardCore.Modules/OrchardCore.ContentFields/Handlers/TextFieldHandler.cs @@ -21,7 +21,7 @@ public override Task ValidatingAsync(ValidateContentFieldContext context, TextFi { var settings = context.ContentPartFieldDefinition.GetSettings(); - if (settings.Required && String.IsNullOrWhiteSpace(field.Text)) + if (settings.Required && string.IsNullOrWhiteSpace(field.Text)) { context.Fail(S["A value is required for {0}.", context.ContentPartFieldDefinition.DisplayName()], nameof(field.Text)); } diff --git a/src/OrchardCore.Modules/OrchardCore.ContentFields/Handlers/YoutubeFieldHandler.cs b/src/OrchardCore.Modules/OrchardCore.ContentFields/Handlers/YoutubeFieldHandler.cs index 6bfb3d8afc4..a90a3c56210 100644 --- a/src/OrchardCore.Modules/OrchardCore.ContentFields/Handlers/YoutubeFieldHandler.cs +++ b/src/OrchardCore.Modules/OrchardCore.ContentFields/Handlers/YoutubeFieldHandler.cs @@ -22,7 +22,7 @@ public override Task ValidatingAsync(ValidateContentFieldContext context, Youtub { var settings = context.ContentPartFieldDefinition.GetSettings(); - if (settings.Required && String.IsNullOrWhiteSpace(field.RawAddress)) + if (settings.Required && string.IsNullOrWhiteSpace(field.RawAddress)) { context.Fail(S["A value is required for '{0}'.", context.ContentPartFieldDefinition.DisplayName()], nameof(field.RawAddress)); } @@ -32,7 +32,7 @@ public override Task ValidatingAsync(ValidateContentFieldContext context, Youtub var uri = new Uri(field.RawAddress); // if it is a url with QueryString - if (!String.IsNullOrWhiteSpace(uri.Query)) + if (!string.IsNullOrWhiteSpace(uri.Query)) { var query = QueryHelpers.ParseQuery(uri.Query); if (!query.ContainsKey("v")) diff --git a/src/OrchardCore.Modules/OrchardCore.ContentFields/Indexing/BooleanFieldIndexHandler.cs b/src/OrchardCore.Modules/OrchardCore.ContentFields/Indexing/BooleanFieldIndexHandler.cs index 0334ac7ced7..b44eeb0b0f8 100644 --- a/src/OrchardCore.Modules/OrchardCore.ContentFields/Indexing/BooleanFieldIndexHandler.cs +++ b/src/OrchardCore.Modules/OrchardCore.ContentFields/Indexing/BooleanFieldIndexHandler.cs @@ -1,4 +1,4 @@ -using System.Threading.Tasks; +using System.Threading.Tasks; using OrchardCore.ContentFields.Fields; using OrchardCore.Indexing; diff --git a/src/OrchardCore.Modules/OrchardCore.ContentFields/Indexing/HtmlFieldIndexHandler.cs b/src/OrchardCore.Modules/OrchardCore.ContentFields/Indexing/HtmlFieldIndexHandler.cs index fc7c81cce3f..35c72bba4fe 100644 --- a/src/OrchardCore.Modules/OrchardCore.ContentFields/Indexing/HtmlFieldIndexHandler.cs +++ b/src/OrchardCore.Modules/OrchardCore.ContentFields/Indexing/HtmlFieldIndexHandler.cs @@ -1,4 +1,4 @@ -using System.Threading.Tasks; +using System.Threading.Tasks; using OrchardCore.ContentFields.Fields; using OrchardCore.Indexing; diff --git a/src/OrchardCore.Modules/OrchardCore.ContentFields/Indexing/TextFieldIndexHandler.cs b/src/OrchardCore.Modules/OrchardCore.ContentFields/Indexing/TextFieldIndexHandler.cs index 628468efadf..7d409856d88 100644 --- a/src/OrchardCore.Modules/OrchardCore.ContentFields/Indexing/TextFieldIndexHandler.cs +++ b/src/OrchardCore.Modules/OrchardCore.ContentFields/Indexing/TextFieldIndexHandler.cs @@ -1,4 +1,4 @@ -using System.Threading.Tasks; +using System.Threading.Tasks; using OrchardCore.ContentFields.Fields; using OrchardCore.Indexing; diff --git a/src/OrchardCore.Modules/OrchardCore.ContentFields/Services/DefaultUserPickerResultProvider.cs b/src/OrchardCore.Modules/OrchardCore.ContentFields/Services/DefaultUserPickerResultProvider.cs index bca4617b9d2..991b14886a5 100644 --- a/src/OrchardCore.Modules/OrchardCore.ContentFields/Services/DefaultUserPickerResultProvider.cs +++ b/src/OrchardCore.Modules/OrchardCore.ContentFields/Services/DefaultUserPickerResultProvider.cs @@ -41,7 +41,7 @@ public async Task> Search(UserPickerSearchContext query.With(x => x.RoleName.IsIn(roles)); } - if (!String.IsNullOrEmpty(searchContext.Query)) + if (!string.IsNullOrEmpty(searchContext.Query)) { query.With(x => x.NormalizedUserName.Contains(_userManager.NormalizeName(searchContext.Query))); } diff --git a/src/OrchardCore.Modules/OrchardCore.ContentFields/Settings/ContentPickerFieldSettingsDriver.cs b/src/OrchardCore.Modules/OrchardCore.ContentFields/Settings/ContentPickerFieldSettingsDriver.cs index 2011a9f3367..4ef38efca9d 100644 --- a/src/OrchardCore.Modules/OrchardCore.ContentFields/Settings/ContentPickerFieldSettingsDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.ContentFields/Settings/ContentPickerFieldSettingsDriver.cs @@ -33,7 +33,7 @@ public override IDisplayResult Edit(ContentPartFieldDefinition partFieldDefiniti model.Source = GetSource(settings); model.DisplayedContentTypes = settings.DisplayedContentTypes; model.TitlePattern = settings.TitlePattern; - model.Stereotypes = String.Join(',', settings.DisplayedStereotypes ?? Array.Empty()); + model.Stereotypes = string.Join(',', settings.DisplayedStereotypes ?? Array.Empty()); }).Location("Content"); } @@ -86,7 +86,7 @@ private bool IsValidTitlePattern(UpdatePartFieldEditorContext context, ContentPi private void SetStereoTypes(IUpdateModel updater, string stereotypes, ContentPickerFieldSettings settings) { - if (String.IsNullOrEmpty(stereotypes)) + if (string.IsNullOrEmpty(stereotypes)) { updater.ModelState.AddModelError(Prefix, nameof(ContentPickerFieldSettingsViewModel.Stereotypes), S["Please provide a Stereotype."]); diff --git a/src/OrchardCore.Modules/OrchardCore.ContentFields/Settings/HtmlFieldMonacoEditorSettingsDriver.cs b/src/OrchardCore.Modules/OrchardCore.ContentFields/Settings/HtmlFieldMonacoEditorSettingsDriver.cs index 9ed5a800d3e..56358939740 100644 --- a/src/OrchardCore.Modules/OrchardCore.ContentFields/Settings/HtmlFieldMonacoEditorSettingsDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.ContentFields/Settings/HtmlFieldMonacoEditorSettingsDriver.cs @@ -26,7 +26,7 @@ public override IDisplayResult Edit(ContentPartFieldDefinition partFieldDefiniti return Initialize("HtmlFieldMonacoEditorSettings_Edit", model => { var settings = partFieldDefinition.GetSettings(); - if (String.IsNullOrWhiteSpace(settings.Options)) + if (string.IsNullOrWhiteSpace(settings.Options)) { settings.Options = JsonConvert.SerializeObject(new { automaticLayout = true, language = "html" }, Formatting.Indented); } diff --git a/src/OrchardCore.Modules/OrchardCore.ContentFields/Settings/TextFieldMonacoEditorSettingsDriver.cs b/src/OrchardCore.Modules/OrchardCore.ContentFields/Settings/TextFieldMonacoEditorSettingsDriver.cs index bf69df927e5..1a41e727359 100644 --- a/src/OrchardCore.Modules/OrchardCore.ContentFields/Settings/TextFieldMonacoEditorSettingsDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.ContentFields/Settings/TextFieldMonacoEditorSettingsDriver.cs @@ -25,7 +25,7 @@ public override IDisplayResult Edit(ContentPartFieldDefinition partFieldDefiniti return Initialize("TextFieldMonacoEditorSettings_Edit", model => { var settings = partFieldDefinition.GetSettings(); - if (String.IsNullOrWhiteSpace(settings.Options)) + if (string.IsNullOrWhiteSpace(settings.Options)) { settings.Options = JsonConvert.SerializeObject(new { automaticLayout = true, language = "html" }, Formatting.Indented); } diff --git a/src/OrchardCore.Modules/OrchardCore.ContentFields/Settings/TextFieldPredefinedListEditorSettingsDriver.cs b/src/OrchardCore.Modules/OrchardCore.ContentFields/Settings/TextFieldPredefinedListEditorSettingsDriver.cs index 19254465beb..5cfc017a527 100644 --- a/src/OrchardCore.Modules/OrchardCore.ContentFields/Settings/TextFieldPredefinedListEditorSettingsDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.ContentFields/Settings/TextFieldPredefinedListEditorSettingsDriver.cs @@ -45,7 +45,7 @@ public override async Task UpdateAsync(ContentPartFieldDefinitio { settings.DefaultValue = model.DefaultValue; settings.Editor = model.Editor; - settings.Options = String.IsNullOrWhiteSpace(model.Options) + settings.Options = string.IsNullOrWhiteSpace(model.Options) ? Array.Empty() : JsonConvert.DeserializeObject(model.Options); } diff --git a/src/OrchardCore.Modules/OrchardCore.ContentFields/Startup.cs b/src/OrchardCore.Modules/OrchardCore.ContentFields/Startup.cs index 25951640daa..a101320fddb 100644 --- a/src/OrchardCore.Modules/OrchardCore.ContentFields/Startup.cs +++ b/src/OrchardCore.Modules/OrchardCore.ContentFields/Startup.cs @@ -236,8 +236,8 @@ public override void ConfigureServices(IServiceCollection services) }); services.AddContentField() - .UseDisplayDriver(d => !String.Equals(d, "UserNames", StringComparison.OrdinalIgnoreCase)) - .UseDisplayDriver(d => String.Equals(d, "UserNames", StringComparison.OrdinalIgnoreCase)) + .UseDisplayDriver(d => !string.Equals(d, "UserNames", StringComparison.OrdinalIgnoreCase)) + .UseDisplayDriver(d => string.Equals(d, "UserNames", StringComparison.OrdinalIgnoreCase)) .AddHandler(); services.AddScoped(); diff --git a/src/OrchardCore.Modules/OrchardCore.ContentFields/ViewModels/DisplayBooleanFieldViewModel.cs b/src/OrchardCore.Modules/OrchardCore.ContentFields/ViewModels/DisplayBooleanFieldViewModel.cs index bb617e1d185..068d7b14a9c 100644 --- a/src/OrchardCore.Modules/OrchardCore.ContentFields/ViewModels/DisplayBooleanFieldViewModel.cs +++ b/src/OrchardCore.Modules/OrchardCore.ContentFields/ViewModels/DisplayBooleanFieldViewModel.cs @@ -1,4 +1,4 @@ -using OrchardCore.ContentFields.Fields; +using OrchardCore.ContentFields.Fields; using OrchardCore.ContentManagement; using OrchardCore.ContentManagement.Metadata.Models; diff --git a/src/OrchardCore.Modules/OrchardCore.ContentFields/ViewModels/DisplayLinkFieldViewModel.cs b/src/OrchardCore.Modules/OrchardCore.ContentFields/ViewModels/DisplayLinkFieldViewModel.cs index 56dd8846885..1faf479ff76 100644 --- a/src/OrchardCore.Modules/OrchardCore.ContentFields/ViewModels/DisplayLinkFieldViewModel.cs +++ b/src/OrchardCore.Modules/OrchardCore.ContentFields/ViewModels/DisplayLinkFieldViewModel.cs @@ -1,4 +1,4 @@ -using OrchardCore.ContentFields.Fields; +using OrchardCore.ContentFields.Fields; using OrchardCore.ContentManagement; using OrchardCore.ContentManagement.Metadata.Models; diff --git a/src/OrchardCore.Modules/OrchardCore.ContentFields/ViewModels/DisplayNumericFieldViewModel.cs b/src/OrchardCore.Modules/OrchardCore.ContentFields/ViewModels/DisplayNumericFieldViewModel.cs index 4e794a6eba3..4eb2e9c115f 100644 --- a/src/OrchardCore.Modules/OrchardCore.ContentFields/ViewModels/DisplayNumericFieldViewModel.cs +++ b/src/OrchardCore.Modules/OrchardCore.ContentFields/ViewModels/DisplayNumericFieldViewModel.cs @@ -1,4 +1,4 @@ -using OrchardCore.ContentFields.Fields; +using OrchardCore.ContentFields.Fields; using OrchardCore.ContentManagement; using OrchardCore.ContentManagement.Metadata.Models; diff --git a/src/OrchardCore.Modules/OrchardCore.ContentFields/ViewModels/DisplayTextFieldViewModel.cs b/src/OrchardCore.Modules/OrchardCore.ContentFields/ViewModels/DisplayTextFieldViewModel.cs index 8bec5a81637..5716f6eab21 100644 --- a/src/OrchardCore.Modules/OrchardCore.ContentFields/ViewModels/DisplayTextFieldViewModel.cs +++ b/src/OrchardCore.Modules/OrchardCore.ContentFields/ViewModels/DisplayTextFieldViewModel.cs @@ -1,4 +1,4 @@ -using OrchardCore.ContentFields.Fields; +using OrchardCore.ContentFields.Fields; using OrchardCore.ContentManagement; using OrchardCore.ContentManagement.Metadata.Models; diff --git a/src/OrchardCore.Modules/OrchardCore.ContentFields/ViewModels/EditBooleanFieldViewModel.cs b/src/OrchardCore.Modules/OrchardCore.ContentFields/ViewModels/EditBooleanFieldViewModel.cs index a04e0af0b8d..63bf35fbcde 100644 --- a/src/OrchardCore.Modules/OrchardCore.ContentFields/ViewModels/EditBooleanFieldViewModel.cs +++ b/src/OrchardCore.Modules/OrchardCore.ContentFields/ViewModels/EditBooleanFieldViewModel.cs @@ -1,4 +1,4 @@ -using OrchardCore.ContentFields.Fields; +using OrchardCore.ContentFields.Fields; using OrchardCore.ContentManagement; using OrchardCore.ContentManagement.Metadata.Models; diff --git a/src/OrchardCore.Modules/OrchardCore.ContentFields/ViewModels/EditHtmlFieldViewModel.cs b/src/OrchardCore.Modules/OrchardCore.ContentFields/ViewModels/EditHtmlFieldViewModel.cs index 8449c71f5a2..a2b9096d9af 100644 --- a/src/OrchardCore.Modules/OrchardCore.ContentFields/ViewModels/EditHtmlFieldViewModel.cs +++ b/src/OrchardCore.Modules/OrchardCore.ContentFields/ViewModels/EditHtmlFieldViewModel.cs @@ -1,4 +1,4 @@ -using OrchardCore.ContentFields.Fields; +using OrchardCore.ContentFields.Fields; using OrchardCore.ContentManagement; using OrchardCore.ContentManagement.Metadata.Models; diff --git a/src/OrchardCore.Modules/OrchardCore.ContentFields/ViewModels/EditLinkFieldViewModel.cs b/src/OrchardCore.Modules/OrchardCore.ContentFields/ViewModels/EditLinkFieldViewModel.cs index 124dcb90fb2..711c68e0fe7 100644 --- a/src/OrchardCore.Modules/OrchardCore.ContentFields/ViewModels/EditLinkFieldViewModel.cs +++ b/src/OrchardCore.Modules/OrchardCore.ContentFields/ViewModels/EditLinkFieldViewModel.cs @@ -1,4 +1,4 @@ -using OrchardCore.ContentFields.Fields; +using OrchardCore.ContentFields.Fields; using OrchardCore.ContentManagement; using OrchardCore.ContentManagement.Metadata.Models; diff --git a/src/OrchardCore.Modules/OrchardCore.ContentFields/ViewModels/EditNumericFieldViewModel.cs b/src/OrchardCore.Modules/OrchardCore.ContentFields/ViewModels/EditNumericFieldViewModel.cs index 4ee68d771d1..af3d3a85869 100644 --- a/src/OrchardCore.Modules/OrchardCore.ContentFields/ViewModels/EditNumericFieldViewModel.cs +++ b/src/OrchardCore.Modules/OrchardCore.ContentFields/ViewModels/EditNumericFieldViewModel.cs @@ -1,4 +1,4 @@ -using OrchardCore.ContentFields.Fields; +using OrchardCore.ContentFields.Fields; using OrchardCore.ContentManagement; using OrchardCore.ContentManagement.Metadata.Models; diff --git a/src/OrchardCore.Modules/OrchardCore.ContentLocalization/AdminMenu.cs b/src/OrchardCore.Modules/OrchardCore.ContentLocalization/AdminMenu.cs index 4d2feda62d8..3eaef3f0b8f 100644 --- a/src/OrchardCore.Modules/OrchardCore.ContentLocalization/AdminMenu.cs +++ b/src/OrchardCore.Modules/OrchardCore.ContentLocalization/AdminMenu.cs @@ -19,7 +19,7 @@ public AdminMenu(IStringLocalizer localizer) public Task BuildNavigationAsync(string name, NavigationBuilder builder) { - if (!String.Equals(name, "admin", StringComparison.OrdinalIgnoreCase)) + if (!string.Equals(name, "admin", StringComparison.OrdinalIgnoreCase)) { return Task.CompletedTask; } diff --git a/src/OrchardCore.Modules/OrchardCore.ContentLocalization/Controllers/AdminController.cs b/src/OrchardCore.Modules/OrchardCore.ContentLocalization/Controllers/AdminController.cs index ee2e4124728..2d94d8bf862 100644 --- a/src/OrchardCore.Modules/OrchardCore.ContentLocalization/Controllers/AdminController.cs +++ b/src/OrchardCore.Modules/OrchardCore.ContentLocalization/Controllers/AdminController.cs @@ -37,7 +37,7 @@ public AdminController( public async Task Localize(string contentItemId, string targetCulture) { // Invariant culture name is empty so a null value is bound. - targetCulture ??= String.Empty; + targetCulture ??= string.Empty; var contentItem = await _contentManager.GetAsync(contentItemId, VersionOptions.Latest); diff --git a/src/OrchardCore.Modules/OrchardCore.ContentLocalization/Controllers/ContentCulturePickerController.cs b/src/OrchardCore.Modules/OrchardCore.ContentLocalization/Controllers/ContentCulturePickerController.cs index 0a94e8cad60..151bb6ec990 100644 --- a/src/OrchardCore.Modules/OrchardCore.ContentLocalization/Controllers/ContentCulturePickerController.cs +++ b/src/OrchardCore.Modules/OrchardCore.ContentLocalization/Controllers/ContentCulturePickerController.cs @@ -68,7 +68,7 @@ bool TryGetLocalizedContentUrl(IEnumerable localizationEntrie { if (localizationEntries.Any()) { - var localization = localizationEntries.SingleOrDefault(e => String.Equals(e.Culture, targetCulture, StringComparison.OrdinalIgnoreCase)); + var localization = localizationEntries.SingleOrDefault(e => string.Equals(e.Culture, targetCulture, StringComparison.OrdinalIgnoreCase)); if (localization != null) { diff --git a/src/OrchardCore.Modules/OrchardCore.ContentLocalization/DefaultContentLocalizationManager.cs b/src/OrchardCore.Modules/OrchardCore.ContentLocalization/DefaultContentLocalizationManager.cs index 5791b9e75a6..7d2c4930b83 100644 --- a/src/OrchardCore.Modules/OrchardCore.ContentLocalization/DefaultContentLocalizationManager.cs +++ b/src/OrchardCore.Modules/OrchardCore.ContentLocalization/DefaultContentLocalizationManager.cs @@ -71,13 +71,13 @@ public Task> GetItemsForSetsAsync(IEnumerable l public async Task LocalizeAsync(ContentItem content, string targetCulture) { var supportedCultures = await _localizationService.GetSupportedCulturesAsync(); - if (!supportedCultures.Any(c => String.Equals(c, targetCulture, StringComparison.OrdinalIgnoreCase))) + if (!supportedCultures.Any(c => string.Equals(c, targetCulture, StringComparison.OrdinalIgnoreCase))) { throw new InvalidOperationException("Cannot localize an unsupported culture"); } var localizationPart = content.As(); - if (String.IsNullOrEmpty(localizationPart.LocalizationSet)) + if (string.IsNullOrEmpty(localizationPart.LocalizationSet)) { // If the source content item is not yet localized, define its defaults. localizationPart.LocalizationSet = _iidGenerator.GenerateUniqueId(); diff --git a/src/OrchardCore.Modules/OrchardCore.ContentLocalization/Drivers/LocalizationContentsAdminListDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.ContentLocalization/Drivers/LocalizationContentsAdminListDisplayDriver.cs index 7b0b9bbcb82..5e92f3ee5a2 100644 --- a/src/OrchardCore.Modules/OrchardCore.ContentLocalization/Drivers/LocalizationContentsAdminListDisplayDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.ContentLocalization/Drivers/LocalizationContentsAdminListDisplayDriver.cs @@ -42,7 +42,7 @@ public override IDisplayResult Edit(ContentOptionsViewModel model, IUpdateModel var supportedCultures = await _localizationService.GetSupportedCulturesAsync(); var cultures = new List { - new SelectListItem() { Text = S["All cultures"], Value = "", Selected = String.IsNullOrEmpty(m.SelectedCulture) } + new SelectListItem() { Text = S["All cultures"], Value = "", Selected = string.IsNullOrEmpty(m.SelectedCulture) } }; cultures.AddRange(supportedCultures.Select(culture => new SelectListItem() { Text = culture, Value = culture, Selected = culture == m.SelectedCulture })); diff --git a/src/OrchardCore.Modules/OrchardCore.ContentLocalization/Drivers/LocalizationPartDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.ContentLocalization/Drivers/LocalizationPartDisplayDriver.cs index 4ffbe6f8465..f2a1c782608 100644 --- a/src/OrchardCore.Modules/OrchardCore.ContentLocalization/Drivers/LocalizationPartDisplayDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.ContentLocalization/Drivers/LocalizationPartDisplayDriver.cs @@ -53,7 +53,7 @@ public override async Task UpdateAsync(LocalizationPart model, I model.Culture = viewModel.Culture ?? ""; // Need to do this here to support displaying the message to save before localizing when the item has not been saved yet. - if (String.IsNullOrEmpty(model.LocalizationSet)) + if (string.IsNullOrEmpty(model.LocalizationSet)) { model.LocalizationSet = _idGenerator.GenerateUniqueId(); } diff --git a/src/OrchardCore.Modules/OrchardCore.ContentLocalization/Handlers/LocalizationPartHandler.cs b/src/OrchardCore.Modules/OrchardCore.ContentLocalization/Handlers/LocalizationPartHandler.cs index 76d08b09da4..c843a93396a 100644 --- a/src/OrchardCore.Modules/OrchardCore.ContentLocalization/Handlers/LocalizationPartHandler.cs +++ b/src/OrchardCore.Modules/OrchardCore.ContentLocalization/Handlers/LocalizationPartHandler.cs @@ -33,7 +33,7 @@ public override Task GetContentItemAspectAsync(ContentItemAspectContext context, public override Task PublishedAsync(PublishContentContext context, LocalizationPart part) { - if (!String.IsNullOrWhiteSpace(part.LocalizationSet) && part.Culture != null) + if (!string.IsNullOrWhiteSpace(part.LocalizationSet) && part.Culture != null) { // Update entries from the index table after the session is committed. return _entries.UpdateEntriesAsync(); @@ -44,7 +44,7 @@ public override Task PublishedAsync(PublishContentContext context, LocalizationP public override Task UnpublishedAsync(PublishContentContext context, LocalizationPart part) { - if (!String.IsNullOrWhiteSpace(part.LocalizationSet) && part.Culture != null) + if (!string.IsNullOrWhiteSpace(part.LocalizationSet) && part.Culture != null) { // Update entries from the index table after the session is committed. return _entries.UpdateEntriesAsync(); @@ -55,7 +55,7 @@ public override Task UnpublishedAsync(PublishContentContext context, Localizatio public override Task RemovedAsync(RemoveContentContext context, LocalizationPart part) { - if (!String.IsNullOrWhiteSpace(part.LocalizationSet) && part.Culture != null && context.NoActiveVersionLeft) + if (!string.IsNullOrWhiteSpace(part.LocalizationSet) && part.Culture != null && context.NoActiveVersionLeft) { // Update entries from the index table after the session is committed. return _entries.UpdateEntriesAsync(); @@ -67,7 +67,7 @@ public override Task RemovedAsync(RemoveContentContext context, LocalizationPart public override Task CloningAsync(CloneContentContext context, LocalizationPart part) { var clonedPart = context.CloneContentItem.As(); - clonedPart.LocalizationSet = String.Empty; + clonedPart.LocalizationSet = string.Empty; clonedPart.Apply(); return Task.CompletedTask; } diff --git a/src/OrchardCore.Modules/OrchardCore.ContentLocalization/Services/ContentCulturePickerService.cs b/src/OrchardCore.Modules/OrchardCore.ContentLocalization/Services/ContentCulturePickerService.cs index b896bb77840..6c6e726d4d1 100644 --- a/src/OrchardCore.Modules/OrchardCore.ContentLocalization/Services/ContentCulturePickerService.cs +++ b/src/OrchardCore.Modules/OrchardCore.ContentLocalization/Services/ContentCulturePickerService.cs @@ -60,7 +60,7 @@ public async Task GetContentItemIdFromRouteAsync(PathString url) } } - if (String.IsNullOrEmpty(contentItemId)) + if (string.IsNullOrEmpty(contentItemId)) { return null; } @@ -72,7 +72,7 @@ public async Task GetLocalizationFromRouteAsync(PathString ur { var contentItemId = await GetContentItemIdFromRouteAsync(url); - if (!String.IsNullOrEmpty(contentItemId)) + if (!string.IsNullOrEmpty(contentItemId)) { (var found, var localization) = await _localizationEntries.TryGetLocalizationAsync(contentItemId); @@ -89,7 +89,7 @@ public async Task> GetLocalizationsFromRouteAsync { var contentItemId = await GetContentItemIdFromRouteAsync(url); - if (!String.IsNullOrEmpty(contentItemId)) + if (!string.IsNullOrEmpty(contentItemId)) { (var found, var localization) = await _localizationEntries.TryGetLocalizationAsync(contentItemId); diff --git a/src/OrchardCore.Modules/OrchardCore.ContentLocalization/Services/LocalizationPartContentsAdminListFilterProvider.cs b/src/OrchardCore.Modules/OrchardCore.ContentLocalization/Services/LocalizationPartContentsAdminListFilterProvider.cs index 95b34547346..754d0bb7050 100644 --- a/src/OrchardCore.Modules/OrchardCore.ContentLocalization/Services/LocalizationPartContentsAdminListFilterProvider.cs +++ b/src/OrchardCore.Modules/OrchardCore.ContentLocalization/Services/LocalizationPartContentsAdminListFilterProvider.cs @@ -15,7 +15,7 @@ public void Build(QueryEngineBuilder builder) .WithNamedTerm("culture", builder => builder .OneCondition((val, query) => { - if (!String.IsNullOrEmpty(val)) + if (!string.IsNullOrEmpty(val)) { query.With(i => (i.Published || i.Latest) && i.Culture == val); } @@ -25,11 +25,11 @@ public void Build(QueryEngineBuilder builder) .MapTo((val, model) => model.SelectedCulture = val) .MapFrom((model) => { - if (!String.IsNullOrEmpty(model.SelectedCulture)) + if (!string.IsNullOrEmpty(model.SelectedCulture)) { return (true, model.SelectedCulture); } - return (false, String.Empty); + return (false, string.Empty); }) ); } diff --git a/src/OrchardCore.Modules/OrchardCore.ContentLocalization/Sitemaps/LocalizedContentItemsQueryProvider.cs b/src/OrchardCore.Modules/OrchardCore.ContentLocalization/Sitemaps/LocalizedContentItemsQueryProvider.cs index 2681b07ada6..120864a91d6 100644 --- a/src/OrchardCore.Modules/OrchardCore.ContentLocalization/Sitemaps/LocalizedContentItemsQueryProvider.cs +++ b/src/OrchardCore.Modules/OrchardCore.ContentLocalization/Sitemaps/LocalizedContentItemsQueryProvider.cs @@ -55,14 +55,14 @@ public async Task GetContentItemsAsync(ContentTypesSitemapSource source, Content { // Test that content type is still valid to include in sitemap. var contentType = routeableContentTypeDefinitions - .FirstOrDefault(ctd => String.Equals(source.LimitedContentType.ContentTypeName, ctd.Name)); + .FirstOrDefault(ctd => string.Equals(source.LimitedContentType.ContentTypeName, ctd.Name)); if (contentType == null) { return; } - if (contentType.Parts.Any(ctd => String.Equals(ctd.Name, nameof(LocalizationPart)))) + if (contentType.Parts.Any(ctd => string.Equals(ctd.Name, nameof(LocalizationPart)))) { // Get all content items here for reference. Then reduce by default culture. // We know that the content item should be localized. @@ -78,7 +78,7 @@ public async Task GetContentItemsAsync(ContentTypesSitemapSource source, Content // Reduce by default culture. var items = queryResults - .Where(ci => String.Equals(ci.As().Culture, defaultCulture)) + .Where(ci => string.Equals(ci.As().Culture, defaultCulture)) .Skip(source.LimitedContentType.Skip) .Take(source.LimitedContentType.Take); @@ -105,7 +105,7 @@ public async Task GetContentItemsAsync(ContentTypesSitemapSource source, Content { // Test that content types are still valid to include in sitemap. var typesToIndex = routeableContentTypeDefinitions - .Where(ctd => source.ContentTypes.Any(s => String.Equals(ctd.Name, s.ContentTypeName))) + .Where(ctd => source.ContentTypes.Any(s => string.Equals(ctd.Name, s.ContentTypeName))) .Select(x => x.Name); // No advantage here in reducing with localized index. diff --git a/src/OrchardCore.Modules/OrchardCore.ContentPreview/Controllers/PreviewController.cs b/src/OrchardCore.Modules/OrchardCore.ContentPreview/Controllers/PreviewController.cs index 823098f1680..db53aebb116 100644 --- a/src/OrchardCore.Modules/OrchardCore.ContentPreview/Controllers/PreviewController.cs +++ b/src/OrchardCore.Modules/OrchardCore.ContentPreview/Controllers/PreviewController.cs @@ -97,7 +97,7 @@ public async Task Render() var previewAspect = await _contentManager.PopulateAspectAsync(contentItem, new PreviewAspect()); - if (!String.IsNullOrEmpty(previewAspect.PreviewUrl)) + if (!string.IsNullOrEmpty(previewAspect.PreviewUrl)) { // The PreviewPart is configured, we need to set the fake content item. _contentManagerSession.Store(contentItem); @@ -124,13 +124,13 @@ public static string GetModelErrorMessageOrDefault(ModelError modelError) { Debug.Assert(modelError != null); - if (!String.IsNullOrEmpty(modelError.ErrorMessage)) + if (!string.IsNullOrEmpty(modelError.ErrorMessage)) { return modelError.ErrorMessage; } // Default in the ValidationSummary case is no error message. - return String.Empty; + return string.Empty; } public static string GetModelErrorMessageOrDefault( @@ -142,7 +142,7 @@ public static string GetModelErrorMessageOrDefault( Debug.Assert(containingEntry != null); Debug.Assert(modelExplorer != null); - if (!String.IsNullOrEmpty(modelError.ErrorMessage)) + if (!string.IsNullOrEmpty(modelError.ErrorMessage)) { return modelError.ErrorMessage; } diff --git a/src/OrchardCore.Modules/OrchardCore.ContentPreview/Handlers/PreviewPartHandler.cs b/src/OrchardCore.Modules/OrchardCore.ContentPreview/Handlers/PreviewPartHandler.cs index 5f45902cf90..c2de07aeca4 100644 --- a/src/OrchardCore.Modules/OrchardCore.ContentPreview/Handlers/PreviewPartHandler.cs +++ b/src/OrchardCore.Modules/OrchardCore.ContentPreview/Handlers/PreviewPartHandler.cs @@ -32,7 +32,7 @@ public PreviewPartHandler( private string GetPattern(PreviewPart part) { var contentTypeDefinition = _contentDefinitionManager.GetTypeDefinition(part.ContentItem.ContentType); - var contentTypePartDefinition = contentTypeDefinition.Parts.FirstOrDefault(x => String.Equals(x.PartDefinition.Name, "PreviewPart")); + var contentTypePartDefinition = contentTypeDefinition.Parts.FirstOrDefault(x => string.Equals(x.PartDefinition.Name, "PreviewPart")); var pattern = contentTypePartDefinition.GetSettings().Pattern; return pattern; @@ -42,7 +42,7 @@ public override async Task GetContentItemAspectAsync(ContentItemAspectContext co { var pattern = GetPattern(part); - if (!String.IsNullOrEmpty(pattern)) + if (!string.IsNullOrEmpty(pattern)) { await context.ForAsync(async previewAspect => { @@ -55,7 +55,7 @@ await context.ForAsync(async previewAspect => previewAspect.PreviewUrl = await _liquidTemplateManager.RenderStringAsync(pattern, NullEncoder.Default, model, new Dictionary() { ["ContentItem"] = new ObjectValue(model.ContentItem) }); - previewAspect.PreviewUrl = previewAspect.PreviewUrl.Replace("\r", String.Empty).Replace("\n", String.Empty); + previewAspect.PreviewUrl = previewAspect.PreviewUrl.Replace("\r", string.Empty).Replace("\n", string.Empty); }); } diff --git a/src/OrchardCore.Modules/OrchardCore.ContentPreview/PreviewStartupFilter.cs b/src/OrchardCore.Modules/OrchardCore.ContentPreview/PreviewStartupFilter.cs index 5331a820096..3e2eedd5cb7 100644 --- a/src/OrchardCore.Modules/OrchardCore.ContentPreview/PreviewStartupFilter.cs +++ b/src/OrchardCore.Modules/OrchardCore.ContentPreview/PreviewStartupFilter.cs @@ -22,7 +22,7 @@ public Action Configure(Action next) var previewPath = previewPathObject.ToString(); - if (!String.IsNullOrWhiteSpace(previewPath) && previewPath.StartsWith('/')) + if (!string.IsNullOrWhiteSpace(previewPath) && previewPath.StartsWith('/')) { var originalPath = context.Request.Path; var originalQueryString = context.Request.QueryString; diff --git a/src/OrchardCore.Modules/OrchardCore.ContentPreview/Settings/PreviewPartSettingsDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.ContentPreview/Settings/PreviewPartSettingsDisplayDriver.cs index 757b83f69f2..efef966dfd4 100644 --- a/src/OrchardCore.Modules/OrchardCore.ContentPreview/Settings/PreviewPartSettingsDisplayDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.ContentPreview/Settings/PreviewPartSettingsDisplayDriver.cs @@ -41,9 +41,9 @@ await context.Updater.TryUpdateModelAsync(model, Prefix, m => m.Pattern ); - if (!String.IsNullOrEmpty(model.Pattern) && !_templateManager.Validate(model.Pattern, out var errors)) + if (!string.IsNullOrEmpty(model.Pattern) && !_templateManager.Validate(model.Pattern, out var errors)) { - context.Updater.ModelState.AddModelError(nameof(model.Pattern), S["Pattern doesn't contain a valid Liquid expression. Details: {0}", String.Join(" ", errors)]); + context.Updater.ModelState.AddModelError(nameof(model.Pattern), S["Pattern doesn't contain a valid Liquid expression. Details: {0}", string.Join(" ", errors)]); } else { diff --git a/src/OrchardCore.Modules/OrchardCore.ContentTypes/AdminMenu.cs b/src/OrchardCore.Modules/OrchardCore.ContentTypes/AdminMenu.cs index b904b1fe98e..4a054e7a533 100644 --- a/src/OrchardCore.Modules/OrchardCore.ContentTypes/AdminMenu.cs +++ b/src/OrchardCore.Modules/OrchardCore.ContentTypes/AdminMenu.cs @@ -18,7 +18,7 @@ public AdminMenu(IStringLocalizer localizer) public Task BuildNavigationAsync(string name, NavigationBuilder builder) { - if (!String.Equals(name, "admin", StringComparison.OrdinalIgnoreCase)) + if (!string.Equals(name, "admin", StringComparison.OrdinalIgnoreCase)) { return Task.CompletedTask; } diff --git a/src/OrchardCore.Modules/OrchardCore.ContentTypes/Controllers/AdminController.cs b/src/OrchardCore.Modules/OrchardCore.ContentTypes/Controllers/AdminController.cs index 7d85348be51..1698b91e559 100644 --- a/src/OrchardCore.Modules/OrchardCore.ContentTypes/Controllers/AdminController.cs +++ b/src/OrchardCore.Modules/OrchardCore.ContentTypes/Controllers/AdminController.cs @@ -93,30 +93,30 @@ public async Task CreatePOST(CreateTypeViewModel viewModel) return Forbid(); } - viewModel.DisplayName = viewModel.DisplayName?.Trim() ?? String.Empty; - viewModel.Name ??= String.Empty; + viewModel.DisplayName = viewModel.DisplayName?.Trim() ?? string.Empty; + viewModel.Name ??= string.Empty; - if (String.IsNullOrWhiteSpace(viewModel.DisplayName)) + if (string.IsNullOrWhiteSpace(viewModel.DisplayName)) { ModelState.AddModelError("DisplayName", S["The Display Name can't be empty."]); } - if (_contentDefinitionService.LoadTypes().Any(t => String.Equals(t.DisplayName.Trim(), viewModel.DisplayName.Trim(), StringComparison.OrdinalIgnoreCase))) + if (_contentDefinitionService.LoadTypes().Any(t => string.Equals(t.DisplayName.Trim(), viewModel.DisplayName.Trim(), StringComparison.OrdinalIgnoreCase))) { ModelState.AddModelError("DisplayName", S["A type with the same Display Name already exists."]); } - if (String.IsNullOrWhiteSpace(viewModel.Name)) + if (string.IsNullOrWhiteSpace(viewModel.Name)) { ModelState.AddModelError("Name", S["The Technical Name can't be empty."]); } - if (!String.IsNullOrWhiteSpace(viewModel.Name) && !viewModel.Name[0].IsLetter()) + if (!string.IsNullOrWhiteSpace(viewModel.Name) && !viewModel.Name[0].IsLetter()) { ModelState.AddModelError("Name", S["The Technical Name must start with a letter."]); } - if (!String.Equals(viewModel.Name, viewModel.Name.ToSafeName(), StringComparison.OrdinalIgnoreCase)) + if (!string.Equals(viewModel.Name, viewModel.Name.ToSafeName(), StringComparison.OrdinalIgnoreCase)) { ModelState.AddModelError("Name", S["The Technical Name contains invalid characters."]); } @@ -126,7 +126,7 @@ public async Task CreatePOST(CreateTypeViewModel viewModel) ModelState.AddModelError("Name", S["The Technical Name is reserved for internal use."]); } - if (_contentDefinitionService.LoadTypes().Any(t => String.Equals(t.Name.Trim(), viewModel.Name.Trim(), StringComparison.OrdinalIgnoreCase))) + if (_contentDefinitionService.LoadTypes().Any(t => string.Equals(t.Name.Trim(), viewModel.Name.Trim(), StringComparison.OrdinalIgnoreCase))) { ModelState.AddModelError("Name", S["A type with the same Technical Name already exists."]); } @@ -346,25 +346,25 @@ public async Task AddReusablePartToPOST(string id) return await AddReusablePartTo(id); } - viewModel.DisplayName = viewModel.DisplayName?.Trim() ?? String.Empty; - viewModel.Name ??= String.Empty; + viewModel.DisplayName = viewModel.DisplayName?.Trim() ?? string.Empty; + viewModel.Name ??= string.Empty; - if (String.IsNullOrWhiteSpace(viewModel.DisplayName)) + if (string.IsNullOrWhiteSpace(viewModel.DisplayName)) { ModelState.AddModelError("DisplayName", S["The Display Name can't be empty."]); } - if (typeViewModel.TypeDefinition.Parts.Any(f => String.Equals(f.DisplayName().Trim(), viewModel.DisplayName.Trim(), StringComparison.OrdinalIgnoreCase))) + if (typeViewModel.TypeDefinition.Parts.Any(f => string.Equals(f.DisplayName().Trim(), viewModel.DisplayName.Trim(), StringComparison.OrdinalIgnoreCase))) { ModelState.AddModelError("DisplayName", S["A part with the same Display Name already exists."]); } - if (!String.IsNullOrWhiteSpace(viewModel.Name) && !viewModel.Name[0].IsLetter()) + if (!string.IsNullOrWhiteSpace(viewModel.Name) && !viewModel.Name[0].IsLetter()) { ModelState.AddModelError("Name", S["The Technical Name must start with a letter."]); } - if (!String.Equals(viewModel.Name, viewModel.Name.ToSafeName(), StringComparison.OrdinalIgnoreCase)) + if (!string.Equals(viewModel.Name, viewModel.Name.ToSafeName(), StringComparison.OrdinalIgnoreCase)) { ModelState.AddModelError("Name", S["The Technical Name contains invalid characters."]); } @@ -374,12 +374,12 @@ public async Task AddReusablePartToPOST(string id) ModelState.AddModelError("Name", S["The Technical Name is reserved for internal use."]); } - if (String.IsNullOrWhiteSpace(viewModel.Name)) + if (string.IsNullOrWhiteSpace(viewModel.Name)) { ModelState.AddModelError("Name", S["The Technical Name can't be empty."]); } - if (typeViewModel.TypeDefinition.Parts.Any(f => String.Equals(f.Name.Trim(), viewModel.Name.Trim(), StringComparison.OrdinalIgnoreCase))) + if (typeViewModel.TypeDefinition.Parts.Any(f => string.Equals(f.Name.Trim(), viewModel.Name.Trim(), StringComparison.OrdinalIgnoreCase))) { ModelState.AddModelError("Name", S["A part with the same Technical Name already exists."]); } @@ -409,7 +409,7 @@ public async Task RemovePart(string id, string name) var typeViewModel = _contentDefinitionService.LoadType(id); - if (typeViewModel == null || !typeViewModel.TypeDefinition.Parts.Any(p => String.Equals(p.Name, name, StringComparison.OrdinalIgnoreCase))) + if (typeViewModel == null || !typeViewModel.TypeDefinition.Parts.Any(p => string.Equals(p.Name, name, StringComparison.OrdinalIgnoreCase))) { return NotFound(); } @@ -457,24 +457,24 @@ public async Task CreatePartPOST(CreatePartViewModel viewModel) return Forbid(); } - viewModel.Name ??= String.Empty; + viewModel.Name ??= string.Empty; - if (String.IsNullOrWhiteSpace(viewModel.Name)) + if (string.IsNullOrWhiteSpace(viewModel.Name)) { ModelState.AddModelError("Name", S["The Technical Name can't be empty."]); } - if (_contentDefinitionService.LoadParts(false).Any(p => String.Equals(p.Name.Trim(), viewModel.Name.Trim(), StringComparison.OrdinalIgnoreCase))) + if (_contentDefinitionService.LoadParts(false).Any(p => string.Equals(p.Name.Trim(), viewModel.Name.Trim(), StringComparison.OrdinalIgnoreCase))) { ModelState.AddModelError("Name", S["A part with the same Technical Name already exists."]); } - if (!String.IsNullOrWhiteSpace(viewModel.Name) && !viewModel.Name[0].IsLetter()) + if (!string.IsNullOrWhiteSpace(viewModel.Name) && !viewModel.Name[0].IsLetter()) { ModelState.AddModelError("Name", S["The Technical Name must start with a letter."]); } - if (!String.Equals(viewModel.Name, viewModel.Name.ToSafeName(), StringComparison.OrdinalIgnoreCase)) + if (!string.Equals(viewModel.Name, viewModel.Name.ToSafeName(), StringComparison.OrdinalIgnoreCase)) { ModelState.AddModelError("Name", S["The Technical Name contains invalid characters."]); } @@ -632,42 +632,42 @@ public async Task AddFieldToPOST(AddFieldViewModel viewModel, stri var fields = _contentDefinitionService.GetFields().ToList(); - if (!fields.Any(field => String.Equals(field.Name, viewModel.FieldTypeName, StringComparison.OrdinalIgnoreCase))) + if (!fields.Any(field => string.Equals(field.Name, viewModel.FieldTypeName, StringComparison.OrdinalIgnoreCase))) { return NotFound(); } var partDefinition = partViewModel.PartDefinition; - viewModel.DisplayName = viewModel.DisplayName?.Trim() ?? String.Empty; - viewModel.Name ??= String.Empty; + viewModel.DisplayName = viewModel.DisplayName?.Trim() ?? string.Empty; + viewModel.Name ??= string.Empty; - if (String.IsNullOrWhiteSpace(viewModel.DisplayName)) + if (string.IsNullOrWhiteSpace(viewModel.DisplayName)) { ModelState.AddModelError("DisplayName", S["The Display Name can't be empty."]); } - if (partDefinition.Fields.Any(f => String.Equals(f.DisplayName().Trim(), viewModel.DisplayName.Trim(), StringComparison.OrdinalIgnoreCase))) + if (partDefinition.Fields.Any(f => string.Equals(f.DisplayName().Trim(), viewModel.DisplayName.Trim(), StringComparison.OrdinalIgnoreCase))) { ModelState.AddModelError("DisplayName", S["A field with the same Display Name already exists."]); } - if (String.IsNullOrWhiteSpace(viewModel.Name)) + if (string.IsNullOrWhiteSpace(viewModel.Name)) { ModelState.AddModelError("Name", S["The Technical Name can't be empty."]); } - if (partDefinition.Fields.Any(f => String.Equals(f.Name.Trim(), viewModel.Name.Trim(), StringComparison.OrdinalIgnoreCase))) + if (partDefinition.Fields.Any(f => string.Equals(f.Name.Trim(), viewModel.Name.Trim(), StringComparison.OrdinalIgnoreCase))) { ModelState.AddModelError("Name", S["A field with the same Technical Name already exists."]); } - if (!String.IsNullOrWhiteSpace(viewModel.Name) && !viewModel.Name[0].IsLetter()) + if (!string.IsNullOrWhiteSpace(viewModel.Name) && !viewModel.Name[0].IsLetter()) { ModelState.AddModelError("Name", S["The Technical Name must start with a letter."]); } - if (!String.Equals(viewModel.Name, viewModel.Name.ToSafeName(), StringComparison.OrdinalIgnoreCase)) + if (!string.Equals(viewModel.Name, viewModel.Name.ToSafeName(), StringComparison.OrdinalIgnoreCase)) { ModelState.AddModelError("Name", S["The Technical Name contains invalid characters."]); } @@ -687,7 +687,7 @@ public async Task AddFieldToPOST(AddFieldViewModel viewModel, stri await _notifier.SuccessAsync(H["The field \"{0}\" has been added.", viewModel.DisplayName]); - if (!String.IsNullOrEmpty(returnUrl) && Url.IsLocalUrl(returnUrl)) + if (!string.IsNullOrEmpty(returnUrl) && Url.IsLocalUrl(returnUrl)) { return this.Redirect(returnUrl, true); } @@ -711,10 +711,10 @@ public async Task EditField(string id, string name, string returnU return NotFound(); } - var partFieldDefinition = partViewModel.PartDefinition.Fields.FirstOrDefault(x => String.Equals(x.Name, name, StringComparison.OrdinalIgnoreCase)); + var partFieldDefinition = partViewModel.PartDefinition.Fields.FirstOrDefault(x => string.Equals(x.Name, name, StringComparison.OrdinalIgnoreCase)); if (partFieldDefinition?.FieldDefinition?.Name == null - || !_contentDefinitionService.GetFields().Any(field => String.Equals(field.Name, partFieldDefinition.FieldDefinition.Name, StringComparison.OrdinalIgnoreCase))) + || !_contentDefinitionService.GetFields().Any(field => string.Equals(field.Name, partFieldDefinition.FieldDefinition.Name, StringComparison.OrdinalIgnoreCase))) { return NotFound(); } @@ -754,7 +754,7 @@ public async Task EditFieldPOST(string id, EditFieldViewModel view return NotFound(); } - var field = _contentDefinitionManager.LoadPartDefinition(id).Fields.FirstOrDefault(x => String.Equals(x.Name, viewModel.Name, StringComparison.OrdinalIgnoreCase)); + var field = _contentDefinitionManager.LoadPartDefinition(id).Fields.FirstOrDefault(x => string.Equals(x.Name, viewModel.Name, StringComparison.OrdinalIgnoreCase)); if (field == null) { @@ -766,14 +766,14 @@ public async Task EditFieldPOST(string id, EditFieldViewModel view if (field.DisplayName() != viewModel.DisplayName) { // prevent null reference exception in validation - viewModel.DisplayName = viewModel.DisplayName?.Trim() ?? String.Empty; + viewModel.DisplayName = viewModel.DisplayName?.Trim() ?? string.Empty; - if (String.IsNullOrWhiteSpace(viewModel.DisplayName)) + if (string.IsNullOrWhiteSpace(viewModel.DisplayName)) { ModelState.AddModelError("DisplayName", S["The Display Name can't be empty."]); } - if (_contentDefinitionService.LoadPart(partViewModel.Name).PartDefinition.Fields.Any(t => t.Name != viewModel.Name && String.Equals(t.DisplayName().Trim(), viewModel.DisplayName.Trim(), StringComparison.OrdinalIgnoreCase))) + if (_contentDefinitionService.LoadPart(partViewModel.Name).PartDefinition.Fields.Any(t => t.Name != viewModel.Name && string.Equals(t.DisplayName().Trim(), viewModel.DisplayName.Trim(), StringComparison.OrdinalIgnoreCase))) { ModelState.AddModelError("DisplayName", S["A field with the same Display Name already exists."]); } @@ -794,7 +794,7 @@ public async Task EditFieldPOST(string id, EditFieldViewModel view _contentDefinitionService.AlterField(partViewModel, viewModel); // Refresh the local field variable in case it has been altered - field = _contentDefinitionManager.LoadPartDefinition(id).Fields.FirstOrDefault(x => String.Equals(x.Name, viewModel.Name, StringComparison.OrdinalIgnoreCase)); + field = _contentDefinitionManager.LoadPartDefinition(id).Fields.FirstOrDefault(x => string.Equals(x.Name, viewModel.Name, StringComparison.OrdinalIgnoreCase)); viewModel.Shape = await _contentDefinitionDisplayManager.UpdatePartFieldEditorAsync(field, _updateModelAccessor.ModelUpdater); @@ -810,7 +810,7 @@ public async Task EditFieldPOST(string id, EditFieldViewModel view await _notifier.SuccessAsync(H["The \"{0}\" field settings have been saved.", field.DisplayName()]); } - if (!String.IsNullOrEmpty(returnUrl) && Url.IsLocalUrl(returnUrl)) + if (!string.IsNullOrEmpty(returnUrl) && Url.IsLocalUrl(returnUrl)) { return this.Redirect(returnUrl, true); } @@ -842,7 +842,7 @@ public async Task RemoveFieldFromPOST(string id, string name) return NotFound(); } - var field = partViewModel.PartDefinition.Fields.FirstOrDefault(x => String.Equals(x.Name, name, StringComparison.OrdinalIgnoreCase)); + var field = partViewModel.PartDefinition.Fields.FirstOrDefault(x => string.Equals(x.Name, name, StringComparison.OrdinalIgnoreCase)); if (field == null) { @@ -879,7 +879,7 @@ public async Task EditTypePart(string id, string name) return NotFound(); } - var typePartDefinition = typeDefinition.Parts.FirstOrDefault(x => String.Equals(x.Name, name, StringComparison.OrdinalIgnoreCase)); + var typePartDefinition = typeDefinition.Parts.FirstOrDefault(x => string.Equals(x.Name, name, StringComparison.OrdinalIgnoreCase)); if (typePartDefinition == null) { @@ -921,7 +921,7 @@ public async Task EditTypePartPOST(string id, EditTypePartViewMode return NotFound(); } - var part = typeDefinition.Parts.FirstOrDefault(x => String.Equals(x.Name, viewModel.Name, StringComparison.OrdinalIgnoreCase)); + var part = typeDefinition.Parts.FirstOrDefault(x => string.Equals(x.Name, viewModel.Name, StringComparison.OrdinalIgnoreCase)); if (part == null) { @@ -935,14 +935,14 @@ public async Task EditTypePartPOST(string id, EditTypePartViewMode if (part.DisplayName() != viewModel.DisplayName) { // Prevent null reference exception in validation - viewModel.DisplayName = viewModel.DisplayName?.Trim() ?? String.Empty; + viewModel.DisplayName = viewModel.DisplayName?.Trim() ?? string.Empty; - if (String.IsNullOrWhiteSpace(viewModel.DisplayName)) + if (string.IsNullOrWhiteSpace(viewModel.DisplayName)) { ModelState.AddModelError("DisplayName", S["The Display Name can't be empty."]); } - if (typeDefinition.Parts.Any(t => t.Name != viewModel.Name && String.Equals(t.DisplayName()?.Trim(), viewModel.DisplayName.Trim(), StringComparison.OrdinalIgnoreCase))) + if (typeDefinition.Parts.Any(t => t.Name != viewModel.Name && string.Equals(t.DisplayName()?.Trim(), viewModel.DisplayName.Trim(), StringComparison.OrdinalIgnoreCase))) { ModelState.AddModelError("DisplayName", S["A part with the same Display Name already exists."]); } @@ -959,7 +959,7 @@ public async Task EditTypePartPOST(string id, EditTypePartViewMode _contentDefinitionService.AlterTypePart(viewModel); // Refresh the local part variable in case it has been altered - part = _contentDefinitionManager.LoadTypeDefinition(id).Parts.FirstOrDefault(x => String.Equals(x.Name, viewModel.Name, StringComparison.OrdinalIgnoreCase)); + part = _contentDefinitionManager.LoadTypeDefinition(id).Parts.FirstOrDefault(x => string.Equals(x.Name, viewModel.Name, StringComparison.OrdinalIgnoreCase)); viewModel.Shape = await _contentDefinitionDisplayManager.UpdateTypePartEditorAsync(part, _updateModelAccessor.ModelUpdater); diff --git a/src/OrchardCore.Modules/OrchardCore.ContentTypes/Deployment/DeleteContentDefinitionDeploymentStepDriver.cs b/src/OrchardCore.Modules/OrchardCore.ContentTypes/Deployment/DeleteContentDefinitionDeploymentStepDriver.cs index e8015dfbd8a..fe02d96976f 100644 --- a/src/OrchardCore.Modules/OrchardCore.ContentTypes/Deployment/DeleteContentDefinitionDeploymentStepDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.ContentTypes/Deployment/DeleteContentDefinitionDeploymentStepDriver.cs @@ -23,8 +23,8 @@ public override IDisplayResult Edit(DeleteContentDefinitionDeploymentStep step) { return Initialize("DeleteContentDefinitionDeploymentStep_Fields_Edit", model => { - model.ContentParts = String.Join(", ", step.ContentParts); - model.ContentTypes = String.Join(", ", step.ContentTypes); + model.ContentParts = string.Join(", ", step.ContentParts); + model.ContentTypes = string.Join(", ", step.ContentTypes); }).Location("Content"); } diff --git a/src/OrchardCore.Modules/OrchardCore.ContentTypes/Editors/ContentTypeSettingsDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.ContentTypes/Editors/ContentTypeSettingsDisplayDriver.cs index a236fed9f9f..d7087b73118 100644 --- a/src/OrchardCore.Modules/OrchardCore.ContentTypes/Editors/ContentTypeSettingsDisplayDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.ContentTypes/Editors/ContentTypeSettingsDisplayDriver.cs @@ -61,16 +61,16 @@ public override async Task UpdateAsync(ContentTypeDefinition con private static bool IsAlphaNumericOrEmpty(string value) { - if (String.IsNullOrEmpty(value)) + if (string.IsNullOrEmpty(value)) { return true; } - var startWithLetter = Char.IsLetter(value[0]); + var startWithLetter = char.IsLetter(value[0]); return value.Length == 1 ? startWithLetter - : startWithLetter && value.Skip(1).All(c => Char.IsLetterOrDigit(c)); + : startWithLetter && value.Skip(1).All(c => char.IsLetterOrDigit(c)); } } } diff --git a/src/OrchardCore.Modules/OrchardCore.ContentTypes/Editors/DefaultContentTypeDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.ContentTypes/Editors/DefaultContentTypeDisplayDriver.cs index 902a7e6dff3..4a2d6db48d3 100644 --- a/src/OrchardCore.Modules/OrchardCore.ContentTypes/Editors/DefaultContentTypeDisplayDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.ContentTypes/Editors/DefaultContentTypeDisplayDriver.cs @@ -33,7 +33,7 @@ public override async Task UpdateAsync(ContentTypeDefinition con context.Builder.DisplayedAs(model.DisplayName); - if (String.IsNullOrWhiteSpace(model.DisplayName)) + if (string.IsNullOrWhiteSpace(model.DisplayName)) { context.Updater.ModelState.AddModelError("DisplayName", S["The Content Type name can't be empty."]); } diff --git a/src/OrchardCore.Modules/OrchardCore.ContentTypes/RecipeSteps/ContentDefinitionStep.cs b/src/OrchardCore.Modules/OrchardCore.ContentTypes/RecipeSteps/ContentDefinitionStep.cs index 9e8fdc95cf6..a0f464a68b3 100644 --- a/src/OrchardCore.Modules/OrchardCore.ContentTypes/RecipeSteps/ContentDefinitionStep.cs +++ b/src/OrchardCore.Modules/OrchardCore.ContentTypes/RecipeSteps/ContentDefinitionStep.cs @@ -22,7 +22,7 @@ public ContentDefinitionStep(IContentDefinitionManager contentDefinitionManager) public Task ExecuteAsync(RecipeExecutionContext context) { - if (!String.Equals(context.Name, "ContentDefinition", StringComparison.OrdinalIgnoreCase)) + if (!string.Equals(context.Name, "ContentDefinition", StringComparison.OrdinalIgnoreCase)) { return Task.CompletedTask; } @@ -52,7 +52,7 @@ private void UpdateContentType(ContentTypeDefinition type, ContentTypeDefinition { _contentDefinitionManager.AlterTypeDefinition(type.Name, builder => { - if (!String.IsNullOrEmpty(record.DisplayName)) + if (!string.IsNullOrEmpty(record.DisplayName)) { builder.DisplayedAs(record.DisplayName); builder.MergeSettings(record.Settings); diff --git a/src/OrchardCore.Modules/OrchardCore.ContentTypes/RecipeSteps/DeleteContentDefinitionStep.cs b/src/OrchardCore.Modules/OrchardCore.ContentTypes/RecipeSteps/DeleteContentDefinitionStep.cs index d7e205e71b6..ac5f136bad0 100644 --- a/src/OrchardCore.Modules/OrchardCore.ContentTypes/RecipeSteps/DeleteContentDefinitionStep.cs +++ b/src/OrchardCore.Modules/OrchardCore.ContentTypes/RecipeSteps/DeleteContentDefinitionStep.cs @@ -20,7 +20,7 @@ public DeleteContentDefinitionStep(IContentDefinitionManager contentDefinitionMa public Task ExecuteAsync(RecipeExecutionContext context) { - if (!String.Equals(context.Name, "DeleteContentDefinition", StringComparison.OrdinalIgnoreCase)) + if (!string.Equals(context.Name, "DeleteContentDefinition", StringComparison.OrdinalIgnoreCase)) { return Task.CompletedTask; } diff --git a/src/OrchardCore.Modules/OrchardCore.ContentTypes/RecipeSteps/ReplaceContentDefinitionStep.cs b/src/OrchardCore.Modules/OrchardCore.ContentTypes/RecipeSteps/ReplaceContentDefinitionStep.cs index 927efa8797e..421abb92728 100644 --- a/src/OrchardCore.Modules/OrchardCore.ContentTypes/RecipeSteps/ReplaceContentDefinitionStep.cs +++ b/src/OrchardCore.Modules/OrchardCore.ContentTypes/RecipeSteps/ReplaceContentDefinitionStep.cs @@ -21,7 +21,7 @@ public ReplaceContentDefinitionStep(IContentDefinitionManager contentDefinitionM public Task ExecuteAsync(RecipeExecutionContext context) { - if (!String.Equals(context.Name, "ReplaceContentDefinition", StringComparison.OrdinalIgnoreCase)) + if (!string.Equals(context.Name, "ReplaceContentDefinition", StringComparison.OrdinalIgnoreCase)) { return Task.CompletedTask; } @@ -52,7 +52,7 @@ private void AlterContentType(ContentTypeDefinitionRecord record) { _contentDefinitionManager.AlterTypeDefinition(record.Name, builder => { - if (!String.IsNullOrEmpty(record.DisplayName)) + if (!string.IsNullOrEmpty(record.DisplayName)) { builder.DisplayedAs(record.DisplayName); builder.MergeSettings(record.Settings); diff --git a/src/OrchardCore.Modules/OrchardCore.ContentTypes/Services/ContentDefinitionService.cs b/src/OrchardCore.Modules/OrchardCore.ContentTypes/Services/ContentDefinitionService.cs index 6b0d6fd7849..4e1d64a3af5 100644 --- a/src/OrchardCore.Modules/OrchardCore.ContentTypes/Services/ContentDefinitionService.cs +++ b/src/OrchardCore.Modules/OrchardCore.ContentTypes/Services/ContentDefinitionService.cs @@ -100,12 +100,12 @@ public EditTypeViewModel GetType(string name) public ContentTypeDefinition AddType(string name, string displayName) { - if (String.IsNullOrWhiteSpace(displayName)) + if (string.IsNullOrWhiteSpace(displayName)) { throw new ArgumentException("The 'displayName' can't be null or empty.", nameof(displayName)); } - if (String.IsNullOrWhiteSpace(name)) + if (string.IsNullOrWhiteSpace(name)) { name = GenerateContentTypeNameFromDisplayName(displayName); } @@ -115,7 +115,7 @@ public ContentTypeDefinition AddType(string name, string displayName) { throw new ArgumentException("Content type name must start with a letter", nameof(name)); } - if (!String.Equals(name, name.ToSafeName(), StringComparison.OrdinalIgnoreCase)) + if (!string.Equals(name, name.ToSafeName(), StringComparison.OrdinalIgnoreCase)) { throw new ArgumentException("Content type name contains invalid characters", nameof(name)); } @@ -286,7 +286,7 @@ public EditPartViewModel AddPart(CreatePartViewModel partViewModel) if (_contentDefinitionManager.LoadPartDefinition(name) != null) throw new Exception(S["Cannot add part named '{0}'. It already exists.", name]); - if (!String.IsNullOrEmpty(name)) + if (!string.IsNullOrEmpty(name)) { _contentDefinitionManager.AlterPartDefinition(name, builder => builder.Attachable()); var partDefinition = _contentDefinitionManager.LoadPartDefinition(name); @@ -329,7 +329,7 @@ public void AddFieldToPart(string fieldName, string fieldTypeName, string partNa public void AddFieldToPart(string fieldName, string displayName, string fieldTypeName, string partName) { - if (String.IsNullOrEmpty(fieldName)) + if (string.IsNullOrEmpty(fieldName)) { throw new ArgumentException("The 'fieldName' can't be null or empty.", nameof(fieldName)); } @@ -465,7 +465,7 @@ public string GenerateFieldNameFromDisplayName(string partName, string displayNa fieldDefinitions = part.Fields.ToArray(); } - while (fieldDefinitions.Any(x => String.Equals(displayName.Trim(), x.Name.Trim(), StringComparison.OrdinalIgnoreCase))) + while (fieldDefinitions.Any(x => string.Equals(displayName.Trim(), x.Name.Trim(), StringComparison.OrdinalIgnoreCase))) displayName = VersionName(displayName); return displayName; @@ -476,19 +476,19 @@ private static string VersionName(string name) int version; var nameParts = name.Split('-', StringSplitOptions.RemoveEmptyEntries); - if (nameParts.Length > 1 && Int32.TryParse(nameParts.Last(), out version)) + if (nameParts.Length > 1 && int.TryParse(nameParts.Last(), out version)) { version = version > 0 ? ++version : 2; // This could unintentionally chomp something that looks like a version. - name = String.Join("-", nameParts.Take(nameParts.Length - 1)); + name = string.Join("-", nameParts.Take(nameParts.Length - 1)); } else { version = 2; } - return String.Format("{0}-{1}", name, version); + return string.Format("{0}-{1}", name, version); } } } diff --git a/src/OrchardCore.Modules/OrchardCore.ContentTypes/ViewModels/AddPartsViewModel.cs b/src/OrchardCore.Modules/OrchardCore.ContentTypes/ViewModels/AddPartsViewModel.cs index e49107d40b8..8111abc7c36 100644 --- a/src/OrchardCore.Modules/OrchardCore.ContentTypes/ViewModels/AddPartsViewModel.cs +++ b/src/OrchardCore.Modules/OrchardCore.ContentTypes/ViewModels/AddPartsViewModel.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; namespace OrchardCore.ContentTypes.ViewModels { diff --git a/src/OrchardCore.Modules/OrchardCore.Contents/AdminMenu.cs b/src/OrchardCore.Modules/OrchardCore.Contents/AdminMenu.cs index 25822bbcaac..7ea58da0d5f 100644 --- a/src/OrchardCore.Modules/OrchardCore.Contents/AdminMenu.cs +++ b/src/OrchardCore.Modules/OrchardCore.Contents/AdminMenu.cs @@ -50,7 +50,7 @@ public async Task BuildNavigationAsync(string name, NavigationBuilder builder) { var context = _httpContextAccessor.HttpContext; - if (!String.Equals(name, "admin", StringComparison.OrdinalIgnoreCase)) + if (!string.Equals(name, "admin", StringComparison.OrdinalIgnoreCase)) { return; } diff --git a/src/OrchardCore.Modules/OrchardCore.Contents/AdminNodes/ContentTypesAdminNodeDriver.cs b/src/OrchardCore.Modules/OrchardCore.Contents/AdminNodes/ContentTypesAdminNodeDriver.cs index ea5f1d09788..73907eb4290 100644 --- a/src/OrchardCore.Modules/OrchardCore.Contents/AdminNodes/ContentTypesAdminNodeDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Contents/AdminNodes/ContentTypesAdminNodeDriver.cs @@ -49,8 +49,8 @@ public override IDisplayResult Edit(ContentTypesAdminNode treeNode) model.ContentTypes = listable.Select(x => new ContentTypeEntryViewModel { ContentTypeId = x.Name, - IsChecked = treeNode.ContentTypes.Any(selected => String.Equals(selected.ContentTypeId, x.Name, StringComparison.OrdinalIgnoreCase)), - IconClass = treeNode.ContentTypes.FirstOrDefault(selected => selected.ContentTypeId == x.Name)?.IconClass ?? String.Empty + IsChecked = treeNode.ContentTypes.Any(selected => string.Equals(selected.ContentTypeId, x.Name, StringComparison.OrdinalIgnoreCase)), + IconClass = treeNode.ContentTypes.FirstOrDefault(selected => selected.ContentTypeId == x.Name)?.IconClass ?? string.Empty }).ToArray(); }).Location("Content"); } diff --git a/src/OrchardCore.Modules/OrchardCore.Contents/AdminNodes/ContentTypesAdminNodeNavigationBuilder.cs b/src/OrchardCore.Modules/OrchardCore.Contents/AdminNodes/ContentTypesAdminNodeNavigationBuilder.cs index 3e3704c8732..86931fd7098 100644 --- a/src/OrchardCore.Modules/OrchardCore.Contents/AdminNodes/ContentTypesAdminNodeNavigationBuilder.cs +++ b/src/OrchardCore.Modules/OrchardCore.Contents/AdminNodes/ContentTypesAdminNodeNavigationBuilder.cs @@ -54,7 +54,7 @@ public async Task BuildNavigationAsync(MenuItem menuItem, NavigationBuilder buil { builder.Add(new LocalizedString(ctd.DisplayName, ctd.DisplayName), cTypeMenu => { - cTypeMenu.Url(_linkGenerator.GetPathByRouteValues(_httpContextAccessor.HttpContext, String.Empty, new + cTypeMenu.Url(_linkGenerator.GetPathByRouteValues(_httpContextAccessor.HttpContext, string.Empty, new { area = "OrchardCore.Contents", controller = "Admin", @@ -94,7 +94,7 @@ private async Task> GetListableContentTypeDef foreach (var contentTypeDefinition in contentTypeDefinitions) { - if (!node.ShowAll && !node.ContentTypes.Any(entry => String.Equals(contentTypeDefinition.Name, entry.ContentTypeId, StringComparison.OrdinalIgnoreCase))) + if (!node.ShowAll && !node.ContentTypes.Any(entry => string.Equals(contentTypeDefinition.Name, entry.ContentTypeId, StringComparison.OrdinalIgnoreCase))) { continue; } @@ -119,7 +119,7 @@ private static List GetIconClasses(ContentTypeDefinition contentType, Co else { var typeEntry = node.ContentTypes - .Where(x => String.Equals(x.ContentTypeId, contentType.Name, StringComparison.OrdinalIgnoreCase)) + .Where(x => string.Equals(x.ContentTypeId, contentType.Name, StringComparison.OrdinalIgnoreCase)) .FirstOrDefault(); return AddPrefixToClasses(typeEntry.IconClass); diff --git a/src/OrchardCore.Modules/OrchardCore.Contents/AuditTrail/Drivers/AuditTrailPartSettingsDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.Contents/AuditTrail/Drivers/AuditTrailPartSettingsDisplayDriver.cs index ed171e6bc4e..c218f3478e2 100644 --- a/src/OrchardCore.Modules/OrchardCore.Contents/AuditTrail/Drivers/AuditTrailPartSettingsDisplayDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Contents/AuditTrail/Drivers/AuditTrailPartSettingsDisplayDriver.cs @@ -14,7 +14,7 @@ public class AuditTrailPartSettingsDisplayDriver : ContentTypePartDefinitionDisp { public override IDisplayResult Edit(ContentTypePartDefinition model, IUpdateModel updater) { - if (!String.Equals(nameof(AuditTrailPart), model.PartDefinition.Name)) return null; + if (!string.Equals(nameof(AuditTrailPart), model.PartDefinition.Name)) return null; return Initialize("AuditTrailPartSettings_Edit", viewModel => { @@ -25,7 +25,7 @@ public override IDisplayResult Edit(ContentTypePartDefinition model, IUpdateMode public override async Task UpdateAsync(ContentTypePartDefinition model, UpdateTypePartEditorContext context) { - if (!String.Equals(nameof(AuditTrailPart), model.PartDefinition.Name)) return null; + if (!string.Equals(nameof(AuditTrailPart), model.PartDefinition.Name)) return null; var viewModel = new AuditTrailPartSettingsViewModel(); diff --git a/src/OrchardCore.Modules/OrchardCore.Contents/AuditTrail/Extensions/ContentOrchardHelperExtensions.cs b/src/OrchardCore.Modules/OrchardCore.Contents/AuditTrail/Extensions/ContentOrchardHelperExtensions.cs index 369600219d0..2e88cafa434 100644 --- a/src/OrchardCore.Modules/OrchardCore.Contents/AuditTrail/Extensions/ContentOrchardHelperExtensions.cs +++ b/src/OrchardCore.Modules/OrchardCore.Contents/AuditTrail/Extensions/ContentOrchardHelperExtensions.cs @@ -20,7 +20,7 @@ public static async Task EditForLinkAsync(this IOrchardHelper orch var contentManager = orchardHelper.HttpContext.RequestServices.GetRequiredService(); var metadata = await contentManager.PopulateAspectAsync(contentItem); - if (String.IsNullOrEmpty(linkText)) + if (string.IsNullOrEmpty(linkText)) { linkText = contentItem.ContentType; } diff --git a/src/OrchardCore.Modules/OrchardCore.Contents/Controllers/AdminController.cs b/src/OrchardCore.Modules/OrchardCore.Contents/Controllers/AdminController.cs index d7744cfd5c0..55385023722 100644 --- a/src/OrchardCore.Modules/OrchardCore.Contents/Controllers/AdminController.cs +++ b/src/OrchardCore.Modules/OrchardCore.Contents/Controllers/AdminController.cs @@ -101,7 +101,7 @@ public async Task List( } // The parameter contentTypeId is used by the AdminMenus. Pass it to the options. - if (!String.IsNullOrEmpty(contentTypeId)) + if (!string.IsNullOrEmpty(contentTypeId)) { options.SelectedContentType = contentTypeId; } @@ -110,7 +110,7 @@ public async Task List( // The options must still be bound so that options that are not filters are still bound. options.FilterResult = queryFilterResult; - var hasSelectedContentType = !String.IsNullOrEmpty(options.SelectedContentType); + var hasSelectedContentType = !string.IsNullOrEmpty(options.SelectedContentType); if (hasSelectedContentType) { @@ -126,7 +126,7 @@ public async Task List( options.CreatableTypes = await GetCreatableTypeOptionsAsync(options.CanCreateSelectedContentType, contentTypeDefinition); } - if (!hasSelectedContentType && !String.IsNullOrEmpty(stereotype)) + if (!hasSelectedContentType && !string.IsNullOrEmpty(stereotype)) { // When a stereotype is provided via the query parameter or options a placeholder node is used to apply a filter. options.FilterResult.TryAddOrReplace(new StereotypeFilterNode(stereotype)); @@ -182,7 +182,7 @@ public async Task List( }; if (options.ContentTypeOptions == null - && (String.IsNullOrEmpty(options.SelectedContentType) || String.IsNullOrEmpty(contentTypeId))) + && (string.IsNullOrEmpty(options.SelectedContentType) || string.IsNullOrEmpty(contentTypeId))) { options.ContentTypeOptions = await GetListableContentTypeOptionsAsync(contentTypeDefinitions, options.SelectedContentType, true); } @@ -221,7 +221,7 @@ public async Task List( options.ContentItemsCount = contentItemSummaries.Count; options.TotalItemCount = pagerShape.TotalItemCount; - var header = await _contentOptionsDisplayManager.BuildEditorAsync(options, _updateModelAccessor.ModelUpdater, false, String.Empty, String.Empty); + var header = await _contentOptionsDisplayManager.BuildEditorAsync(options, _updateModelAccessor.ModelUpdater, false, string.Empty, string.Empty); var shapeViewModel = await _shapeFactory.CreateAsync("ContentsAdminList", viewModel => { @@ -239,13 +239,13 @@ public async Task List( public async Task ListFilterPOST(ContentOptionsViewModel options) { // When the user has typed something into the search input no further evaluation of the form post is required. - if (!String.Equals(options.SearchText, options.OriginalSearchText, StringComparison.OrdinalIgnoreCase)) + if (!string.Equals(options.SearchText, options.OriginalSearchText, StringComparison.OrdinalIgnoreCase)) { return RedirectToAction(nameof(List), new RouteValueDictionary { { "q", options.SearchText } }); } // Evaluate the values provided in the form post and map them to the filter result and route values. - await _contentOptionsDisplayManager.UpdateEditorAsync(options, _updateModelAccessor.ModelUpdater, false, String.Empty, String.Empty); + await _contentOptionsDisplayManager.UpdateEditorAsync(options, _updateModelAccessor.ModelUpdater, false, string.Empty, string.Empty); // The route value must always be added after the editors have updated the models. options.RouteValues.TryAdd("q", options.FilterResult.ToString()); @@ -317,7 +317,7 @@ public async Task ListPOST(ContentOptionsViewModel options, IEnume public async Task Create(string id) { - if (String.IsNullOrWhiteSpace(id)) + if (string.IsNullOrWhiteSpace(id)) { return NotFound(); } @@ -345,7 +345,7 @@ public Task CreatePOST(string id, [Bind(Prefix = "submit.Save")] var typeDefinition = _contentDefinitionManager.GetTypeDefinition(contentItem.ContentType); - await _notifier.SuccessAsync(String.IsNullOrWhiteSpace(typeDefinition?.DisplayName) + await _notifier.SuccessAsync(string.IsNullOrWhiteSpace(typeDefinition?.DisplayName) ? H["Your content draft has been saved."] : H["Your {0} draft has been saved.", typeDefinition.DisplayName]); }); @@ -355,7 +355,7 @@ await _notifier.SuccessAsync(String.IsNullOrWhiteSpace(typeDefinition?.DisplayNa [FormValueRequired("submit.Publish")] public async Task CreateAndPublishPOST(string id, [Bind(Prefix = "submit.Publish")] string submitPublish, string returnUrl) { - if (String.IsNullOrEmpty(id)) + if (string.IsNullOrEmpty(id)) { return NotFound(); } @@ -373,7 +373,7 @@ public async Task CreateAndPublishPOST(string id, [Bind(Prefix = var typeDefinition = _contentDefinitionManager.GetTypeDefinition(contentItem.ContentType); - await _notifier.SuccessAsync(String.IsNullOrWhiteSpace(typeDefinition.DisplayName) + await _notifier.SuccessAsync(string.IsNullOrWhiteSpace(typeDefinition.DisplayName) ? H["Your content has been published."] : H["Your {0} has been published.", typeDefinition.DisplayName]); }); @@ -428,7 +428,7 @@ public Task EditPOST(string contentItemId, [Bind(Prefix = "submit var typeDefinition = _contentDefinitionManager.GetTypeDefinition(contentItem.ContentType); - await _notifier.SuccessAsync(String.IsNullOrWhiteSpace(typeDefinition?.DisplayName) + await _notifier.SuccessAsync(string.IsNullOrWhiteSpace(typeDefinition?.DisplayName) ? H["Your content draft has been saved."] : H["Your {0} draft has been saved.", typeDefinition.DisplayName]); }); @@ -458,7 +458,7 @@ public async Task EditAndPublishPOST(string contentItemId, [Bind( var typeDefinition = _contentDefinitionManager.GetTypeDefinition(contentItem.ContentType); - await _notifier.SuccessAsync(String.IsNullOrWhiteSpace(typeDefinition?.DisplayName) + await _notifier.SuccessAsync(string.IsNullOrWhiteSpace(typeDefinition?.DisplayName) ? H["Your content has been published."] : H["Your {0} has been published.", typeDefinition.DisplayName]); }); @@ -515,7 +515,7 @@ public async Task DiscardDraft(string contentItemId, string retur var typeDefinition = _contentDefinitionManager.GetTypeDefinition(contentItem.ContentType); - await _notifier.SuccessAsync(String.IsNullOrWhiteSpace(typeDefinition?.DisplayName) + await _notifier.SuccessAsync(string.IsNullOrWhiteSpace(typeDefinition?.DisplayName) ? H["The draft has been removed."] : H["The {0} draft has been removed.", typeDefinition.DisplayName]); } @@ -539,7 +539,7 @@ public async Task Remove(string contentItemId, string returnUrl) var typeDefinition = _contentDefinitionManager.GetTypeDefinition(contentItem.ContentType); - await _notifier.SuccessAsync(String.IsNullOrWhiteSpace(typeDefinition?.DisplayName) + await _notifier.SuccessAsync(string.IsNullOrWhiteSpace(typeDefinition?.DisplayName) ? H["That content has been removed."] : H["That {0} has been removed.", typeDefinition.DisplayName]); } @@ -565,7 +565,7 @@ public async Task Publish(string contentItemId, string returnUrl) var typeDefinition = _contentDefinitionManager.GetTypeDefinition(contentItem.ContentType); - if (String.IsNullOrEmpty(typeDefinition?.DisplayName)) + if (string.IsNullOrEmpty(typeDefinition?.DisplayName)) { await _notifier.SuccessAsync(H["That content has been published."]); } @@ -595,7 +595,7 @@ public async Task Unpublish(string contentItemId, string returnUr var typeDefinition = _contentDefinitionManager.GetTypeDefinition(contentItem.ContentType); - if (String.IsNullOrEmpty(typeDefinition?.DisplayName)) + if (string.IsNullOrEmpty(typeDefinition?.DisplayName)) { await _notifier.SuccessAsync(H["The content has been unpublished."]); } @@ -631,14 +631,14 @@ private async Task CreatePOST(string id, string returnUrl, bool s await conditionallyPublish(contentItem); - if (!String.IsNullOrEmpty(returnUrl) && !stayOnSamePage) + if (!string.IsNullOrEmpty(returnUrl) && !stayOnSamePage) { return this.LocalRedirect(returnUrl, true); } var adminRouteValues = (await _contentManager.PopulateAspectAsync(contentItem)).AdminRouteValues; - if (!String.IsNullOrEmpty(returnUrl)) + if (!string.IsNullOrEmpty(returnUrl)) { adminRouteValues.Add("returnUrl", returnUrl); } @@ -710,7 +710,7 @@ private async Task> GetListableContentTypeOptionsAsync(IEnu if (showSelectAll) { - items.Add(new SelectListItem(S["All content types"], String.Empty)); + items.Add(new SelectListItem(S["All content types"], string.Empty)); }; foreach (var definition in definitions) @@ -721,7 +721,7 @@ private async Task> GetListableContentTypeOptionsAsync(IEnu continue; } - items.Add(new SelectListItem(definition.DisplayName, definition.Name, String.Equals(definition.Name, selectedContentType))); + items.Add(new SelectListItem(definition.DisplayName, definition.Name, string.Equals(definition.Name, selectedContentType))); } return items; diff --git a/src/OrchardCore.Modules/OrchardCore.Contents/Controllers/ApiController.cs b/src/OrchardCore.Modules/OrchardCore.Contents/Controllers/ApiController.cs index bcb2cd2e986..f11bbfb15dc 100644 --- a/src/OrchardCore.Modules/OrchardCore.Contents/Controllers/ApiController.cs +++ b/src/OrchardCore.Modules/OrchardCore.Contents/Controllers/ApiController.cs @@ -101,7 +101,7 @@ public async Task Post(ContentItem model, bool draft = false) if (contentItem == null) { - if (String.IsNullOrEmpty(model?.ContentType) || _contentDefinitionManager.GetTypeDefinition(model.ContentType) == null) + if (string.IsNullOrEmpty(model?.ContentType) || _contentDefinitionManager.GetTypeDefinition(model.ContentType) == null) { return BadRequest(); } @@ -131,7 +131,7 @@ public async Task Post(ContentItem model, bool draft = false) return ValidationProblem(new ValidationProblemDetails(ModelState) { Title = S["One or more validation errors occurred."], - Detail = String.Join(", ", ModelState.Values.SelectMany(x => x.Errors.Select(x => x.ErrorMessage))), + Detail = string.Join(", ", ModelState.Values.SelectMany(x => x.Errors.Select(x => x.ErrorMessage))), Status = (int)HttpStatusCode.BadRequest, }); } @@ -161,7 +161,7 @@ public async Task Post(ContentItem model, bool draft = false) return ValidationProblem(new ValidationProblemDetails(ModelState) { Title = S["One or more validation errors occurred."], - Detail = String.Join(", ", ModelState.Values.SelectMany(x => x.Errors.Select(x => x.ErrorMessage))), + Detail = string.Join(", ", ModelState.Values.SelectMany(x => x.Errors.Select(x => x.ErrorMessage))), Status = (int)HttpStatusCode.BadRequest, }); } @@ -192,7 +192,7 @@ private void AddValidationErrorsToModelState(ContentValidateResult result) } else { - ModelState.AddModelError(String.Empty, error.ErrorMessage); + ModelState.AddModelError(string.Empty, error.ErrorMessage); } } } diff --git a/src/OrchardCore.Modules/OrchardCore.Contents/Deployment/ExportContentToDeploymentTarget/ExportContentToDeploymentTargetAdminMenu.cs b/src/OrchardCore.Modules/OrchardCore.Contents/Deployment/ExportContentToDeploymentTarget/ExportContentToDeploymentTargetAdminMenu.cs index d95fcab8490..6ed5023654f 100644 --- a/src/OrchardCore.Modules/OrchardCore.Contents/Deployment/ExportContentToDeploymentTarget/ExportContentToDeploymentTargetAdminMenu.cs +++ b/src/OrchardCore.Modules/OrchardCore.Contents/Deployment/ExportContentToDeploymentTarget/ExportContentToDeploymentTargetAdminMenu.cs @@ -16,7 +16,7 @@ public ExportContentToDeploymentTargetAdminMenu(IStringLocalizer loca public Task BuildNavigationAsync(string name, NavigationBuilder builder) { - if (!String.Equals(name, "admin", StringComparison.OrdinalIgnoreCase)) + if (!string.Equals(name, "admin", StringComparison.OrdinalIgnoreCase)) { return Task.CompletedTask; } diff --git a/src/OrchardCore.Modules/OrchardCore.Contents/Deployment/ExportContentToDeploymentTarget/ExportContentToDeploymentTargetDeploymentSource.cs b/src/OrchardCore.Modules/OrchardCore.Contents/Deployment/ExportContentToDeploymentTarget/ExportContentToDeploymentTargetDeploymentSource.cs index fc5b908ef00..c260524f308 100644 --- a/src/OrchardCore.Modules/OrchardCore.Contents/Deployment/ExportContentToDeploymentTarget/ExportContentToDeploymentTargetDeploymentSource.cs +++ b/src/OrchardCore.Modules/OrchardCore.Contents/Deployment/ExportContentToDeploymentTarget/ExportContentToDeploymentTargetDeploymentSource.cs @@ -46,7 +46,7 @@ public async Task ProcessDeploymentStepAsync(DeploymentStep step, DeploymentPlan var model = new ExportContentToDeploymentTargetModel(); await _updateModelAccessor.ModelUpdater.TryUpdateModelAsync(model, "ExportContentToDeploymentTarget", m => m.ItemIds, m => m.Latest, m => m.ContentItemId); - if (!String.IsNullOrEmpty(model.ContentItemId)) + if (!string.IsNullOrEmpty(model.ContentItemId)) { var contentItem = await _contentManager.GetAsync(model.ContentItemId, model.Latest ? VersionOptions.Latest : VersionOptions.Published); if (contentItem != null) diff --git a/src/OrchardCore.Modules/OrchardCore.Contents/Drivers/ContentsDriver.cs b/src/OrchardCore.Modules/OrchardCore.Contents/Drivers/ContentsDriver.cs index c2b96e21fe9..3bae29b8e8e 100644 --- a/src/OrchardCore.Modules/OrchardCore.Contents/Drivers/ContentsDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Contents/Drivers/ContentsDriver.cs @@ -46,18 +46,18 @@ public override IDisplayResult Display(ContentItem contentItem, IUpdateModel upd { var hasStereotype = contentTypeDefinition.TryGetStereotype(out var stereotype); - if (hasStereotype && !String.Equals("Content", stereotype, StringComparison.OrdinalIgnoreCase)) + if (hasStereotype && !string.Equals("Content", stereotype, StringComparison.OrdinalIgnoreCase)) { ctx.Shape.Metadata.Alternates.Add($"{stereotype}__ContentsMetadata"); } var displayType = ctx.Shape.Metadata.DisplayType; - if (!String.IsNullOrEmpty(displayType) && displayType != "Detail") + if (!string.IsNullOrEmpty(displayType) && displayType != "Detail") { ctx.Shape.Metadata.Alternates.Add($"ContentsMetadata_{ctx.Shape.Metadata.DisplayType}"); - if (hasStereotype && !String.Equals("Content", stereotype, StringComparison.OrdinalIgnoreCase)) + if (hasStereotype && !string.Equals("Content", stereotype, StringComparison.OrdinalIgnoreCase)) { ctx.Shape.Metadata.Alternates.Add($"{stereotype}_{displayType}__ContentsMetadata"); } diff --git a/src/OrchardCore.Modules/OrchardCore.Contents/Drivers/OwnerEditorDriver.cs b/src/OrchardCore.Modules/OrchardCore.Contents/Drivers/OwnerEditorDriver.cs index 79f6259460f..30e99e110ac 100644 --- a/src/OrchardCore.Modules/OrchardCore.Contents/Drivers/OwnerEditorDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Contents/Drivers/OwnerEditorDriver.cs @@ -47,7 +47,7 @@ public override async Task EditAsync(CommonPart part, BuildPartE { return Initialize("CommonPart_Edit__Owner", async model => { - if (!String.IsNullOrEmpty(part.ContentItem.Owner)) + if (!string.IsNullOrEmpty(part.ContentItem.Owner)) { // TODO Move this editor to a user picker. var user = await _userManager.FindByIdAsync(part.ContentItem.Owner); @@ -77,7 +77,7 @@ public override async Task UpdateAsync(CommonPart part, UpdatePa await context.Updater.TryUpdateModelAsync(model, Prefix); - if (String.IsNullOrWhiteSpace(model.OwnerName)) + if (string.IsNullOrWhiteSpace(model.OwnerName)) { context.Updater.ModelState.AddModelError(Prefix, nameof(model.OwnerName), S["A value is required for Owner."]); } diff --git a/src/OrchardCore.Modules/OrchardCore.Contents/Feeds/CommonFeedItemBuilder.cs b/src/OrchardCore.Modules/OrchardCore.Contents/Feeds/CommonFeedItemBuilder.cs index 4ce723ea0fa..e77da0e74bb 100644 --- a/src/OrchardCore.Modules/OrchardCore.Contents/Feeds/CommonFeedItemBuilder.cs +++ b/src/OrchardCore.Modules/OrchardCore.Contents/Feeds/CommonFeedItemBuilder.cs @@ -48,7 +48,7 @@ public async Task PopulateAsync(FeedContext context) feedItem.Element.SetElementValue("title", contentItem.DisplayText); feedItem.Element.Add(link); - feedItem.Element.Add(new XElement("description", new XCData(bodyAspect.Body?.ToString() ?? String.Empty))); + feedItem.Element.Add(new XElement("description", new XCData(bodyAspect.Body?.ToString() ?? string.Empty))); if (contentItem.PublishedUtc != null) { @@ -74,7 +74,7 @@ public async Task PopulateAsync(FeedContext context) }); context.Builder.AddProperty(context, feedItem, "title", contentItem.DisplayText); - context.Builder.AddProperty(context, feedItem, new XElement("description", new XCData(bodyAspect.Body?.ToString() ?? String.Empty))); + context.Builder.AddProperty(context, feedItem, new XElement("description", new XCData(bodyAspect.Body?.ToString() ?? string.Empty))); if (contentItem.PublishedUtc != null) { diff --git a/src/OrchardCore.Modules/OrchardCore.Contents/Handlers/FullTextAspectContentHandler.cs b/src/OrchardCore.Modules/OrchardCore.Contents/Handlers/FullTextAspectContentHandler.cs index ba3e56560a5..6adead84417 100644 --- a/src/OrchardCore.Modules/OrchardCore.Contents/Handlers/FullTextAspectContentHandler.cs +++ b/src/OrchardCore.Modules/OrchardCore.Contents/Handlers/FullTextAspectContentHandler.cs @@ -69,7 +69,7 @@ public override Task GetContentItemAspectAsync(ContentItemAspectContext context) } } - if (settings.IncludeFullTextTemplate && !String.IsNullOrEmpty(settings.FullTextTemplate)) + if (settings.IncludeFullTextTemplate && !string.IsNullOrEmpty(settings.FullTextTemplate)) { var result = await _liquidTemplateManager.RenderStringAsync(settings.FullTextTemplate, NullEncoder.Default, context.ContentItem, new Dictionary() { ["ContentItem"] = new ObjectValue(context.ContentItem) }); diff --git a/src/OrchardCore.Modules/OrchardCore.Contents/Indexing/FullTextContentIndexHandler.cs b/src/OrchardCore.Modules/OrchardCore.Contents/Indexing/FullTextContentIndexHandler.cs index a80093393d8..71410a360dd 100644 --- a/src/OrchardCore.Modules/OrchardCore.Contents/Indexing/FullTextContentIndexHandler.cs +++ b/src/OrchardCore.Modules/OrchardCore.Contents/Indexing/FullTextContentIndexHandler.cs @@ -27,7 +27,7 @@ public async Task BuildIndexAsync(BuildIndexContext context) stringBuilder.Append(segment + " "); } - if (!String.IsNullOrEmpty(stringBuilder.ToString())) + if (!string.IsNullOrEmpty(stringBuilder.ToString())) { context.DocumentIndex.Set( IndexingConstants.FullTextKey, diff --git a/src/OrchardCore.Modules/OrchardCore.Contents/Liquid/ContentAnchorTag.cs b/src/OrchardCore.Modules/OrchardCore.Contents/Liquid/ContentAnchorTag.cs index 3bf98fcfdc4..30b6af7c921 100644 --- a/src/OrchardCore.Modules/OrchardCore.Contents/Liquid/ContentAnchorTag.cs +++ b/src/OrchardCore.Modules/OrchardCore.Contents/Liquid/ContentAnchorTag.cs @@ -88,7 +88,7 @@ public async ValueTask WriteToAsync(List argumentsLi contentItem = displayFor; var previewAspect = await contentManager.PopulateAspectAsync(contentItem); - if (!String.IsNullOrEmpty(previewAspect.PreviewUrl)) + if (!string.IsNullOrEmpty(previewAspect.PreviewUrl)) { var previewUrl = previewAspect.PreviewUrl; if (!previewUrl.StartsWith("~/", StringComparison.OrdinalIgnoreCase)) @@ -215,7 +215,7 @@ public async ValueTask WriteToAsync(List argumentsLi return completion; } } - else if (!String.IsNullOrEmpty(contentItem.DisplayText)) + else if (!string.IsNullOrEmpty(contentItem.DisplayText)) { writer.Write(encoder.Encode(contentItem.DisplayText)); } diff --git a/src/OrchardCore.Modules/OrchardCore.Contents/Liquid/DisplayUrlFilter.cs b/src/OrchardCore.Modules/OrchardCore.Contents/Liquid/DisplayUrlFilter.cs index 48a5cdb1013..00019d3f048 100644 --- a/src/OrchardCore.Modules/OrchardCore.Contents/Liquid/DisplayUrlFilter.cs +++ b/src/OrchardCore.Modules/OrchardCore.Contents/Liquid/DisplayUrlFilter.cs @@ -32,7 +32,7 @@ public async ValueTask ProcessAsync(FluidValue input, FilterArgument if (contentItem == null) { - if (String.IsNullOrEmpty(input.ToStringValue())) + if (string.IsNullOrEmpty(input.ToStringValue())) { return StringValue.Empty; } diff --git a/src/OrchardCore.Modules/OrchardCore.Contents/Liquid/FullTextFilter.cs b/src/OrchardCore.Modules/OrchardCore.Contents/Liquid/FullTextFilter.cs index 3272219e559..877dfe62ce9 100644 --- a/src/OrchardCore.Modules/OrchardCore.Contents/Liquid/FullTextFilter.cs +++ b/src/OrchardCore.Modules/OrchardCore.Contents/Liquid/FullTextFilter.cs @@ -52,7 +52,7 @@ public async ValueTask ProcessAsync(FluidValue input, FilterArgument } // When returning segments separate them so multiple segments are indexed individually. - return new ArrayValue(aspects.SelectMany(x => x.Segments).Where(x => !String.IsNullOrEmpty(x)).Select(x => new StringValue(x + ' '))); + return new ArrayValue(aspects.SelectMany(x => x.Segments).Where(x => !string.IsNullOrEmpty(x)).Select(x => new StringValue(x + ' '))); } else { @@ -66,7 +66,7 @@ public async ValueTask ProcessAsync(FluidValue input, FilterArgument var fullTextAspect = await _contentManager.PopulateAspectAsync(contentItem); // Remove empty strings as display text is often unused in contained content items. - return new ArrayValue(fullTextAspect.Segments.Where(x => !String.IsNullOrEmpty(x)).Select(x => new StringValue(x))); + return new ArrayValue(fullTextAspect.Segments.Where(x => !string.IsNullOrEmpty(x)).Select(x => new StringValue(x))); } } diff --git a/src/OrchardCore.Modules/OrchardCore.Contents/Models/CommonPart.cs b/src/OrchardCore.Modules/OrchardCore.Contents/Models/CommonPart.cs index e8c57a238b3..511a6669d2b 100644 --- a/src/OrchardCore.Modules/OrchardCore.Contents/Models/CommonPart.cs +++ b/src/OrchardCore.Modules/OrchardCore.Contents/Models/CommonPart.cs @@ -1,4 +1,4 @@ -using OrchardCore.ContentManagement; +using OrchardCore.ContentManagement; namespace OrchardCore.Contents.Models { diff --git a/src/OrchardCore.Modules/OrchardCore.Contents/Recipes/ContentStep.cs b/src/OrchardCore.Modules/OrchardCore.Contents/Recipes/ContentStep.cs index c9150a0ea61..c1c100ee6bd 100644 --- a/src/OrchardCore.Modules/OrchardCore.Contents/Recipes/ContentStep.cs +++ b/src/OrchardCore.Modules/OrchardCore.Contents/Recipes/ContentStep.cs @@ -16,7 +16,7 @@ public class ContentStep : IRecipeStepHandler { public Task ExecuteAsync(RecipeExecutionContext context) { - if (!String.Equals(context.Name, "Content", StringComparison.OrdinalIgnoreCase)) + if (!string.Equals(context.Name, "Content", StringComparison.OrdinalIgnoreCase)) { return Task.CompletedTask; } diff --git a/src/OrchardCore.Modules/OrchardCore.Contents/Scripting/ContentMethodsProvider.cs b/src/OrchardCore.Modules/OrchardCore.Contents/Scripting/ContentMethodsProvider.cs index c69bfc39340..e837d307de3 100644 --- a/src/OrchardCore.Modules/OrchardCore.Contents/Scripting/ContentMethodsProvider.cs +++ b/src/OrchardCore.Modules/OrchardCore.Contents/Scripting/ContentMethodsProvider.cs @@ -44,7 +44,7 @@ public ContentMethodsProvider() } else { - throw new ValidationException(String.Join(", ", result.Errors)); + throw new ValidationException(string.Join(", ", result.Errors)); } }), }; @@ -60,7 +60,7 @@ public ContentMethodsProvider() var result = contentManager.ValidateAsync(contentItem).GetAwaiter().GetResult(); if (!result.Succeeded) { - throw new ValidationException(String.Join(", ", result.Errors)); + throw new ValidationException(string.Join(", ", result.Errors)); } }), }; diff --git a/src/OrchardCore.Modules/OrchardCore.Contents/Scripting/UrlMethodsProvider.cs b/src/OrchardCore.Modules/OrchardCore.Contents/Scripting/UrlMethodsProvider.cs index 8a3701ef8be..99d52487a93 100644 --- a/src/OrchardCore.Modules/OrchardCore.Contents/Scripting/UrlMethodsProvider.cs +++ b/src/OrchardCore.Modules/OrchardCore.Contents/Scripting/UrlMethodsProvider.cs @@ -25,7 +25,7 @@ public UrlMethodsProvider() pathBase = "/"; } - path = path?.Trim(' ', '/') ?? String.Empty; + path = path?.Trim(' ', '/') ?? string.Empty; if (path.Length > 0) { pathBase = pathBase.Add($"/{path}"); diff --git a/src/OrchardCore.Modules/OrchardCore.Contents/Security/ContentTypeAuthorizationHandler.cs b/src/OrchardCore.Modules/OrchardCore.Contents/Security/ContentTypeAuthorizationHandler.cs index 9efa0241e0d..0a597199109 100644 --- a/src/OrchardCore.Modules/OrchardCore.Contents/Security/ContentTypeAuthorizationHandler.cs +++ b/src/OrchardCore.Modules/OrchardCore.Contents/Security/ContentTypeAuthorizationHandler.cs @@ -57,7 +57,7 @@ protected override async Task HandleRequirementAsync(AuthorizationHandlerContext : context.Resource.ToString() ; - if (!String.IsNullOrEmpty(contentType)) + if (!string.IsNullOrEmpty(contentType)) { permission = ContentTypePermissionsHelper.CreateDynamicPermission(contentTypePermission, contentType); } diff --git a/src/OrchardCore.Modules/OrchardCore.Contents/Services/ContentTypeFilterNode.cs b/src/OrchardCore.Modules/OrchardCore.Contents/Services/ContentTypeFilterNode.cs index 34dbd45504e..fc7e54efc0d 100644 --- a/src/OrchardCore.Modules/OrchardCore.Contents/Services/ContentTypeFilterNode.cs +++ b/src/OrchardCore.Modules/OrchardCore.Contents/Services/ContentTypeFilterNode.cs @@ -13,9 +13,9 @@ public class ContentTypeFilterNode : TermOperationNode } public override string ToNormalizedString() - => String.Empty; + => string.Empty; public override string ToString() - => String.Empty; + => string.Empty; } } diff --git a/src/OrchardCore.Modules/OrchardCore.Contents/Services/DefaultContentsAdminListFilterProvider.cs b/src/OrchardCore.Modules/OrchardCore.Contents/Services/DefaultContentsAdminListFilterProvider.cs index 4140253d48c..e329bbdb5ca 100644 --- a/src/OrchardCore.Modules/OrchardCore.Contents/Services/DefaultContentsAdminListFilterProvider.cs +++ b/src/OrchardCore.Modules/OrchardCore.Contents/Services/DefaultContentsAdminListFilterProvider.cs @@ -71,7 +71,7 @@ public void Build(QueryEngineBuilder builder) return (true, model.ContentsStatus.ToString()); } - return (false, String.Empty); + return (false, string.Empty); }) .AlwaysRun() ) @@ -118,7 +118,7 @@ public void Build(QueryEngineBuilder builder) return (true, model.OrderBy.ToString()); } - return (false, String.Empty); + return (false, string.Empty); }) .AlwaysRun() ) @@ -133,7 +133,7 @@ public void Build(QueryEngineBuilder builder) var userNameIdentifier = user?.FindFirstValue(ClaimTypes.NameIdentifier); // Filter for a specific type. - if (!String.IsNullOrEmpty(contentType)) + if (!string.IsNullOrEmpty(contentType)) { var contentTypeDefinition = contentDefinitionManager.GetTypeDefinition(contentType); if (contentTypeDefinition != null) @@ -184,19 +184,19 @@ public void Build(QueryEngineBuilder builder) }) .MapTo((val, model) => { - if (!String.IsNullOrEmpty(val)) + if (!string.IsNullOrEmpty(val)) { model.SelectedContentType = val; } }) .MapFrom((model) => { - if (!String.IsNullOrEmpty(model.SelectedContentType)) + if (!string.IsNullOrEmpty(model.SelectedContentType)) { return (true, model.SelectedContentType); } - return (false, String.Empty); + return (false, string.Empty); }) .AlwaysRun() ) @@ -209,7 +209,7 @@ public void Build(QueryEngineBuilder builder) var contentDefinitionManager = context.ServiceProvider.GetRequiredService(); // Filter for a specific stereotype. - if (!String.IsNullOrEmpty(stereotype)) + if (!string.IsNullOrEmpty(stereotype)) { var contentTypeDefinitionNames = contentDefinitionManager.ListTypeDefinitions() .Where(definition => definition.StereotypeEquals(stereotype, StringComparison.OrdinalIgnoreCase)) diff --git a/src/OrchardCore.Modules/OrchardCore.Contents/Services/DefaultContentsAdminListQueryService.cs b/src/OrchardCore.Modules/OrchardCore.Contents/Services/DefaultContentsAdminListQueryService.cs index 7323025f0bf..9011b578aca 100644 --- a/src/OrchardCore.Modules/OrchardCore.Contents/Services/DefaultContentsAdminListQueryService.cs +++ b/src/OrchardCore.Modules/OrchardCore.Contents/Services/DefaultContentsAdminListQueryService.cs @@ -87,7 +87,7 @@ await _contentsAdminListFilters private static string GetSelectedContentType(ContentOptionsViewModel model) { - if (String.IsNullOrEmpty(model.SelectedContentType)) + if (string.IsNullOrEmpty(model.SelectedContentType)) { var typeTermNode = model.FilterResult.OfType().FirstOrDefault(); if (typeTermNode is not null) diff --git a/src/OrchardCore.Modules/OrchardCore.Contents/Services/StereotypeFilterNode.cs b/src/OrchardCore.Modules/OrchardCore.Contents/Services/StereotypeFilterNode.cs index 01851077f96..1f7a6debfde 100644 --- a/src/OrchardCore.Modules/OrchardCore.Contents/Services/StereotypeFilterNode.cs +++ b/src/OrchardCore.Modules/OrchardCore.Contents/Services/StereotypeFilterNode.cs @@ -11,8 +11,8 @@ public StereotypeFilterNode(string stereotype) } public override string ToNormalizedString() - => String.Empty; + => string.Empty; public override string ToString() - => String.Empty; + => string.Empty; } diff --git a/src/OrchardCore.Modules/OrchardCore.Contents/Settings/FullTextAspectSettingsDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.Contents/Settings/FullTextAspectSettingsDisplayDriver.cs index 369eab73247..583871be00e 100644 --- a/src/OrchardCore.Modules/OrchardCore.Contents/Settings/FullTextAspectSettingsDisplayDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Contents/Settings/FullTextAspectSettingsDisplayDriver.cs @@ -46,12 +46,12 @@ await context.Updater.TryUpdateModelAsync(model, Prefix, m => m.IncludeDisplayText, m => m.IncludeBodyAspect); - if (!String.IsNullOrEmpty(model.FullTextTemplate) && !_templateManager.Validate(model.FullTextTemplate, out var errors)) + if (!string.IsNullOrEmpty(model.FullTextTemplate) && !_templateManager.Validate(model.FullTextTemplate, out var errors)) { context.Updater.ModelState.AddModelError( nameof(model.FullTextTemplate), S["Full-text doesn't contain a valid Liquid expression. Details: {0}", - String.Join(' ', errors)]); + string.Join(' ', errors)]); } else { diff --git a/src/OrchardCore.Modules/OrchardCore.Contents/Shapes.cs b/src/OrchardCore.Modules/OrchardCore.Contents/Shapes.cs index 3a69f239d5a..67683ad9fa6 100644 --- a/src/OrchardCore.Modules/OrchardCore.Contents/Shapes.cs +++ b/src/OrchardCore.Modules/OrchardCore.Contents/Shapes.cs @@ -53,11 +53,11 @@ public void Discover(ShapeTableBuilder builder) var displayType = content.GetProperty("DisplayType"); var alternate = content.GetProperty("Alternate"); - if (String.IsNullOrEmpty(handle)) + if (string.IsNullOrEmpty(handle)) { // This code is provided for backwards compatibility and can be removed in a future version. handle = content.GetProperty("Alias"); - if (String.IsNullOrEmpty(handle)) + if (string.IsNullOrEmpty(handle)) { return; } @@ -70,7 +70,7 @@ public void Discover(ShapeTableBuilder builder) var contentItemId = await handleManager.GetContentItemIdAsync(handle); - if (String.IsNullOrEmpty(contentItemId)) + if (string.IsNullOrEmpty(contentItemId)) { return; } @@ -86,7 +86,7 @@ public void Discover(ShapeTableBuilder builder) var displayShape = await displayManager.BuildDisplayAsync(contentItem, updateModelAccessor.ModelUpdater, displayType); - if (!String.IsNullOrEmpty(alternate)) + if (!string.IsNullOrEmpty(alternate)) { displayShape.Metadata.Alternates.Add(alternate); } diff --git a/src/OrchardCore.Modules/OrchardCore.Contents/Sitemaps/ContentTypesSitemapSourceBuilder.cs b/src/OrchardCore.Modules/OrchardCore.Contents/Sitemaps/ContentTypesSitemapSourceBuilder.cs index 71000e5ac17..2f3267480f9 100644 --- a/src/OrchardCore.Modules/OrchardCore.Contents/Sitemaps/ContentTypesSitemapSourceBuilder.cs +++ b/src/OrchardCore.Modules/OrchardCore.Contents/Sitemaps/ContentTypesSitemapSourceBuilder.cs @@ -106,7 +106,7 @@ private async Task PopulateChangeFrequencyPriority(ContentTypesSitemapSource sou var sitemapMetadataAspect = await _contentManager.PopulateAspectAsync(contentItem); var changeFrequencyValue = sitemapMetadataAspect.ChangeFrequency; - if (String.IsNullOrEmpty(changeFrequencyValue)) + if (string.IsNullOrEmpty(changeFrequencyValue)) { if (source.IndexAll) { @@ -119,7 +119,7 @@ private async Task PopulateChangeFrequencyPriority(ContentTypesSitemapSource sou else { var sitemapEntry = source.ContentTypes - .FirstOrDefault(ct => String.Equals(ct.ContentTypeName, contentItem.ContentType)); + .FirstOrDefault(ct => string.Equals(ct.ContentTypeName, contentItem.ContentType)); changeFrequencyValue = sitemapEntry.ChangeFrequency.ToString(); } @@ -139,7 +139,7 @@ private async Task PopulateChangeFrequencyPriority(ContentTypesSitemapSource sou else { var sitemapEntry = source.ContentTypes - .FirstOrDefault(ct => String.Equals(ct.ContentTypeName, contentItem.ContentType)); + .FirstOrDefault(ct => string.Equals(ct.ContentTypeName, contentItem.ContentType)); priorityIntValue = sitemapEntry.Priority; } diff --git a/src/OrchardCore.Modules/OrchardCore.Contents/Sitemaps/ContentTypesSitemapSourceDriver.cs b/src/OrchardCore.Modules/OrchardCore.Contents/Sitemaps/ContentTypesSitemapSourceDriver.cs index d7af8e90203..0a66205dd61 100644 --- a/src/OrchardCore.Modules/OrchardCore.Contents/Sitemaps/ContentTypesSitemapSourceDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Contents/Sitemaps/ContentTypesSitemapSourceDriver.cs @@ -1,4 +1,3 @@ -using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; @@ -39,9 +38,9 @@ public override IDisplayResult Edit(ContentTypesSitemapSource sitemapSource, IUp { ContentTypeName = ctd.Name, ContentTypeDisplayName = ctd.DisplayName, - IsChecked = sitemapSource.ContentTypes.Any(s => String.Equals(s.ContentTypeName, ctd.Name)), - ChangeFrequency = sitemapSource.ContentTypes.FirstOrDefault(s => String.Equals(s.ContentTypeName, ctd.Name))?.ChangeFrequency ?? ChangeFrequency.Daily, - Priority = sitemapSource.ContentTypes.FirstOrDefault(s => String.Equals(s.ContentTypeName, ctd.Name))?.Priority ?? 5, + IsChecked = sitemapSource.ContentTypes.Any(s => string.Equals(s.ContentTypeName, ctd.Name)), + ChangeFrequency = sitemapSource.ContentTypes.FirstOrDefault(s => string.Equals(s.ContentTypeName, ctd.Name))?.ChangeFrequency ?? ChangeFrequency.Daily, + Priority = sitemapSource.ContentTypes.FirstOrDefault(s => string.Equals(s.ContentTypeName, ctd.Name))?.Priority ?? 5, }) .OrderBy(ctd => ctd.ContentTypeDisplayName) .ToArray(); @@ -56,11 +55,11 @@ public override IDisplayResult Edit(ContentTypesSitemapSource sitemapSource, IUp .ToArray(); var limitedCtd = contentTypeDefinitions - .FirstOrDefault(ctd => String.Equals(sitemapSource.LimitedContentType.ContentTypeName, ctd.Name)); + .FirstOrDefault(ctd => string.Equals(sitemapSource.LimitedContentType.ContentTypeName, ctd.Name)); if (limitedCtd != null) { - var limitedEntry = limitedEntries.FirstOrDefault(le => String.Equals(le.ContentTypeName, limitedCtd.Name)); + var limitedEntry = limitedEntries.FirstOrDefault(le => string.Equals(le.ContentTypeName, limitedCtd.Name)); limitedEntry.Priority = sitemapSource.LimitedContentType.Priority; limitedEntry.ChangeFrequency = sitemapSource.LimitedContentType.ChangeFrequency; limitedEntry.Skip = sitemapSource.LimitedContentType.Skip; @@ -109,7 +108,7 @@ public override async Task UpdateAsync(ContentTypesSitemapSource }) .ToArray(); - var limitedEntry = model.LimitedContentTypes.FirstOrDefault(lct => String.Equals(lct.ContentTypeName, model.LimitedContentType)); + var limitedEntry = model.LimitedContentTypes.FirstOrDefault(lct => string.Equals(lct.ContentTypeName, model.LimitedContentType)); if (limitedEntry != null) { sitemap.LimitedContentType.ContentTypeName = limitedEntry.ContentTypeName; diff --git a/src/OrchardCore.Modules/OrchardCore.Contents/Sitemaps/ContentTypesSitemapSourceModifiedDateProvider.cs b/src/OrchardCore.Modules/OrchardCore.Contents/Sitemaps/ContentTypesSitemapSourceModifiedDateProvider.cs index b815a930b2e..d20b6cc205b 100644 --- a/src/OrchardCore.Modules/OrchardCore.Contents/Sitemaps/ContentTypesSitemapSourceModifiedDateProvider.cs +++ b/src/OrchardCore.Modules/OrchardCore.Contents/Sitemaps/ContentTypesSitemapSourceModifiedDateProvider.cs @@ -53,7 +53,7 @@ ISession session { var typesToIndex = _routeableContentTypeCoordinator .ListRoutableTypeDefinitions() - .Where(ctd => source.ContentTypes.Any(s => String.Equals(ctd.Name, s.ContentTypeName))) + .Where(ctd => source.ContentTypes.Any(s => string.Equals(ctd.Name, s.ContentTypeName))) .Select(ctd => ctd.Name); // This is an estimate, so doesn't take into account Take/Skip values. diff --git a/src/OrchardCore.Modules/OrchardCore.Contents/Sitemaps/ContentTypesSitemapSourceUpdateHandler.cs b/src/OrchardCore.Modules/OrchardCore.Contents/Sitemaps/ContentTypesSitemapSourceUpdateHandler.cs index e3bb56e9844..712d21f61d4 100644 --- a/src/OrchardCore.Modules/OrchardCore.Contents/Sitemaps/ContentTypesSitemapSourceUpdateHandler.cs +++ b/src/OrchardCore.Modules/OrchardCore.Contents/Sitemaps/ContentTypesSitemapSourceUpdateHandler.cs @@ -52,12 +52,12 @@ public async Task UpdateSitemapAsync(SitemapUpdateContext context) sitemap.Identifier = IdGenerator.GenerateId(); break; } - else if (source.LimitItems && String.Equals(source.LimitedContentType.ContentTypeName, contentTypeName)) + else if (source.LimitItems && string.Equals(source.LimitedContentType.ContentTypeName, contentTypeName)) { sitemap.Identifier = IdGenerator.GenerateId(); break; } - else if (source.ContentTypes.Any(ct => String.Equals(ct.ContentTypeName, contentTypeName))) + else if (source.ContentTypes.Any(ct => string.Equals(ct.ContentTypeName, contentTypeName))) { sitemap.Identifier = IdGenerator.GenerateId(); break; diff --git a/src/OrchardCore.Modules/OrchardCore.Contents/Sitemaps/DefaultContentItemsQueryProvider.cs b/src/OrchardCore.Modules/OrchardCore.Contents/Sitemaps/DefaultContentItemsQueryProvider.cs index 589231a0647..806f7710b82 100644 --- a/src/OrchardCore.Modules/OrchardCore.Contents/Sitemaps/DefaultContentItemsQueryProvider.cs +++ b/src/OrchardCore.Modules/OrchardCore.Contents/Sitemaps/DefaultContentItemsQueryProvider.cs @@ -44,7 +44,7 @@ public async Task GetContentItemsAsync(ContentTypesSitemapSource source, Content { // Test that content type is still valid to include in sitemap. var typeIsValid = routeableContentTypeDefinitions - .Any(ctd => String.Equals(source.LimitedContentType.ContentTypeName, ctd.Name)); + .Any(ctd => string.Equals(source.LimitedContentType.ContentTypeName, ctd.Name)); if (typeIsValid) { @@ -62,7 +62,7 @@ public async Task GetContentItemsAsync(ContentTypesSitemapSource source, Content { // Test that content types are still valid to include in sitemap. var typesToIndex = routeableContentTypeDefinitions - .Where(ctd => source.ContentTypes.Any(s => String.Equals(ctd.Name, s.ContentTypeName))) + .Where(ctd => source.ContentTypes.Any(s => string.Equals(ctd.Name, s.ContentTypeName))) .Select(x => x.Name); var queryResults = await _session.Query() diff --git a/src/OrchardCore.Modules/OrchardCore.Contents/ViewComponents/SelectContentTypesViewComponent.cs b/src/OrchardCore.Modules/OrchardCore.Contents/ViewComponents/SelectContentTypesViewComponent.cs index c3949bcf171..6b54de4531e 100644 --- a/src/OrchardCore.Modules/OrchardCore.Contents/ViewComponents/SelectContentTypesViewComponent.cs +++ b/src/OrchardCore.Modules/OrchardCore.Contents/ViewComponents/SelectContentTypesViewComponent.cs @@ -23,7 +23,7 @@ public IViewComponentResult Invoke(IEnumerable selectedContentTypes, str var contentTypes = ContentTypeSelection.Build(_contentDefinitionManager, selectedContentTypes); - if (!String.IsNullOrEmpty(stereotype)) + if (!string.IsNullOrEmpty(stereotype)) { contentTypes = contentTypes .Where(x => x.ContentTypeDefinition.GetStereotype() == stereotype) diff --git a/src/OrchardCore.Modules/OrchardCore.Contents/ViewModels/CommonPartSettingsViewModel.cs b/src/OrchardCore.Modules/OrchardCore.Contents/ViewModels/CommonPartSettingsViewModel.cs index 9b35c4c70c0..0e1b04a16e5 100644 --- a/src/OrchardCore.Modules/OrchardCore.Contents/ViewModels/CommonPartSettingsViewModel.cs +++ b/src/OrchardCore.Modules/OrchardCore.Contents/ViewModels/CommonPartSettingsViewModel.cs @@ -1,4 +1,4 @@ -namespace OrchardCore.Contents.ViewModels +namespace OrchardCore.Contents.ViewModels { public class CommonPartSettingsViewModel { diff --git a/src/OrchardCore.Modules/OrchardCore.Contents/Workflows/Activities/ContentActivity.cs b/src/OrchardCore.Modules/OrchardCore.Contents/Workflows/Activities/ContentActivity.cs index 9542edecd1e..72711504803 100644 --- a/src/OrchardCore.Modules/OrchardCore.Contents/Workflows/Activities/ContentActivity.cs +++ b/src/OrchardCore.Modules/OrchardCore.Contents/Workflows/Activities/ContentActivity.cs @@ -73,7 +73,7 @@ protected virtual async Task GetContentAsync(WorkflowExecutionContext IContent content; // Try to evaluate a content item from the Content expression, if provided. - if (!String.IsNullOrWhiteSpace(Content.Expression)) + if (!string.IsNullOrWhiteSpace(Content.Expression)) { var expression = new WorkflowExpression { Expression = Content.Expression }; var result = await ScriptEvaluator.EvaluateAsync(expression, workflowContext); diff --git a/src/OrchardCore.Modules/OrchardCore.Contents/Workflows/Activities/CreateContentTask.cs b/src/OrchardCore.Modules/OrchardCore.Contents/Workflows/Activities/CreateContentTask.cs index b5e0485c8d4..c7adb71012b 100644 --- a/src/OrchardCore.Modules/OrchardCore.Contents/Workflows/Activities/CreateContentTask.cs +++ b/src/OrchardCore.Modules/OrchardCore.Contents/Workflows/Activities/CreateContentTask.cs @@ -57,7 +57,7 @@ public WorkflowExpression ContentProperties public override bool CanExecute(WorkflowExecutionContext workflowContext, ActivityContext activityContext) { - return !String.IsNullOrEmpty(ContentType); + return !string.IsNullOrEmpty(ContentType); } public override IEnumerable GetPossibleOutcomes(WorkflowExecutionContext workflowContext, ActivityContext activityContext) @@ -92,7 +92,7 @@ public async override Task ExecuteAsync(WorkflowExecuti var contentItem = await ContentManager.NewAsync(ContentType); - if (!String.IsNullOrWhiteSpace(ContentProperties.Expression)) + if (!string.IsNullOrWhiteSpace(ContentProperties.Expression)) { var contentProperties = await _expressionEvaluator.EvaluateAsync(ContentProperties, workflowContext, _javaScriptEncoder); contentItem.Merge(JObject.Parse(contentProperties)); diff --git a/src/OrchardCore.Modules/OrchardCore.Contents/Workflows/Activities/DeleteContentTask.cs b/src/OrchardCore.Modules/OrchardCore.Contents/Workflows/Activities/DeleteContentTask.cs index 4056c61d064..7022ebc6185 100644 --- a/src/OrchardCore.Modules/OrchardCore.Contents/Workflows/Activities/DeleteContentTask.cs +++ b/src/OrchardCore.Modules/OrchardCore.Contents/Workflows/Activities/DeleteContentTask.cs @@ -32,7 +32,7 @@ public override async Task ExecuteAsync(WorkflowExecuti var content = (await GetContentAsync(workflowContext)) ?? throw new InvalidOperationException($"The '{nameof(DeleteContentTask)}' failed to retrieve the content item."); - if (String.Equals(InlineEvent.ContentItemId, content.ContentItem.ContentItemId, StringComparison.OrdinalIgnoreCase)) + if (string.Equals(InlineEvent.ContentItemId, content.ContentItem.ContentItemId, StringComparison.OrdinalIgnoreCase)) { return Outcomes("Noop"); } diff --git a/src/OrchardCore.Modules/OrchardCore.Contents/Workflows/Activities/PublishContentTask.cs b/src/OrchardCore.Modules/OrchardCore.Contents/Workflows/Activities/PublishContentTask.cs index 53eef95a2b2..f6919242a23 100644 --- a/src/OrchardCore.Modules/OrchardCore.Contents/Workflows/Activities/PublishContentTask.cs +++ b/src/OrchardCore.Modules/OrchardCore.Contents/Workflows/Activities/PublishContentTask.cs @@ -32,7 +32,7 @@ public override async Task ExecuteAsync(WorkflowExecuti var content = (await GetContentAsync(workflowContext)) ?? throw new InvalidOperationException($"The '{nameof(PublishContentTask)}' failed to retrieve the content item."); - if (String.Equals(InlineEvent.ContentItemId, content.ContentItem.ContentItemId, StringComparison.OrdinalIgnoreCase)) + if (string.Equals(InlineEvent.ContentItemId, content.ContentItem.ContentItemId, StringComparison.OrdinalIgnoreCase)) { return Outcomes("Noop"); } diff --git a/src/OrchardCore.Modules/OrchardCore.Contents/Workflows/Activities/UnpublishContentTask.cs b/src/OrchardCore.Modules/OrchardCore.Contents/Workflows/Activities/UnpublishContentTask.cs index b2d12f97b43..af2b8a4a3af 100644 --- a/src/OrchardCore.Modules/OrchardCore.Contents/Workflows/Activities/UnpublishContentTask.cs +++ b/src/OrchardCore.Modules/OrchardCore.Contents/Workflows/Activities/UnpublishContentTask.cs @@ -32,7 +32,7 @@ public override async Task ExecuteAsync(WorkflowExecuti var content = (await GetContentAsync(workflowContext)) ?? throw new InvalidOperationException($"The '{nameof(UnpublishContentTask)}' failed to retrieve the content item."); - if (String.Equals(InlineEvent.ContentItemId, content.ContentItem.ContentItemId, StringComparison.OrdinalIgnoreCase)) + if (string.Equals(InlineEvent.ContentItemId, content.ContentItem.ContentItemId, StringComparison.OrdinalIgnoreCase)) { return Outcomes("Noop"); } diff --git a/src/OrchardCore.Modules/OrchardCore.Contents/Workflows/Activities/UpdateContentTask.cs b/src/OrchardCore.Modules/OrchardCore.Contents/Workflows/Activities/UpdateContentTask.cs index 35c9a52cfe6..1400758cab5 100644 --- a/src/OrchardCore.Modules/OrchardCore.Contents/Workflows/Activities/UpdateContentTask.cs +++ b/src/OrchardCore.Modules/OrchardCore.Contents/Workflows/Activities/UpdateContentTask.cs @@ -70,7 +70,7 @@ public async override Task ExecuteAsync(WorkflowExecuti var contentItemId = (await GetContentItemIdAsync(workflowContext)) ?? throw new InvalidOperationException($"The {nameof(UpdateContentTask)} failed to evaluate the 'ContentItemId'."); - var inlineEventOfSameContentItemId = String.Equals(InlineEvent.ContentItemId, contentItemId, StringComparison.OrdinalIgnoreCase); + var inlineEventOfSameContentItemId = string.Equals(InlineEvent.ContentItemId, contentItemId, StringComparison.OrdinalIgnoreCase); if (inlineEventOfSameContentItemId) { @@ -119,7 +119,7 @@ public async override Task ExecuteAsync(WorkflowExecuti } } - if (!String.IsNullOrWhiteSpace(ContentProperties.Expression)) + if (!string.IsNullOrWhiteSpace(ContentProperties.Expression)) { var contentProperties = await _expressionEvaluator.EvaluateAsync(ContentProperties, workflowContext, _javaScriptEncoder); contentItem.Merge(JObject.Parse(contentProperties), new JsonMergeSettings { MergeArrayHandling = MergeArrayHandling.Replace }); @@ -157,7 +157,7 @@ public async override Task ExecuteAsync(WorkflowExecuti { _updateModelAccessor.ModelUpdater.ModelState.AddModelError(nameof(UpdateContentTask), $"The '{workflowContext.WorkflowType.Name}:{nameof(UpdateContentTask)}' failed to update the content item: " - + String.Join(", ", result.Errors)); + + string.Join(", ", result.Errors)); } workflowContext.LastResult = result; diff --git a/src/OrchardCore.Modules/OrchardCore.Contents/Workflows/Drivers/ContentEventDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.Contents/Workflows/Drivers/ContentEventDisplayDriver.cs index a149d89f978..2c93e512895 100644 --- a/src/OrchardCore.Modules/OrchardCore.Contents/Workflows/Drivers/ContentEventDisplayDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Contents/Workflows/Drivers/ContentEventDisplayDriver.cs @@ -61,7 +61,7 @@ public override IDisplayResult Display(TActivity activity) protected IEnumerable FilterContentTypesQuery(IEnumerable contentTypeNames) { var contentTypeDefinitions = ContentDefinitionManager.ListTypeDefinitions().ToDictionary(x => x.Name); - return contentTypeNames.Where(x => !String.IsNullOrWhiteSpace(x) && contentTypeDefinitions.ContainsKey(x)); + return contentTypeNames.Where(x => !string.IsNullOrWhiteSpace(x) && contentTypeDefinitions.ContainsKey(x)); } } } diff --git a/src/OrchardCore.Modules/OrchardCore.Cors/AdminMenu.cs b/src/OrchardCore.Modules/OrchardCore.Cors/AdminMenu.cs index a15f77f223a..f1397485da7 100644 --- a/src/OrchardCore.Modules/OrchardCore.Cors/AdminMenu.cs +++ b/src/OrchardCore.Modules/OrchardCore.Cors/AdminMenu.cs @@ -16,7 +16,7 @@ public AdminMenu(IStringLocalizer localizer) public Task BuildNavigationAsync(string name, NavigationBuilder builder) { - if (!String.Equals(name, "admin", StringComparison.OrdinalIgnoreCase)) + if (!string.Equals(name, "admin", StringComparison.OrdinalIgnoreCase)) { return Task.CompletedTask; } diff --git a/src/OrchardCore.Modules/OrchardCore.CustomSettings/AdminMenu.cs b/src/OrchardCore.Modules/OrchardCore.CustomSettings/AdminMenu.cs index d77447db40f..232f79c7958 100644 --- a/src/OrchardCore.Modules/OrchardCore.CustomSettings/AdminMenu.cs +++ b/src/OrchardCore.Modules/OrchardCore.CustomSettings/AdminMenu.cs @@ -22,7 +22,7 @@ public AdminMenu( public Task BuildNavigationAsync(string name, NavigationBuilder builder) { - if (!String.Equals(name, "admin", StringComparison.OrdinalIgnoreCase)) + if (!string.Equals(name, "admin", StringComparison.OrdinalIgnoreCase)) { return Task.CompletedTask; } diff --git a/src/OrchardCore.Modules/OrchardCore.CustomSettings/Permissions.cs b/src/OrchardCore.Modules/OrchardCore.CustomSettings/Permissions.cs index 1d894e98a9a..f0ecc1b286b 100644 --- a/src/OrchardCore.Modules/OrchardCore.CustomSettings/Permissions.cs +++ b/src/OrchardCore.Modules/OrchardCore.CustomSettings/Permissions.cs @@ -33,14 +33,14 @@ public Task> GetPermissionsAsync() public static string CreatePermissionName(string name) { - return String.Format(_manageCustomSettings.Name, name); + return string.Format(_manageCustomSettings.Name, name); } public static Permission CreatePermissionForType(ContentTypeDefinition type) { return new Permission( CreatePermissionName(type.Name), - String.Format(_manageCustomSettings.Description, type.DisplayName), + string.Format(_manageCustomSettings.Description, type.DisplayName), _manageCustomSettings.ImpliedBy ); } diff --git a/src/OrchardCore.Modules/OrchardCore.CustomSettings/Recipes/CustomSettingsStep.cs b/src/OrchardCore.Modules/OrchardCore.CustomSettings/Recipes/CustomSettingsStep.cs index df85bd7285b..d156fc4bfd6 100644 --- a/src/OrchardCore.Modules/OrchardCore.CustomSettings/Recipes/CustomSettingsStep.cs +++ b/src/OrchardCore.Modules/OrchardCore.CustomSettings/Recipes/CustomSettingsStep.cs @@ -21,7 +21,7 @@ public CustomSettingsStep(ISiteService siteService) public async Task ExecuteAsync(RecipeExecutionContext context) { - if (!String.Equals(context.Name, "custom-settings", StringComparison.OrdinalIgnoreCase)) + if (!string.Equals(context.Name, "custom-settings", StringComparison.OrdinalIgnoreCase)) { return; } diff --git a/src/OrchardCore.Modules/OrchardCore.DataProtection.Azure/Startup.cs b/src/OrchardCore.Modules/OrchardCore.DataProtection.Azure/Startup.cs index 20a2f1b0a0c..d876d0fee2d 100644 --- a/src/OrchardCore.Modules/OrchardCore.DataProtection.Azure/Startup.cs +++ b/src/OrchardCore.Modules/OrchardCore.DataProtection.Azure/Startup.cs @@ -39,7 +39,7 @@ public override void ConfigureServices(IServiceCollection services) { var connectionString = _configuration.GetValue("OrchardCore_DataProtection_Azure:ConnectionString"); - if (!String.IsNullOrWhiteSpace(connectionString)) + if (!string.IsNullOrWhiteSpace(connectionString)) { services.AddDataProtection().PersistKeysToAzureBlobStorage(connectionString, GetBlobContainerName(connectionString), GetBlobName()); } @@ -65,7 +65,7 @@ private string GetBlobContainerName(string connectionString) // container name must be lowercase containerName = template.Render(templateContext, NullEncoder.Default).ToLower(); - containerName = containerName.Replace("\r", String.Empty).Replace("\n", String.Empty); + containerName = containerName.Replace("\r", string.Empty).Replace("\n", string.Empty); } catch (Exception e) { @@ -98,7 +98,7 @@ private string GetBlobName() { var blobName = _configuration.GetValue("OrchardCore_DataProtection_Azure:BlobName"); - if (String.IsNullOrEmpty(blobName)) + if (string.IsNullOrEmpty(blobName)) { blobName = $"{_shellOptions.ShellsContainerName}/{_shellSettings.Name}/DataProtectionKeys.xml"; } @@ -115,7 +115,7 @@ private string GetBlobName() var template = _fluidParser.Parse(blobName); blobName = template.Render(templateContext, NullEncoder.Default); - blobName = blobName.Replace("\r", String.Empty).Replace("\n", String.Empty); + blobName = blobName.Replace("\r", string.Empty).Replace("\n", string.Empty); } catch (Exception e) { diff --git a/src/OrchardCore.Modules/OrchardCore.Demo/AdminMenu.cs b/src/OrchardCore.Modules/OrchardCore.Demo/AdminMenu.cs index 5ae2046e3d6..923b6e03631 100644 --- a/src/OrchardCore.Modules/OrchardCore.Demo/AdminMenu.cs +++ b/src/OrchardCore.Modules/OrchardCore.Demo/AdminMenu.cs @@ -16,7 +16,7 @@ public AdminMenu(IStringLocalizer localizer) public Task BuildNavigationAsync(string name, NavigationBuilder builder) { - if (!String.Equals(name, "admin", StringComparison.OrdinalIgnoreCase)) + if (!string.Equals(name, "admin", StringComparison.OrdinalIgnoreCase)) { return Task.CompletedTask; } diff --git a/src/OrchardCore.Modules/OrchardCore.Deployment.Remote/AdminMenu.cs b/src/OrchardCore.Modules/OrchardCore.Deployment.Remote/AdminMenu.cs index 72d7f50619e..11e3e3639bd 100644 --- a/src/OrchardCore.Modules/OrchardCore.Deployment.Remote/AdminMenu.cs +++ b/src/OrchardCore.Modules/OrchardCore.Deployment.Remote/AdminMenu.cs @@ -16,7 +16,7 @@ public AdminMenu(IStringLocalizer localizer) public Task BuildNavigationAsync(string name, NavigationBuilder builder) { - if (!String.Equals(name, "admin", StringComparison.OrdinalIgnoreCase)) + if (!string.Equals(name, "admin", StringComparison.OrdinalIgnoreCase)) { return Task.CompletedTask; } diff --git a/src/OrchardCore.Modules/OrchardCore.Deployment.Remote/Controllers/ExportRemoteInstanceController.cs b/src/OrchardCore.Modules/OrchardCore.Deployment.Remote/Controllers/ExportRemoteInstanceController.cs index 6951c86b943..94177a6f417 100644 --- a/src/OrchardCore.Modules/OrchardCore.Deployment.Remote/Controllers/ExportRemoteInstanceController.cs +++ b/src/OrchardCore.Modules/OrchardCore.Deployment.Remote/Controllers/ExportRemoteInstanceController.cs @@ -117,7 +117,7 @@ public async Task Execute(long id, string remoteInstanceId, strin System.IO.File.Delete(archiveFileName); } - if (!String.IsNullOrEmpty(returnUrl)) + if (!string.IsNullOrEmpty(returnUrl)) { return this.LocalRedirect(returnUrl, true); } diff --git a/src/OrchardCore.Modules/OrchardCore.Deployment.Remote/Controllers/RemoteClientController.cs b/src/OrchardCore.Modules/OrchardCore.Deployment.Remote/Controllers/RemoteClientController.cs index c8126574c0f..86516dbe9cc 100644 --- a/src/OrchardCore.Modules/OrchardCore.Deployment.Remote/Controllers/RemoteClientController.cs +++ b/src/OrchardCore.Modules/OrchardCore.Deployment.Remote/Controllers/RemoteClientController.cs @@ -66,7 +66,7 @@ public async Task Index(ContentOptions options, PagerParameters p var remoteClients = (await _remoteClientService.GetRemoteClientListAsync()).RemoteClients; - if (!String.IsNullOrWhiteSpace(options.Search)) + if (!string.IsNullOrWhiteSpace(options.Search)) { remoteClients = remoteClients.Where(x => x.ClientName.Contains(options.Search, StringComparison.OrdinalIgnoreCase)).ToList(); } @@ -256,12 +256,12 @@ public async Task IndexPost(ViewModels.ContentOptions options, IEn private void ValidateViewModel(EditRemoteClientViewModel model) { - if (String.IsNullOrWhiteSpace(model.ClientName)) + if (string.IsNullOrWhiteSpace(model.ClientName)) { ModelState.AddModelError(nameof(EditRemoteClientViewModel.ClientName), S["The client name is mandatory."]); } - if (String.IsNullOrWhiteSpace(model.ApiKey)) + if (string.IsNullOrWhiteSpace(model.ApiKey)) { ModelState.AddModelError(nameof(EditRemoteClientViewModel.ApiKey), S["The api key is mandatory."]); } diff --git a/src/OrchardCore.Modules/OrchardCore.Deployment.Remote/Controllers/RemoteInstanceController.cs b/src/OrchardCore.Modules/OrchardCore.Deployment.Remote/Controllers/RemoteInstanceController.cs index ac6eed7a81d..d3e23e2f1ab 100644 --- a/src/OrchardCore.Modules/OrchardCore.Deployment.Remote/Controllers/RemoteInstanceController.cs +++ b/src/OrchardCore.Modules/OrchardCore.Deployment.Remote/Controllers/RemoteInstanceController.cs @@ -61,7 +61,7 @@ public async Task Index(ContentOptions options, PagerParameters p var remoteInstances = (await _service.GetRemoteInstanceListAsync()).RemoteInstances; - if (!String.IsNullOrWhiteSpace(options.Search)) + if (!string.IsNullOrWhiteSpace(options.Search)) { remoteInstances = remoteInstances.Where(x => x.Name.Contains(options.Search, StringComparison.OrdinalIgnoreCase)).ToList(); } @@ -251,22 +251,22 @@ public async Task IndexPost(ViewModels.ContentOptions options, IEn private void ValidateViewModel(EditRemoteInstanceViewModel model) { - if (String.IsNullOrWhiteSpace(model.Name)) + if (string.IsNullOrWhiteSpace(model.Name)) { ModelState.AddModelError(nameof(EditRemoteInstanceViewModel.Name), S["The name is mandatory."]); } - if (String.IsNullOrWhiteSpace(model.ClientName)) + if (string.IsNullOrWhiteSpace(model.ClientName)) { ModelState.AddModelError(nameof(EditRemoteInstanceViewModel.ClientName), S["The client name is mandatory."]); } - if (String.IsNullOrWhiteSpace(model.ApiKey)) + if (string.IsNullOrWhiteSpace(model.ApiKey)) { ModelState.AddModelError(nameof(EditRemoteInstanceViewModel.ApiKey), S["The api key is mandatory."]); } - if (String.IsNullOrWhiteSpace(model.Url)) + if (string.IsNullOrWhiteSpace(model.Url)) { ModelState.AddModelError(nameof(EditRemoteInstanceViewModel.Url), S["The url is mandatory."]); } diff --git a/src/OrchardCore.Modules/OrchardCore.Deployment.Remote/Models/RemoteClientList.cs b/src/OrchardCore.Modules/OrchardCore.Deployment.Remote/Models/RemoteClientList.cs index 76f2d7c447c..c57008fad4e 100644 --- a/src/OrchardCore.Modules/OrchardCore.Deployment.Remote/Models/RemoteClientList.cs +++ b/src/OrchardCore.Modules/OrchardCore.Deployment.Remote/Models/RemoteClientList.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; namespace OrchardCore.Deployment.Remote.Models { diff --git a/src/OrchardCore.Modules/OrchardCore.Deployment.Remote/Models/RemoteInstance.cs b/src/OrchardCore.Modules/OrchardCore.Deployment.Remote/Models/RemoteInstance.cs index d97c2432948..d6f450510fc 100644 --- a/src/OrchardCore.Modules/OrchardCore.Deployment.Remote/Models/RemoteInstance.cs +++ b/src/OrchardCore.Modules/OrchardCore.Deployment.Remote/Models/RemoteInstance.cs @@ -1,4 +1,4 @@ -namespace OrchardCore.Deployment.Remote.Models +namespace OrchardCore.Deployment.Remote.Models { public class RemoteInstance { diff --git a/src/OrchardCore.Modules/OrchardCore.Deployment.Remote/Properties/AssemblyInfo.cs b/src/OrchardCore.Modules/OrchardCore.Deployment.Remote/Properties/AssemblyInfo.cs index 12b0a7d4d5c..b34f71247c4 100644 --- a/src/OrchardCore.Modules/OrchardCore.Deployment.Remote/Properties/AssemblyInfo.cs +++ b/src/OrchardCore.Modules/OrchardCore.Deployment.Remote/Properties/AssemblyInfo.cs @@ -1,4 +1,4 @@ -using System.Reflection; +using System.Reflection; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following diff --git a/src/OrchardCore.Modules/OrchardCore.Deployment.Remote/Services/RemoteClientService.cs b/src/OrchardCore.Modules/OrchardCore.Deployment.Remote/Services/RemoteClientService.cs index e9244d762a7..b6215d569ea 100644 --- a/src/OrchardCore.Modules/OrchardCore.Deployment.Remote/Services/RemoteClientService.cs +++ b/src/OrchardCore.Modules/OrchardCore.Deployment.Remote/Services/RemoteClientService.cs @@ -45,7 +45,7 @@ public async Task GetRemoteClientListAsync() public async Task GetRemoteClientAsync(string id) { var remoteClientList = await GetRemoteClientListAsync(); - return remoteClientList.RemoteClients.FirstOrDefault(x => String.Equals(x.Id, id, StringComparison.OrdinalIgnoreCase)); + return remoteClientList.RemoteClients.FirstOrDefault(x => string.Equals(x.Id, id, StringComparison.OrdinalIgnoreCase)); } public async Task DeleteRemoteClientAsync(string id) diff --git a/src/OrchardCore.Modules/OrchardCore.Deployment.Remote/Services/RemoteInstanceService.cs b/src/OrchardCore.Modules/OrchardCore.Deployment.Remote/Services/RemoteInstanceService.cs index 423796960df..d81c968dd18 100644 --- a/src/OrchardCore.Modules/OrchardCore.Deployment.Remote/Services/RemoteInstanceService.cs +++ b/src/OrchardCore.Modules/OrchardCore.Deployment.Remote/Services/RemoteInstanceService.cs @@ -76,6 +76,6 @@ public async Task UpdateRemoteInstance(string id, string name, string url, strin } private static RemoteInstance FindRemoteInstance(RemoteInstanceList remoteInstanceList, string id) => - remoteInstanceList.RemoteInstances.FirstOrDefault(x => String.Equals(x.Id, id, StringComparison.OrdinalIgnoreCase)); + remoteInstanceList.RemoteInstances.FirstOrDefault(x => string.Equals(x.Id, id, StringComparison.OrdinalIgnoreCase)); } } diff --git a/src/OrchardCore.Modules/OrchardCore.Deployment.Remote/ViewModels/EditRemoteClientViewModel.cs b/src/OrchardCore.Modules/OrchardCore.Deployment.Remote/ViewModels/EditRemoteClientViewModel.cs index da7a669ece2..a7d705f0aec 100644 --- a/src/OrchardCore.Modules/OrchardCore.Deployment.Remote/ViewModels/EditRemoteClientViewModel.cs +++ b/src/OrchardCore.Modules/OrchardCore.Deployment.Remote/ViewModels/EditRemoteClientViewModel.cs @@ -1,4 +1,4 @@ -namespace OrchardCore.Deployment.Remote.ViewModels +namespace OrchardCore.Deployment.Remote.ViewModels { public class EditRemoteClientViewModel { diff --git a/src/OrchardCore.Modules/OrchardCore.Deployment.Remote/ViewModels/RemoteClientIndexViewModel.cs b/src/OrchardCore.Modules/OrchardCore.Deployment.Remote/ViewModels/RemoteClientIndexViewModel.cs index 46b5736247c..b7b57a8c0b6 100644 --- a/src/OrchardCore.Modules/OrchardCore.Deployment.Remote/ViewModels/RemoteClientIndexViewModel.cs +++ b/src/OrchardCore.Modules/OrchardCore.Deployment.Remote/ViewModels/RemoteClientIndexViewModel.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using Microsoft.AspNetCore.Mvc.ModelBinding; using Microsoft.AspNetCore.Mvc.Rendering; using OrchardCore.Deployment.Remote.Models; diff --git a/src/OrchardCore.Modules/OrchardCore.Deployment.Remote/ViewModels/RemoteInstanceIndexViewModel.cs b/src/OrchardCore.Modules/OrchardCore.Deployment.Remote/ViewModels/RemoteInstanceIndexViewModel.cs index a7e913698b4..03edb549759 100644 --- a/src/OrchardCore.Modules/OrchardCore.Deployment.Remote/ViewModels/RemoteInstanceIndexViewModel.cs +++ b/src/OrchardCore.Modules/OrchardCore.Deployment.Remote/ViewModels/RemoteInstanceIndexViewModel.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using Microsoft.AspNetCore.Mvc.ModelBinding; using OrchardCore.Deployment.Remote.Models; diff --git a/src/OrchardCore.Modules/OrchardCore.Deployment/AdminMenu.cs b/src/OrchardCore.Modules/OrchardCore.Deployment/AdminMenu.cs index 8d8a0e771a4..9630bb5924c 100644 --- a/src/OrchardCore.Modules/OrchardCore.Deployment/AdminMenu.cs +++ b/src/OrchardCore.Modules/OrchardCore.Deployment/AdminMenu.cs @@ -16,7 +16,7 @@ public AdminMenu(IStringLocalizer localizer) public Task BuildNavigationAsync(string name, NavigationBuilder builder) { - if (!String.Equals(name, "admin", StringComparison.OrdinalIgnoreCase)) + if (!string.Equals(name, "admin", StringComparison.OrdinalIgnoreCase)) { return Task.CompletedTask; } diff --git a/src/OrchardCore.Modules/OrchardCore.Deployment/Controllers/DeploymentPlanController.cs b/src/OrchardCore.Modules/OrchardCore.Deployment/Controllers/DeploymentPlanController.cs index a13f3c026de..bd93cb65cd2 100644 --- a/src/OrchardCore.Modules/OrchardCore.Deployment/Controllers/DeploymentPlanController.cs +++ b/src/OrchardCore.Modules/OrchardCore.Deployment/Controllers/DeploymentPlanController.cs @@ -75,7 +75,7 @@ public async Task Index(ContentOptions options, PagerParameters p var deploymentPlans = _session.Query(); - if (!String.IsNullOrWhiteSpace(options.Search)) + if (!string.IsNullOrWhiteSpace(options.Search)) { deploymentPlans = deploymentPlans.Where(x => x.Name.Contains(options.Search)); } @@ -211,7 +211,7 @@ public async Task Create(CreateDeploymentPlanViewModel model) if (ModelState.IsValid) { - if (String.IsNullOrWhiteSpace(model.Name)) + if (string.IsNullOrWhiteSpace(model.Name)) { ModelState.AddModelError(nameof(CreateDeploymentPlanViewModel.Name), S["The name is mandatory."]); } @@ -276,11 +276,11 @@ public async Task Edit(EditDeploymentPlanViewModel model) if (ModelState.IsValid) { - if (String.IsNullOrWhiteSpace(model.Name)) + if (string.IsNullOrWhiteSpace(model.Name)) { ModelState.AddModelError(nameof(EditDeploymentPlanViewModel.Name), S["The name is mandatory."]); } - if (!String.Equals(model.Name, deploymentPlan.Name, StringComparison.OrdinalIgnoreCase)) + if (!string.Equals(model.Name, deploymentPlan.Name, StringComparison.OrdinalIgnoreCase)) { var count = await _session.QueryIndex(x => x.Name == model.Name && x.DocumentId != model.Id).CountAsync(); if (count > 0) diff --git a/src/OrchardCore.Modules/OrchardCore.Deployment/Controllers/StepController.cs b/src/OrchardCore.Modules/OrchardCore.Deployment/Controllers/StepController.cs index 3cd474648e6..e1ee199b0ed 100644 --- a/src/OrchardCore.Modules/OrchardCore.Deployment/Controllers/StepController.cs +++ b/src/OrchardCore.Modules/OrchardCore.Deployment/Controllers/StepController.cs @@ -138,7 +138,7 @@ public async Task Edit(long id, string stepId) return NotFound(); } - var step = deploymentPlan.DeploymentSteps.FirstOrDefault(x => String.Equals(x.Id, stepId, StringComparison.OrdinalIgnoreCase)); + var step = deploymentPlan.DeploymentSteps.FirstOrDefault(x => string.Equals(x.Id, stepId, StringComparison.OrdinalIgnoreCase)); if (step == null) { @@ -174,7 +174,7 @@ public async Task Edit(EditDeploymentPlanStepViewModel model) return NotFound(); } - var step = deploymentPlan.DeploymentSteps.FirstOrDefault(x => String.Equals(x.Id, model.DeploymentStepId, StringComparison.OrdinalIgnoreCase)); + var step = deploymentPlan.DeploymentSteps.FirstOrDefault(x => string.Equals(x.Id, model.DeploymentStepId, StringComparison.OrdinalIgnoreCase)); if (step == null) { @@ -213,7 +213,7 @@ public async Task Delete(long id, string stepId) return NotFound(); } - var step = deploymentPlan.DeploymentSteps.FirstOrDefault(x => String.Equals(x.Id, stepId, StringComparison.OrdinalIgnoreCase)); + var step = deploymentPlan.DeploymentSteps.FirstOrDefault(x => string.Equals(x.Id, stepId, StringComparison.OrdinalIgnoreCase)); if (step == null) { diff --git a/src/OrchardCore.Modules/OrchardCore.Deployment/Properties/AssemblyInfo.cs b/src/OrchardCore.Modules/OrchardCore.Deployment/Properties/AssemblyInfo.cs index 4db75209fd4..d153d2a2f58 100644 --- a/src/OrchardCore.Modules/OrchardCore.Deployment/Properties/AssemblyInfo.cs +++ b/src/OrchardCore.Modules/OrchardCore.Deployment/Properties/AssemblyInfo.cs @@ -1,4 +1,4 @@ -using System.Reflection; +using System.Reflection; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following diff --git a/src/OrchardCore.Modules/OrchardCore.Deployment/Recipes/DeploymentPlansRecipeStep.cs b/src/OrchardCore.Modules/OrchardCore.Deployment/Recipes/DeploymentPlansRecipeStep.cs index f7f067fb30b..e2cd3eec9a9 100644 --- a/src/OrchardCore.Modules/OrchardCore.Deployment/Recipes/DeploymentPlansRecipeStep.cs +++ b/src/OrchardCore.Modules/OrchardCore.Deployment/Recipes/DeploymentPlansRecipeStep.cs @@ -27,7 +27,7 @@ public DeploymentPlansRecipeStep( public Task ExecuteAsync(RecipeExecutionContext context) { - if (!String.Equals(context.Name, "deployment", StringComparison.OrdinalIgnoreCase)) + if (!string.Equals(context.Name, "deployment", StringComparison.OrdinalIgnoreCase)) { return Task.CompletedTask; } @@ -68,7 +68,7 @@ public Task ExecuteAsync(RecipeExecutionContext context) var prefix = "No changes have been made. The following types of deployment plans cannot be added:"; var suffix = "Please ensure that the related features are enabled to add these types of deployment plans."; - throw new InvalidOperationException($"{prefix} {String.Join(", ", unknownTypes)}. {suffix}"); + throw new InvalidOperationException($"{prefix} {string.Join(", ", unknownTypes)}. {suffix}"); } return _deploymentPlanService.CreateOrUpdateDeploymentPlansAsync(deploymentPlans); diff --git a/src/OrchardCore.Modules/OrchardCore.Deployment/Steps/CustomFileDeploymentSource.cs b/src/OrchardCore.Modules/OrchardCore.Deployment/Steps/CustomFileDeploymentSource.cs index 0944e637426..677ad1323f8 100644 --- a/src/OrchardCore.Modules/OrchardCore.Deployment/Steps/CustomFileDeploymentSource.cs +++ b/src/OrchardCore.Modules/OrchardCore.Deployment/Steps/CustomFileDeploymentSource.cs @@ -1,4 +1,4 @@ -using System.Text; +using System.Text; using System.Threading.Tasks; namespace OrchardCore.Deployment.Steps diff --git a/src/OrchardCore.Modules/OrchardCore.Deployment/ViewModels/CreateDeploymentPlanViewModel.cs b/src/OrchardCore.Modules/OrchardCore.Deployment/ViewModels/CreateDeploymentPlanViewModel.cs index 93a8abfa9ab..af6a66d2f2d 100644 --- a/src/OrchardCore.Modules/OrchardCore.Deployment/ViewModels/CreateDeploymentPlanViewModel.cs +++ b/src/OrchardCore.Modules/OrchardCore.Deployment/ViewModels/CreateDeploymentPlanViewModel.cs @@ -1,4 +1,4 @@ -using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations; namespace OrchardCore.Deployment.ViewModels { diff --git a/src/OrchardCore.Modules/OrchardCore.Deployment/ViewModels/DisplayDeploymentPlanViewModel.cs b/src/OrchardCore.Modules/OrchardCore.Deployment/ViewModels/DisplayDeploymentPlanViewModel.cs index adea6b5bdc2..059d797003e 100644 --- a/src/OrchardCore.Modules/OrchardCore.Deployment/ViewModels/DisplayDeploymentPlanViewModel.cs +++ b/src/OrchardCore.Modules/OrchardCore.Deployment/ViewModels/DisplayDeploymentPlanViewModel.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; namespace OrchardCore.Deployment.ViewModels { diff --git a/src/OrchardCore.Modules/OrchardCore.Diagnostics/Properties/AssemblyInfo.cs b/src/OrchardCore.Modules/OrchardCore.Diagnostics/Properties/AssemblyInfo.cs index c6ff8d191d0..a637a6d2a06 100644 --- a/src/OrchardCore.Modules/OrchardCore.Diagnostics/Properties/AssemblyInfo.cs +++ b/src/OrchardCore.Modules/OrchardCore.Diagnostics/Properties/AssemblyInfo.cs @@ -1,4 +1,4 @@ -using System.Reflection; +using System.Reflection; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following diff --git a/src/OrchardCore.Modules/OrchardCore.DynamicCache/CachedShapeWrapperShapes.cs b/src/OrchardCore.Modules/OrchardCore.DynamicCache/CachedShapeWrapperShapes.cs index 1e8e065dba7..7e39fbbf843 100644 --- a/src/OrchardCore.Modules/OrchardCore.DynamicCache/CachedShapeWrapperShapes.cs +++ b/src/OrchardCore.Modules/OrchardCore.DynamicCache/CachedShapeWrapperShapes.cs @@ -21,8 +21,8 @@ public IHtmlContent CachedShapeWrapper(IShape Shape) contentBuilder.AppendLine(); contentBuilder.AppendHtmlLine($"\n\n\n"); } diff --git a/src/OrchardCore.Modules/OrchardCore.Google/Authentication/Configuration/GoogleOptionsConfiguration.cs b/src/OrchardCore.Modules/OrchardCore.Google/Authentication/Configuration/GoogleOptionsConfiguration.cs index 1b78382813d..9923b66772e 100644 --- a/src/OrchardCore.Modules/OrchardCore.Google/Authentication/Configuration/GoogleOptionsConfiguration.cs +++ b/src/OrchardCore.Modules/OrchardCore.Google/Authentication/Configuration/GoogleOptionsConfiguration.cs @@ -43,7 +43,7 @@ public void Configure(AuthenticationOptions options) public void Configure(string name, GoogleOptions options) { - if (!String.Equals(name, GoogleDefaults.AuthenticationScheme)) + if (!string.Equals(name, GoogleDefaults.AuthenticationScheme)) { return; } diff --git a/src/OrchardCore.Modules/OrchardCore.Google/Authentication/Services/GoogleAuthenticationService.cs b/src/OrchardCore.Modules/OrchardCore.Google/Authentication/Services/GoogleAuthenticationService.cs index 33048ac7cc3..91f7d699ef0 100644 --- a/src/OrchardCore.Modules/OrchardCore.Google/Authentication/Services/GoogleAuthenticationService.cs +++ b/src/OrchardCore.Modules/OrchardCore.Google/Authentication/Services/GoogleAuthenticationService.cs @@ -61,7 +61,7 @@ public IEnumerable ValidateSettings(GoogleAuthenticationSettin var results = new List(); - if (String.IsNullOrEmpty(settings.ClientID)) + if (string.IsNullOrEmpty(settings.ClientID)) { results.Add(new ValidationResult(S["The Client ID is required."], new[] { @@ -69,7 +69,7 @@ public IEnumerable ValidateSettings(GoogleAuthenticationSettin })); } - if (String.IsNullOrEmpty(settings.ClientSecret)) + if (string.IsNullOrEmpty(settings.ClientSecret)) { results.Add(new ValidationResult(S["The Client Secret is required."], new[] { diff --git a/src/OrchardCore.Modules/OrchardCore.Google/GoogleAuthenticationAdminMenu.cs b/src/OrchardCore.Modules/OrchardCore.Google/GoogleAuthenticationAdminMenu.cs index 1da9d0dc2f9..d3e986ade47 100644 --- a/src/OrchardCore.Modules/OrchardCore.Google/GoogleAuthenticationAdminMenu.cs +++ b/src/OrchardCore.Modules/OrchardCore.Google/GoogleAuthenticationAdminMenu.cs @@ -18,7 +18,7 @@ public GoogleAuthenticationAdminMenu(IStringLocalizer security .Add(S["Authentication"], authentication => authentication @@ -45,7 +45,7 @@ public GoogleAnalyticsAdminMenu(IStringLocalizer local public Task BuildNavigationAsync(string name, NavigationBuilder builder) { - if (String.Equals(name, "admin", StringComparison.OrdinalIgnoreCase)) + if (string.Equals(name, "admin", StringComparison.OrdinalIgnoreCase)) { builder.Add(S["Configuration"], configuration => configuration .Add(S["Settings"], settings => settings @@ -73,7 +73,7 @@ public GoogleTagManagerAdminMenu(IStringLocalizer loc public Task BuildNavigationAsync(string name, NavigationBuilder builder) { - if (String.Equals(name, "admin", StringComparison.OrdinalIgnoreCase)) + if (string.Equals(name, "admin", StringComparison.OrdinalIgnoreCase)) { builder.Add(S["Configuration"], configuration => configuration .Add(S["Settings"], settings => settings diff --git a/src/OrchardCore.Modules/OrchardCore.Google/TagManager/GoogleTagManagerFilter.cs b/src/OrchardCore.Modules/OrchardCore.Google/TagManager/GoogleTagManagerFilter.cs index 9b762f24ee2..508d45bd59c 100644 --- a/src/OrchardCore.Modules/OrchardCore.Google/TagManager/GoogleTagManagerFilter.cs +++ b/src/OrchardCore.Modules/OrchardCore.Google/TagManager/GoogleTagManagerFilter.cs @@ -37,7 +37,7 @@ public async Task OnResultExecutionAsync(ResultExecutingContext context, ResultE { var settings = (await _siteService.GetSiteSettingsAsync()).As(); - if (!String.IsNullOrWhiteSpace(settings?.ContainerID)) + if (!string.IsNullOrWhiteSpace(settings?.ContainerID)) { _scriptsCache = new HtmlString("\n\n"); } diff --git a/src/OrchardCore.Modules/OrchardCore.HomeRoute/Routing/HomeRouteValuesAddressScheme.cs b/src/OrchardCore.Modules/OrchardCore.HomeRoute/Routing/HomeRouteValuesAddressScheme.cs index 5853f2f1219..9f166c26398 100644 --- a/src/OrchardCore.Modules/OrchardCore.HomeRoute/Routing/HomeRouteValuesAddressScheme.cs +++ b/src/OrchardCore.Modules/OrchardCore.HomeRoute/Routing/HomeRouteValuesAddressScheme.cs @@ -45,7 +45,7 @@ public IEnumerable FindEndpoints(RouteValuesAddress address) var endpoint = new RouteEndpoint ( c => null, - RoutePatternFactory.Parse(String.Empty, routeValues, null), + RoutePatternFactory.Parse(string.Empty, routeValues, null), 0, null, null @@ -66,7 +66,7 @@ private static bool Match(RouteValueDictionary routeValues, RouteValueDictionary foreach (var entry in routeValues) { - if (!String.Equals(explicitValues[entry.Key]?.ToString(), entry.Value?.ToString(), StringComparison.OrdinalIgnoreCase)) + if (!string.Equals(explicitValues[entry.Key]?.ToString(), entry.Value?.ToString(), StringComparison.OrdinalIgnoreCase)) { return false; } diff --git a/src/OrchardCore.Modules/OrchardCore.Html/Drivers/HtmlBodyPartDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.Html/Drivers/HtmlBodyPartDisplayDriver.cs index d38cb326378..f63b118dad8 100644 --- a/src/OrchardCore.Modules/OrchardCore.Html/Drivers/HtmlBodyPartDisplayDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Html/Drivers/HtmlBodyPartDisplayDriver.cs @@ -67,10 +67,10 @@ public override async Task UpdateAsync(HtmlBodyPart model, IUpda if (await updater.TryUpdateModelAsync(viewModel, Prefix, t => t.Html)) { - if (!String.IsNullOrEmpty(viewModel.Html) && !_liquidTemplateManager.Validate(viewModel.Html, out var errors)) + if (!string.IsNullOrEmpty(viewModel.Html) && !_liquidTemplateManager.Validate(viewModel.Html, out var errors)) { var partName = context.TypePartDefinition.DisplayName(); - updater.ModelState.AddModelError(Prefix, nameof(viewModel.Html), S["{0} doesn't contain a valid Liquid expression. Details: {1}", partName, String.Join(" ", errors)]); + updater.ModelState.AddModelError(Prefix, nameof(viewModel.Html), S["{0} doesn't contain a valid Liquid expression. Details: {1}", partName, string.Join(" ", errors)]); } else { diff --git a/src/OrchardCore.Modules/OrchardCore.Html/Migrations.cs b/src/OrchardCore.Modules/OrchardCore.Html/Migrations.cs index 5fe76059c37..e710e991ccc 100644 --- a/src/OrchardCore.Modules/OrchardCore.Html/Migrations.cs +++ b/src/OrchardCore.Modules/OrchardCore.Html/Migrations.cs @@ -104,7 +104,7 @@ static bool UpdateBody(JToken content) { var body = content["BodyPart"]?["Body"]?.Value(); - if (!String.IsNullOrWhiteSpace(body)) + if (!string.IsNullOrWhiteSpace(body)) { content["HtmlBodyPart"] = new JObject(new JProperty("Html", body)); changed = true; diff --git a/src/OrchardCore.Modules/OrchardCore.Html/Settings/HtmlBodyPartMonacoEditorSettingsDriver.cs b/src/OrchardCore.Modules/OrchardCore.Html/Settings/HtmlBodyPartMonacoEditorSettingsDriver.cs index 3a451d2c577..647dd3ed05c 100644 --- a/src/OrchardCore.Modules/OrchardCore.Html/Settings/HtmlBodyPartMonacoEditorSettingsDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Html/Settings/HtmlBodyPartMonacoEditorSettingsDriver.cs @@ -27,7 +27,7 @@ public override IDisplayResult Edit(ContentTypePartDefinition contentTypePartDef return Initialize("HtmlBodyPartMonacoSettings_Edit", model => { var settings = contentTypePartDefinition.GetSettings(); - if (String.IsNullOrWhiteSpace(settings.Options)) + if (string.IsNullOrWhiteSpace(settings.Options)) { settings.Options = JsonConvert.SerializeObject(new { automaticLayout = true, language = "html" }, Formatting.Indented); } diff --git a/src/OrchardCore.Modules/OrchardCore.Https/AdminMenu.cs b/src/OrchardCore.Modules/OrchardCore.Https/AdminMenu.cs index 50ed578f370..551e02a74f0 100644 --- a/src/OrchardCore.Modules/OrchardCore.Https/AdminMenu.cs +++ b/src/OrchardCore.Modules/OrchardCore.Https/AdminMenu.cs @@ -16,7 +16,7 @@ public AdminMenu(IStringLocalizer localizer) public Task BuildNavigationAsync(string name, NavigationBuilder builder) { - if (!String.Equals(name, "admin", StringComparison.OrdinalIgnoreCase)) + if (!string.Equals(name, "admin", StringComparison.OrdinalIgnoreCase)) { return Task.CompletedTask; } diff --git a/src/OrchardCore.Modules/OrchardCore.Indexing/IndexingTaskManager.cs b/src/OrchardCore.Modules/OrchardCore.Indexing/IndexingTaskManager.cs index 8866b1100f2..f7b1d1e1f21 100644 --- a/src/OrchardCore.Modules/OrchardCore.Indexing/IndexingTaskManager.cs +++ b/src/OrchardCore.Modules/OrchardCore.Indexing/IndexingTaskManager.cs @@ -127,7 +127,7 @@ private async Task FlushAsync(ShellScope scope, IEnumerable tasks) { if (logger.IsEnabled(LogLevel.Debug)) { - logger.LogDebug("Updating indexing tasks: {ContentItemIds}", String.Join(", ", tasks.Select(x => x.ContentItemId))); + logger.LogDebug("Updating indexing tasks: {ContentItemIds}", string.Join(", ", tasks.Select(x => x.ContentItemId))); } // Page delete statements to prevent the limits from IN sql statements. diff --git a/src/OrchardCore.Modules/OrchardCore.Indexing/Properties/AssemblyInfo.cs b/src/OrchardCore.Modules/OrchardCore.Indexing/Properties/AssemblyInfo.cs index f70533b1e04..31265d474cc 100644 --- a/src/OrchardCore.Modules/OrchardCore.Indexing/Properties/AssemblyInfo.cs +++ b/src/OrchardCore.Modules/OrchardCore.Indexing/Properties/AssemblyInfo.cs @@ -1,4 +1,4 @@ -using System.Reflection; +using System.Reflection; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following diff --git a/src/OrchardCore.Modules/OrchardCore.Layers/AdminMenu.cs b/src/OrchardCore.Modules/OrchardCore.Layers/AdminMenu.cs index 702db0a9a7e..f11f3776f9c 100644 --- a/src/OrchardCore.Modules/OrchardCore.Layers/AdminMenu.cs +++ b/src/OrchardCore.Modules/OrchardCore.Layers/AdminMenu.cs @@ -17,7 +17,7 @@ public AdminMenu(IStringLocalizer localizer) public Task BuildNavigationAsync(string name, NavigationBuilder builder) { - if (!String.Equals(name, "admin", StringComparison.OrdinalIgnoreCase)) + if (!string.Equals(name, "admin", StringComparison.OrdinalIgnoreCase)) { return Task.CompletedTask; } diff --git a/src/OrchardCore.Modules/OrchardCore.Layers/Controllers/AdminController.cs b/src/OrchardCore.Modules/OrchardCore.Layers/Controllers/AdminController.cs index f7ffc51a8d9..a11e626f843 100644 --- a/src/OrchardCore.Modules/OrchardCore.Layers/Controllers/AdminController.cs +++ b/src/OrchardCore.Modules/OrchardCore.Layers/Controllers/AdminController.cs @@ -187,7 +187,7 @@ public async Task Edit(string name) var layers = await _layerService.GetLayersAsync(); - var layer = layers.Layers.FirstOrDefault(x => String.Equals(x.Name, name)); + var layer = layers.Layers.FirstOrDefault(x => string.Equals(x.Name, name)); if (layer == null) { @@ -232,7 +232,7 @@ public async Task EditPost(LayerEditViewModel model) if (ModelState.IsValid) { - var layer = layers.Layers.FirstOrDefault(x => String.Equals(x.Name, model.Name)); + var layer = layers.Layers.FirstOrDefault(x => string.Equals(x.Name, model.Name)); if (layer == null) { @@ -260,7 +260,7 @@ public async Task Delete(string name) var layers = await _layerService.LoadLayersAsync(); - var layer = layers.Layers.FirstOrDefault(x => String.Equals(x.Name, name)); + var layer = layers.Layers.FirstOrDefault(x => string.Equals(x.Name, name)); if (layer == null) { @@ -269,7 +269,7 @@ public async Task Delete(string name) var widgets = await _layerService.GetLayerWidgetsMetadataAsync(c => c.Latest == true); - if (!widgets.Any(x => String.Equals(x.Layer, name, StringComparison.OrdinalIgnoreCase))) + if (!widgets.Any(x => string.Equals(x.Layer, name, StringComparison.OrdinalIgnoreCase))) { layers.Layers.Remove(layer); await _layerService.UpdateAsync(layers); @@ -351,11 +351,11 @@ public async Task UpdatePosition(string contentItemId, double pos private void ValidateViewModel(LayerEditViewModel model, LayersDocument layers, bool isNew) { - if (String.IsNullOrWhiteSpace(model.Name)) + if (string.IsNullOrWhiteSpace(model.Name)) { ModelState.AddModelError(nameof(LayerEditViewModel.Name), S["The layer name is required."]); } - else if (isNew && layers.Layers.Any(x => String.Equals(x.Name, model.Name, StringComparison.OrdinalIgnoreCase))) + else if (isNew && layers.Layers.Any(x => string.Equals(x.Name, model.Name, StringComparison.OrdinalIgnoreCase))) { ModelState.AddModelError(nameof(LayerEditViewModel.Name), S["The layer name already exists."]); } diff --git a/src/OrchardCore.Modules/OrchardCore.Layers/Controllers/LayerRuleController.cs b/src/OrchardCore.Modules/OrchardCore.Layers/Controllers/LayerRuleController.cs index 5dbf550991a..bbac9887c81 100644 --- a/src/OrchardCore.Modules/OrchardCore.Layers/Controllers/LayerRuleController.cs +++ b/src/OrchardCore.Modules/OrchardCore.Layers/Controllers/LayerRuleController.cs @@ -58,7 +58,7 @@ public async Task Create(string name, string type, string conditi } var layers = await _layerService.GetLayersAsync(); - var layer = layers.Layers.FirstOrDefault(x => String.Equals(x.Name, name)); + var layer = layers.Layers.FirstOrDefault(x => string.Equals(x.Name, name)); if (layer == null) { @@ -99,7 +99,7 @@ public async Task Create(LayerRuleCreateViewModel model) } var layers = await _layerService.LoadLayersAsync(); - var layer = layers.Layers.FirstOrDefault(x => String.Equals(x.Name, model.Name)); + var layer = layers.Layers.FirstOrDefault(x => string.Equals(x.Name, model.Name)); if (layer == null) { @@ -145,7 +145,7 @@ public async Task Edit(string name, string conditionId) } var layers = await _layerService.GetLayersAsync(); - var layer = layers.Layers.FirstOrDefault(x => String.Equals(x.Name, name)); + var layer = layers.Layers.FirstOrDefault(x => string.Equals(x.Name, name)); if (layer == null) { @@ -177,7 +177,7 @@ public async Task Edit(LayerRuleEditViewModel model) } var layers = await _layerService.LoadLayersAsync(); - var layer = layers.Layers.FirstOrDefault(x => String.Equals(x.Name, model.Name)); + var layer = layers.Layers.FirstOrDefault(x => string.Equals(x.Name, model.Name)); if (layer == null) { @@ -216,7 +216,7 @@ public async Task Delete(string name, string conditionId) } var layers = await _layerService.LoadLayersAsync(); - var layer = layers.Layers.FirstOrDefault(x => String.Equals(x.Name, name)); + var layer = layers.Layers.FirstOrDefault(x => string.Equals(x.Name, name)); if (layer == null) { @@ -247,7 +247,7 @@ public async Task UpdateOrder(string name, string conditionId, st } var layers = await _layerService.LoadLayersAsync(); - var layer = layers.Layers.FirstOrDefault(x => String.Equals(x.Name, name)); + var layer = layers.Layers.FirstOrDefault(x => string.Equals(x.Name, name)); if (layer == null) { @@ -273,7 +273,7 @@ public async Task UpdateOrder(string name, string conditionId, st private Condition FindCondition(Condition condition, string conditionId) { - if (String.Equals(condition.ConditionId, conditionId, StringComparison.OrdinalIgnoreCase)) + if (string.Equals(condition.ConditionId, conditionId, StringComparison.OrdinalIgnoreCase)) { return condition; } @@ -306,7 +306,7 @@ private Condition FindCondition(Condition condition, string conditionId) private ConditionGroup FindConditionGroup(ConditionGroup condition, string groupconditionId) { - if (String.Equals(condition.ConditionId, groupconditionId, StringComparison.OrdinalIgnoreCase)) + if (string.Equals(condition.ConditionId, groupconditionId, StringComparison.OrdinalIgnoreCase)) { return condition; } @@ -338,7 +338,7 @@ private ConditionGroup FindConditionParent(ConditionGroup condition, string cond foreach (var nestedCondition in condition.Conditions) { - if (String.Equals(nestedCondition.ConditionId, conditionId, StringComparison.OrdinalIgnoreCase)) + if (string.Equals(nestedCondition.ConditionId, conditionId, StringComparison.OrdinalIgnoreCase)) { return condition; } diff --git a/src/OrchardCore.Modules/OrchardCore.Layers/Drivers/LayerMetadataWelder.cs b/src/OrchardCore.Modules/OrchardCore.Layers/Drivers/LayerMetadataWelder.cs index dada90bf12c..892eed00222 100644 --- a/src/OrchardCore.Modules/OrchardCore.Layers/Drivers/LayerMetadataWelder.cs +++ b/src/OrchardCore.Modules/OrchardCore.Layers/Drivers/LayerMetadataWelder.cs @@ -26,7 +26,7 @@ public LayerMetadataWelder(ILayerService layerService, IStringLocalizer EditAsync(ContentItem model, BuildEdi // Are we loading an editor that requires layer metadata? if (await context.Updater.TryUpdateModelAsync(layerMetadata, Prefix, m => m.Zone, m => m.Position) - && !String.IsNullOrEmpty(layerMetadata.Zone)) + && !string.IsNullOrEmpty(layerMetadata.Zone)) { model.Weld(layerMetadata); } @@ -72,12 +72,12 @@ public override async Task UpdateAsync(ContentItem model, Update return null; } - if (String.IsNullOrEmpty(viewModel.LayerMetadata.Zone)) + if (string.IsNullOrEmpty(viewModel.LayerMetadata.Zone)) { context.Updater.ModelState.AddModelError(Prefix, "LayerMetadata.Zone", S["Zone is missing"]); } - if (String.IsNullOrEmpty(viewModel.LayerMetadata.Layer)) + if (string.IsNullOrEmpty(viewModel.LayerMetadata.Layer)) { context.Updater.ModelState.AddModelError(Prefix, "LayerMetadata.Layer", S["Layer is missing"]); } diff --git a/src/OrchardCore.Modules/OrchardCore.Layers/Drivers/LayerSiteSettingsDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.Layers/Drivers/LayerSiteSettingsDisplayDriver.cs index 67f589704b6..9299b05651f 100644 --- a/src/OrchardCore.Modules/OrchardCore.Layers/Drivers/LayerSiteSettingsDisplayDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Layers/Drivers/LayerSiteSettingsDisplayDriver.cs @@ -36,7 +36,7 @@ public override async Task EditAsync(LayerSettings settings, Bui return Initialize("LayerSettings_Edit", model => { - model.Zones = String.Join(", ", settings.Zones); + model.Zones = string.Join(", ", settings.Zones); }).Location("Content:3").OnGroup(GroupId); } @@ -55,7 +55,7 @@ public override async Task UpdateAsync(LayerSettings settings, B await context.Updater.TryUpdateModelAsync(model, Prefix); - settings.Zones = (model.Zones ?? String.Empty).Split(new[] { ' ', ',' }, StringSplitOptions.RemoveEmptyEntries); + settings.Zones = (model.Zones ?? string.Empty).Split(new[] { ' ', ',' }, StringSplitOptions.RemoveEmptyEntries); } return await EditAsync(settings, context); diff --git a/src/OrchardCore.Modules/OrchardCore.Layers/GraphQL/SiteLayersQuery.cs b/src/OrchardCore.Modules/OrchardCore.Layers/GraphQL/SiteLayersQuery.cs index 4041344d679..4ec28519934 100644 --- a/src/OrchardCore.Modules/OrchardCore.Layers/GraphQL/SiteLayersQuery.cs +++ b/src/OrchardCore.Modules/OrchardCore.Layers/GraphQL/SiteLayersQuery.cs @@ -27,7 +27,7 @@ public SiteLayersQuery( _graphQLContentOptions = graphQLContentOptions.Value; } - public Task GetIdentifierAsync() => Task.FromResult(String.Empty); + public Task GetIdentifierAsync() => Task.FromResult(string.Empty); public Task BuildAsync(ISchema schema) { diff --git a/src/OrchardCore.Modules/OrchardCore.Layers/Migrations.cs b/src/OrchardCore.Modules/OrchardCore.Layers/Migrations.cs index 3e09d60684c..783bf5041a2 100644 --- a/src/OrchardCore.Modules/OrchardCore.Layers/Migrations.cs +++ b/src/OrchardCore.Modules/OrchardCore.Layers/Migrations.cs @@ -59,7 +59,7 @@ public async Task UpdateFrom2Async() #pragma warning disable 0618 _ruleMigrator.Migrate(layer.Rule, layer.LayerRule); - layer.Rule = String.Empty; + layer.Rule = string.Empty; #pragma warning restore 0618 } diff --git a/src/OrchardCore.Modules/OrchardCore.Layers/Models/LayerSettings.cs b/src/OrchardCore.Modules/OrchardCore.Layers/Models/LayerSettings.cs index f94fa5331fe..b3f8a0c2c27 100644 --- a/src/OrchardCore.Modules/OrchardCore.Layers/Models/LayerSettings.cs +++ b/src/OrchardCore.Modules/OrchardCore.Layers/Models/LayerSettings.cs @@ -1,4 +1,4 @@ -using System; +using System; namespace OrchardCore.Layers.Models { diff --git a/src/OrchardCore.Modules/OrchardCore.Layers/Recipes/LayerStep.cs b/src/OrchardCore.Modules/OrchardCore.Layers/Recipes/LayerStep.cs index 41290afa97e..fd9988378c4 100644 --- a/src/OrchardCore.Modules/OrchardCore.Layers/Recipes/LayerStep.cs +++ b/src/OrchardCore.Modules/OrchardCore.Layers/Recipes/LayerStep.cs @@ -41,7 +41,7 @@ public LayerStep( public async Task ExecuteAsync(RecipeExecutionContext context) { - if (!String.Equals(context.Name, "Layers", StringComparison.OrdinalIgnoreCase)) + if (!string.Equals(context.Name, "Layers", StringComparison.OrdinalIgnoreCase)) { return; } @@ -55,7 +55,7 @@ public async Task ExecuteAsync(RecipeExecutionContext context) foreach (var layerStep in model.Layers) { - var layer = allLayers.Layers.FirstOrDefault(x => String.Equals(x.Name, layerStep.Name, StringComparison.OrdinalIgnoreCase)); + var layer = allLayers.Layers.FirstOrDefault(x => string.Equals(x.Name, layerStep.Name, StringComparison.OrdinalIgnoreCase)); if (layer == null) { @@ -71,7 +71,7 @@ public async Task ExecuteAsync(RecipeExecutionContext context) } // Replace any property that is set in the recipe step. - if (!String.IsNullOrEmpty(layerStep.Name)) + if (!string.IsNullOrEmpty(layerStep.Name)) { layer.Name = layerStep.Name; } @@ -82,7 +82,7 @@ public async Task ExecuteAsync(RecipeExecutionContext context) if (layerStep.LayerRule != null) { - if (!String.IsNullOrEmpty(layerStep.LayerRule.ConditionId)) + if (!string.IsNullOrEmpty(layerStep.LayerRule.ConditionId)) { layer.LayerRule.ConditionId = layerStep.LayerRule.ConditionId; } @@ -107,12 +107,12 @@ public async Task ExecuteAsync(RecipeExecutionContext context) // Migrate any old rule in a recipe to the new rule format. // Do not import the old rule. - if (!String.IsNullOrEmpty(layerStep.Rule)) + if (!string.IsNullOrEmpty(layerStep.Rule)) { _ruleMigrator.Migrate(layerStep.Rule, layer.LayerRule); } - if (!String.IsNullOrEmpty(layerStep.Description)) + if (!string.IsNullOrEmpty(layerStep.Description)) { layer.Description = layerStep.Description; } @@ -123,7 +123,7 @@ public async Task ExecuteAsync(RecipeExecutionContext context) var prefix = "No changes have been made. The following types of conditions cannot be added:"; var suffix = "Please ensure that the related features are enabled to add these types of conditions."; - throw new InvalidOperationException($"{prefix} {String.Join(", ", unknownTypes)}. {suffix}"); + throw new InvalidOperationException($"{prefix} {string.Join(", ", unknownTypes)}. {suffix}"); } await _layerService.UpdateAsync(allLayers); diff --git a/src/OrchardCore.Modules/OrchardCore.Layers/Services/DefaultLayersMethodProvider.cs b/src/OrchardCore.Modules/OrchardCore.Layers/Services/DefaultLayersMethodProvider.cs index 5e561e98bde..6d441117abb 100644 --- a/src/OrchardCore.Modules/OrchardCore.Layers/Services/DefaultLayersMethodProvider.cs +++ b/src/OrchardCore.Modules/OrchardCore.Layers/Services/DefaultLayersMethodProvider.cs @@ -30,7 +30,7 @@ public DefaultLayersMethodProvider() { var httpContext = serviceProvider.GetRequiredService().HttpContext; var requestPath = httpContext.Request.Path.Value; - return requestPath == "/" || String.IsNullOrEmpty(requestPath); + return requestPath == "/" || string.IsNullOrEmpty(requestPath); }), }; @@ -83,14 +83,14 @@ public DefaultLayersMethodProvider() // Tenant home page could have an empty string as a request path, where // the default tenant does not. - if (String.IsNullOrEmpty(requestPath)) + if (string.IsNullOrEmpty(requestPath)) { requestPath = "/"; } return url.EndsWith('*') ? requestPath.StartsWith(url.TrimEnd('*'), StringComparison.OrdinalIgnoreCase) - : String.Equals(requestPath, url, StringComparison.OrdinalIgnoreCase); + : string.Equals(requestPath, url, StringComparison.OrdinalIgnoreCase); }), }; @@ -101,8 +101,8 @@ public DefaultLayersMethodProvider() { var currentCulture = CultureInfo.CurrentCulture; - return String.Equals(culture, currentCulture.Name, StringComparison.OrdinalIgnoreCase) || - String.Equals(culture, currentCulture.Parent.Name, StringComparison.OrdinalIgnoreCase); + return string.Equals(culture, currentCulture.Name, StringComparison.OrdinalIgnoreCase) || + string.Equals(culture, currentCulture.Parent.Name, StringComparison.OrdinalIgnoreCase); }), }; diff --git a/src/OrchardCore.Modules/OrchardCore.Liquid/Drivers/LiquidPartDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.Liquid/Drivers/LiquidPartDisplayDriver.cs index e4b907a66c0..788845e0c65 100644 --- a/src/OrchardCore.Modules/OrchardCore.Liquid/Drivers/LiquidPartDisplayDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Liquid/Drivers/LiquidPartDisplayDriver.cs @@ -42,9 +42,9 @@ public override async Task UpdateAsync(LiquidPart model, IUpdate if (await updater.TryUpdateModelAsync(viewModel, Prefix, t => t.Liquid)) { - if (!String.IsNullOrEmpty(viewModel.Liquid) && !_liquidTemplatemanager.Validate(viewModel.Liquid, out var errors)) + if (!string.IsNullOrEmpty(viewModel.Liquid) && !_liquidTemplatemanager.Validate(viewModel.Liquid, out var errors)) { - updater.ModelState.AddModelError(Prefix, nameof(viewModel.Liquid), S["The Liquid Body doesn't contain a valid Liquid expression. Details: {0}", String.Join(" ", errors)]); + updater.ModelState.AddModelError(Prefix, nameof(viewModel.Liquid), S["The Liquid Body doesn't contain a valid Liquid expression. Details: {0}", string.Join(" ", errors)]); } else { diff --git a/src/OrchardCore.Modules/OrchardCore.Liquid/ScriptsMiddleware.cs b/src/OrchardCore.Modules/OrchardCore.Liquid/ScriptsMiddleware.cs index f72912a8363..ad4598fb9ca 100644 --- a/src/OrchardCore.Modules/OrchardCore.Liquid/ScriptsMiddleware.cs +++ b/src/OrchardCore.Modules/OrchardCore.Liquid/ScriptsMiddleware.cs @@ -50,8 +50,8 @@ public async Task Invoke(HttpContext httpContext) var shellConfiguration = httpContext.RequestServices.GetRequiredService(); cacheControl = shellConfiguration.GetValue("StaticFileOptions:CacheControl", cacheControl); - var filters = String.Join(',', templateOptions.Value.Filters.Select(x => $"'{x.Key}'")); - var tags = String.Join(',', liquidViewParser.RegisteredTags.Select(x => $"'{x.Key}'")); + var filters = string.Join(',', templateOptions.Value.Filters.Select(x => $"'{x.Key}'")); + var tags = string.Join(',', liquidViewParser.RegisteredTags.Select(x => $"'{x.Key}'")); var script = $@"[{filters}].forEach(value=>{{if(!liquidFilters.includes(value)){{ liquidFilters.push(value);}}}}); [{tags}].forEach(value=>{{if(!liquidTags.includes(value)){{ liquidTags.push(value);}}}});"; diff --git a/src/OrchardCore.Modules/OrchardCore.Liquid/Services/LiquidTemplateManager.cs b/src/OrchardCore.Modules/OrchardCore.Liquid/Services/LiquidTemplateManager.cs index dbaf9934b7d..e36e9b68026 100644 --- a/src/OrchardCore.Modules/OrchardCore.Liquid/Services/LiquidTemplateManager.cs +++ b/src/OrchardCore.Modules/OrchardCore.Liquid/Services/LiquidTemplateManager.cs @@ -35,7 +35,7 @@ IServiceProvider serviceProvider public Task RenderStringAsync(string source, TextEncoder encoder, object model = null, IEnumerable> properties = null) { - if (String.IsNullOrWhiteSpace(source)) + if (string.IsNullOrWhiteSpace(source)) { return Task.FromResult((string)null); } @@ -56,7 +56,7 @@ public Task RenderStringAsync(string source, TextEncoder encoder, object public async Task RenderHtmlContentAsync(string source, TextEncoder encoder, object model = null, IEnumerable> properties = null) { - if (String.IsNullOrWhiteSpace(source)) + if (string.IsNullOrWhiteSpace(source)) { return HtmlString.Empty; } @@ -81,7 +81,7 @@ public async Task RenderHtmlContentAsync(string source, TextEncode public Task RenderAsync(string source, TextWriter writer, TextEncoder encoder, object model = null, IEnumerable> properties = null) { - if (String.IsNullOrWhiteSpace(source)) + if (string.IsNullOrWhiteSpace(source)) { return Task.CompletedTask; } @@ -109,7 +109,7 @@ public LiquidViewTemplate GetCachedTemplate(string source) if (!_liquidViewParser.TryParse(source, out var parsed, out var error)) { // If the source string cannot be parsed, create a template that contains the parser errors - _liquidViewParser.TryParse(String.Join(System.Environment.NewLine, errors), out parsed, out error); + _liquidViewParser.TryParse(string.Join(System.Environment.NewLine, errors), out parsed, out error); } // Define a default sliding expiration to prevent the diff --git a/src/OrchardCore.Modules/OrchardCore.Liquid/Services/SlugService.cs b/src/OrchardCore.Modules/OrchardCore.Liquid/Services/SlugService.cs index 6fef9714d6b..f7c9f211965 100644 --- a/src/OrchardCore.Modules/OrchardCore.Liquid/Services/SlugService.cs +++ b/src/OrchardCore.Modules/OrchardCore.Liquid/Services/SlugService.cs @@ -19,7 +19,7 @@ public string Slugify(string text, char separator) public string Slugify(string text) { - if (String.IsNullOrEmpty(text)) + if (string.IsNullOrEmpty(text)) { return text; } @@ -31,14 +31,14 @@ public string Slugify(string text) for (var i = 0; i < normalizedText.Length; i++) { - var currentChar = Char.ToLowerInvariant(normalizedText[i]); + var currentChar = char.ToLowerInvariant(normalizedText[i]); if (CharUnicodeInfo.GetUnicodeCategory(currentChar) == UnicodeCategory.NonSpacingMark) { continue; } - if (Char.IsLetterOrDigit(currentChar)) + if (char.IsLetterOrDigit(currentChar)) { slug.Append(currentChar); diff --git a/src/OrchardCore.Modules/OrchardCore.Lists/AdminNodes/ListsAdminNodeNavigationBuilder.cs b/src/OrchardCore.Modules/OrchardCore.Lists/AdminNodes/ListsAdminNodeNavigationBuilder.cs index 110ab800a78..edc7f22604b 100644 --- a/src/OrchardCore.Modules/OrchardCore.Lists/AdminNodes/ListsAdminNodeNavigationBuilder.cs +++ b/src/OrchardCore.Modules/OrchardCore.Lists/AdminNodes/ListsAdminNodeNavigationBuilder.cs @@ -46,7 +46,7 @@ public async Task BuildNavigationAsync(MenuItem menuItem, NavigationBuilder buil { _node = menuItem as ListsAdminNode; - if (_node == null || !_node.Enabled || String.IsNullOrEmpty(_node.ContentType)) + if (_node == null || !_node.Enabled || string.IsNullOrEmpty(_node.ContentType)) { return; } diff --git a/src/OrchardCore.Modules/OrchardCore.Lists/Drivers/ContainedPartDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.Lists/Drivers/ContainedPartDisplayDriver.cs index 6acb0b142fb..a558e714da8 100644 --- a/src/OrchardCore.Modules/OrchardCore.Lists/Drivers/ContainedPartDisplayDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Lists/Drivers/ContainedPartDisplayDriver.cs @@ -112,7 +112,7 @@ private IDisplayResult BuildViewModel(string containerId, string containerConten .Location("Content"), }; - if (!String.IsNullOrEmpty(containerContentType)) + if (!string.IsNullOrEmpty(containerContentType)) { var definition = _contentDefinitionManager.GetTypeDefinition(containerContentType); diff --git a/src/OrchardCore.Modules/OrchardCore.Lists/Feeds/ListFeedQuery.cs b/src/OrchardCore.Modules/OrchardCore.Lists/Feeds/ListFeedQuery.cs index cfd28222eec..1c791fd20d8 100644 --- a/src/OrchardCore.Modules/OrchardCore.Lists/Feeds/ListFeedQuery.cs +++ b/src/OrchardCore.Modules/OrchardCore.Lists/Feeds/ListFeedQuery.cs @@ -73,7 +73,7 @@ public async Task ExecuteAsync(FeedContext context) context.Response.Element.SetElementValue("title", contentItem.DisplayText); context.Response.Element.Add(link); - context.Response.Element.Add(new XElement("description", new XCData(bodyAspect.Body?.ToString() ?? String.Empty))); + context.Response.Element.Add(new XElement("description", new XCData(bodyAspect.Body?.ToString() ?? string.Empty))); context.Response.Contextualize(contextualize => { @@ -86,7 +86,7 @@ public async Task ExecuteAsync(FeedContext context) else { context.Builder.AddProperty(context, null, "title", contentItem.DisplayText); - context.Builder.AddProperty(context, null, new XElement("description", new XCData(bodyAspect.Body?.ToString() ?? String.Empty))); + context.Builder.AddProperty(context, null, new XElement("description", new XCData(bodyAspect.Body?.ToString() ?? string.Empty))); context.Response.Contextualize(contextualize => { diff --git a/src/OrchardCore.Modules/OrchardCore.Lists/Feeds/ListFeedQueryViewModel.cs b/src/OrchardCore.Modules/OrchardCore.Lists/Feeds/ListFeedQueryViewModel.cs index 13d4b2891df..b296ea41c44 100644 --- a/src/OrchardCore.Modules/OrchardCore.Lists/Feeds/ListFeedQueryViewModel.cs +++ b/src/OrchardCore.Modules/OrchardCore.Lists/Feeds/ListFeedQueryViewModel.cs @@ -1,4 +1,4 @@ -namespace OrchardCore.Lists.Feeds +namespace OrchardCore.Lists.Feeds { public class ListFeedQueryViewModel { diff --git a/src/OrchardCore.Modules/OrchardCore.Lists/Handlers/ContainedPartHandler.cs b/src/OrchardCore.Modules/OrchardCore.Lists/Handlers/ContainedPartHandler.cs index 5c84e7e4d5f..8856eaa0ba8 100644 --- a/src/OrchardCore.Modules/OrchardCore.Lists/Handlers/ContainedPartHandler.cs +++ b/src/OrchardCore.Modules/OrchardCore.Lists/Handlers/ContainedPartHandler.cs @@ -32,7 +32,7 @@ public override async Task CloningAsync(CloneContentContext context) { var contentDefinitionManager = _serviceProvider.GetRequiredService(); var contentTypeDefinition = contentDefinitionManager.GetTypeDefinition(listContentItem.ContentType); - var contentTypePartDefinition = contentTypeDefinition.Parts.FirstOrDefault(x => String.Equals(x.PartDefinition.Name, "ListPart")); + var contentTypePartDefinition = contentTypeDefinition.Parts.FirstOrDefault(x => string.Equals(x.PartDefinition.Name, "ListPart")); var settings = contentTypePartDefinition.GetSettings(); if (settings.EnableOrdering) { diff --git a/src/OrchardCore.Modules/OrchardCore.Lists/RemotePublishing/MetaWeblogHandler.cs b/src/OrchardCore.Modules/OrchardCore.Lists/RemotePublishing/MetaWeblogHandler.cs index 6871e9124d5..736d0b6b846 100644 --- a/src/OrchardCore.Modules/OrchardCore.Lists/RemotePublishing/MetaWeblogHandler.cs +++ b/src/OrchardCore.Modules/OrchardCore.Lists/RemotePublishing/MetaWeblogHandler.cs @@ -486,7 +486,7 @@ private async Task CheckAccessAsync(Permission permission, ClaimsPrincipal user, private IEnumerable GetContainedContentTypes(ContentItem contentItem) { var contentTypeDefinition = _contentDefinitionManager.GetTypeDefinition(contentItem.ContentType); - var contentTypePartDefinition = contentTypeDefinition.Parts.FirstOrDefault(x => String.Equals(x.PartDefinition.Name, "ListPart")); + var contentTypePartDefinition = contentTypeDefinition.Parts.FirstOrDefault(x => string.Equals(x.PartDefinition.Name, "ListPart")); var settings = contentTypePartDefinition.GetSettings(); var contentTypes = settings.ContainedContentTypes ?? Enumerable.Empty(); return contentTypes.Select(contentType => _contentDefinitionManager.GetTypeDefinition(contentType)); diff --git a/src/OrchardCore.Modules/OrchardCore.Lists/Services/ContainerService.cs b/src/OrchardCore.Modules/OrchardCore.Lists/Services/ContainerService.cs index 8ef110e0563..365ea84fde4 100644 --- a/src/OrchardCore.Modules/OrchardCore.Lists/Services/ContainerService.cs +++ b/src/OrchardCore.Modules/OrchardCore.Lists/Services/ContainerService.cs @@ -167,14 +167,14 @@ public async Task> QueryContainedItemsAsync( { if (enableOrdering) { - var beforeValue = Int32.Parse(pager.Before); + var beforeValue = int.Parse(pager.Before); query = _session.Query() .With(CreateOrderedContainedPartIndexFilter(beforeValue, null, contentItemId)) .OrderByDescending(x => x.Order); } else { - var beforeValue = new DateTime(Int64.Parse(pager.Before)); + var beforeValue = new DateTime(long.Parse(pager.Before)); query = _session.Query() .With(x => x.ListContentItemId == contentItemId); @@ -226,14 +226,14 @@ public async Task> QueryContainedItemsAsync( { if (enableOrdering) { - var afterValue = Int32.Parse(pager.After); + var afterValue = int.Parse(pager.After); query = _session.Query() .With(CreateOrderedContainedPartIndexFilter(null, afterValue, contentItemId)) .OrderBy(x => x.Order); } else { - var afterValue = new DateTime(Int64.Parse(pager.After)); + var afterValue = new DateTime(long.Parse(pager.After)); query = _session.Query() .With(CreateOrderedContainedPartIndexFilter(null, null, contentItemId)); @@ -352,7 +352,7 @@ private static void ApplyPagingContentIndexFilter(DateTime? before, DateTime? af private void ApplyContainedItemOptionsFilter(ContainedItemOptions containedItemOptions, IQuery query) { - if (!String.IsNullOrEmpty(containedItemOptions.DisplayText)) + if (!string.IsNullOrEmpty(containedItemOptions.DisplayText)) { query.With(i => i.DisplayText.Contains(containedItemOptions.DisplayText)); } diff --git a/src/OrchardCore.Modules/OrchardCore.Localization/AdminMenu.cs b/src/OrchardCore.Modules/OrchardCore.Localization/AdminMenu.cs index d2841a1c40c..6037ac1cb48 100644 --- a/src/OrchardCore.Modules/OrchardCore.Localization/AdminMenu.cs +++ b/src/OrchardCore.Modules/OrchardCore.Localization/AdminMenu.cs @@ -25,7 +25,7 @@ public AdminMenu(IStringLocalizer localizer) /// public Task BuildNavigationAsync(string name, NavigationBuilder builder) { - if (String.Equals(name, "admin", StringComparison.OrdinalIgnoreCase)) + if (string.Equals(name, "admin", StringComparison.OrdinalIgnoreCase)) { builder .Add(S["Configuration"], configuration => configuration diff --git a/src/OrchardCore.Modules/OrchardCore.Localization/Drivers/LocalizationSettingsDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.Localization/Drivers/LocalizationSettingsDisplayDriver.cs index 11266053c50..921c2a1d6f5 100644 --- a/src/OrchardCore.Modules/OrchardCore.Localization/Drivers/LocalizationSettingsDisplayDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Localization/Drivers/LocalizationSettingsDisplayDriver.cs @@ -75,7 +75,7 @@ public override async Task EditAsync(LocalizationSettings settin { Supported = settings.SupportedCultures.Contains(cultureInfo.Name, StringComparer.OrdinalIgnoreCase), CultureInfo = cultureInfo, - IsDefault = String.Equals(settings.DefaultCulture, cultureInfo.Name, StringComparison.OrdinalIgnoreCase) + IsDefault = string.Equals(settings.DefaultCulture, cultureInfo.Name, StringComparison.OrdinalIgnoreCase) }; }).ToArray(); diff --git a/src/OrchardCore.Modules/OrchardCore.Localization/GraphQL/SiteCulturesQuery.cs b/src/OrchardCore.Modules/OrchardCore.Localization/GraphQL/SiteCulturesQuery.cs index 6f6a33f0dc2..83d294fce35 100644 --- a/src/OrchardCore.Modules/OrchardCore.Localization/GraphQL/SiteCulturesQuery.cs +++ b/src/OrchardCore.Modules/OrchardCore.Localization/GraphQL/SiteCulturesQuery.cs @@ -35,7 +35,7 @@ public SiteCulturesQuery( _graphQLContentOptions = graphQLContentOptions.Value; } - public Task GetIdentifierAsync() => Task.FromResult(String.Empty); + public Task GetIdentifierAsync() => Task.FromResult(string.Empty); /// public Task BuildAsync(ISchema schema) @@ -69,7 +69,7 @@ private async Task> ResolveAsync(IResolveFieldContext r new SiteCulture { Culture = culture, - IsDefault = String.Equals(defaultCulture, culture, StringComparison.OrdinalIgnoreCase), + IsDefault = string.Equals(defaultCulture, culture, StringComparison.OrdinalIgnoreCase), } ); diff --git a/src/OrchardCore.Modules/OrchardCore.Markdown/Drivers/MarkdownBodyPartDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.Markdown/Drivers/MarkdownBodyPartDisplayDriver.cs index 2a7b00ab121..258c2b1799e 100644 --- a/src/OrchardCore.Modules/OrchardCore.Markdown/Drivers/MarkdownBodyPartDisplayDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Markdown/Drivers/MarkdownBodyPartDisplayDriver.cs @@ -69,10 +69,10 @@ public override async Task UpdateAsync(MarkdownBodyPart model, I if (await context.Updater.TryUpdateModelAsync(viewModel, Prefix, vm => vm.Markdown)) { - if (!String.IsNullOrEmpty(viewModel.Markdown) && !_liquidTemplateManager.Validate(viewModel.Markdown, out var errors)) + if (!string.IsNullOrEmpty(viewModel.Markdown) && !_liquidTemplateManager.Validate(viewModel.Markdown, out var errors)) { var partName = context.TypePartDefinition.DisplayName(); - updater.ModelState.AddModelError(Prefix, nameof(viewModel.Markdown), S["{0} doesn't contain a valid Liquid expression. Details: {1}", partName, String.Join(" ", errors)]); + updater.ModelState.AddModelError(Prefix, nameof(viewModel.Markdown), S["{0} doesn't contain a valid Liquid expression. Details: {1}", partName, string.Join(" ", errors)]); } else { diff --git a/src/OrchardCore.Modules/OrchardCore.Markdown/Drivers/MarkdownFieldDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.Markdown/Drivers/MarkdownFieldDisplayDriver.cs index bcf7ea50ffa..161e08ca562 100644 --- a/src/OrchardCore.Modules/OrchardCore.Markdown/Drivers/MarkdownFieldDisplayDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Markdown/Drivers/MarkdownFieldDisplayDriver.cs @@ -100,10 +100,10 @@ public override async Task UpdateAsync(MarkdownField field, IUpd if (await updater.TryUpdateModelAsync(viewModel, Prefix, vm => vm.Markdown)) { - if (!String.IsNullOrEmpty(viewModel.Markdown) && !_liquidTemplateManager.Validate(viewModel.Markdown, out var errors)) + if (!string.IsNullOrEmpty(viewModel.Markdown) && !_liquidTemplateManager.Validate(viewModel.Markdown, out var errors)) { var fieldName = context.PartFieldDefinition.DisplayName(); - updater.ModelState.AddModelError(Prefix, nameof(viewModel.Markdown), S["{0} field doesn't contain a valid Liquid expression. Details: {1}", fieldName, String.Join(" ", errors)]); + updater.ModelState.AddModelError(Prefix, nameof(viewModel.Markdown), S["{0} field doesn't contain a valid Liquid expression. Details: {1}", fieldName, string.Join(" ", errors)]); } else { diff --git a/src/OrchardCore.Modules/OrchardCore.Markdown/Fields/MarkdownField.cs b/src/OrchardCore.Modules/OrchardCore.Markdown/Fields/MarkdownField.cs index 1cc69cf6f9d..84b4e8be93d 100644 --- a/src/OrchardCore.Modules/OrchardCore.Markdown/Fields/MarkdownField.cs +++ b/src/OrchardCore.Modules/OrchardCore.Markdown/Fields/MarkdownField.cs @@ -1,4 +1,4 @@ -using OrchardCore.ContentManagement; +using OrchardCore.ContentManagement; namespace OrchardCore.Markdown.Fields { diff --git a/src/OrchardCore.Modules/OrchardCore.Markdown/Handlers/MarkdownBodyPartHandler.cs b/src/OrchardCore.Modules/OrchardCore.Markdown/Handlers/MarkdownBodyPartHandler.cs index 4701c57534a..985305d9302 100644 --- a/src/OrchardCore.Modules/OrchardCore.Markdown/Handlers/MarkdownBodyPartHandler.cs +++ b/src/OrchardCore.Modules/OrchardCore.Markdown/Handlers/MarkdownBodyPartHandler.cs @@ -50,7 +50,7 @@ public override Task GetContentItemAspectAsync(ContentItemAspectContext context, try { var contentTypeDefinition = _contentDefinitionManager.GetTypeDefinition(part.ContentItem.ContentType); - var contentTypePartDefinition = contentTypeDefinition.Parts.FirstOrDefault(x => String.Equals(x.PartDefinition.Name, "MarkdownBodyPart")); + var contentTypePartDefinition = contentTypeDefinition.Parts.FirstOrDefault(x => string.Equals(x.PartDefinition.Name, "MarkdownBodyPart")); var settings = contentTypePartDefinition.GetSettings(); // The default Markdown option is to entity escape html diff --git a/src/OrchardCore.Modules/OrchardCore.Markdown/Indexing/MarkdownFieldIndexHandler.cs b/src/OrchardCore.Modules/OrchardCore.Markdown/Indexing/MarkdownFieldIndexHandler.cs index a3a4c7dd525..29aec3bfc69 100644 --- a/src/OrchardCore.Modules/OrchardCore.Markdown/Indexing/MarkdownFieldIndexHandler.cs +++ b/src/OrchardCore.Modules/OrchardCore.Markdown/Indexing/MarkdownFieldIndexHandler.cs @@ -1,4 +1,4 @@ -using System.Threading.Tasks; +using System.Threading.Tasks; using OrchardCore.Indexing; using OrchardCore.Markdown.Fields; diff --git a/src/OrchardCore.Modules/OrchardCore.Markdown/Properties/AssemblyInfo.cs b/src/OrchardCore.Modules/OrchardCore.Markdown/Properties/AssemblyInfo.cs index dd292df7628..4538c2d725f 100644 --- a/src/OrchardCore.Modules/OrchardCore.Markdown/Properties/AssemblyInfo.cs +++ b/src/OrchardCore.Modules/OrchardCore.Markdown/Properties/AssemblyInfo.cs @@ -1,4 +1,4 @@ -using System.Reflection; +using System.Reflection; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following diff --git a/src/OrchardCore.Modules/OrchardCore.Markdown/ViewModels/EditMarkdownFieldViewModel.cs b/src/OrchardCore.Modules/OrchardCore.Markdown/ViewModels/EditMarkdownFieldViewModel.cs index 7196af55242..c8d8221133b 100644 --- a/src/OrchardCore.Modules/OrchardCore.Markdown/ViewModels/EditMarkdownFieldViewModel.cs +++ b/src/OrchardCore.Modules/OrchardCore.Markdown/ViewModels/EditMarkdownFieldViewModel.cs @@ -1,4 +1,4 @@ -using OrchardCore.ContentManagement; +using OrchardCore.ContentManagement; using OrchardCore.ContentManagement.Metadata.Models; using OrchardCore.Markdown.Fields; diff --git a/src/OrchardCore.Modules/OrchardCore.Media.AmazonS3/AdminMenu.cs b/src/OrchardCore.Modules/OrchardCore.Media.AmazonS3/AdminMenu.cs index 86d5d21c8b1..d837e44d4ee 100644 --- a/src/OrchardCore.Modules/OrchardCore.Media.AmazonS3/AdminMenu.cs +++ b/src/OrchardCore.Modules/OrchardCore.Media.AmazonS3/AdminMenu.cs @@ -16,7 +16,7 @@ public AdminMenu(IStringLocalizer localizer) public Task BuildNavigationAsync(string name, NavigationBuilder builder) { - if (!String.Equals(name, "admin", StringComparison.OrdinalIgnoreCase)) + if (!string.Equals(name, "admin", StringComparison.OrdinalIgnoreCase)) { return Task.CompletedTask; } diff --git a/src/OrchardCore.Modules/OrchardCore.Media.AmazonS3/AwsStorageOptionsConfiguration.cs b/src/OrchardCore.Modules/OrchardCore.Media.AmazonS3/AwsStorageOptionsConfiguration.cs index 363626b0904..a260341bfd7 100644 --- a/src/OrchardCore.Modules/OrchardCore.Media.AmazonS3/AwsStorageOptionsConfiguration.cs +++ b/src/OrchardCore.Modules/OrchardCore.Media.AmazonS3/AwsStorageOptionsConfiguration.cs @@ -50,8 +50,8 @@ private void ParseBucketName(AwsStorageOptions options, TemplateContext template options.BucketName = template .Render(templateContext, NullEncoder.Default) - .Replace("\r", String.Empty) - .Replace("\n", String.Empty) + .Replace("\r", string.Empty) + .Replace("\n", string.Empty) .Trim(); } catch (Exception e) @@ -69,8 +69,8 @@ private void ParseBasePath(AwsStorageOptions options, TemplateContext templateCo options.BasePath = template .Render(templateContext, NullEncoder.Default) - .Replace("\r", String.Empty) - .Replace("\n", String.Empty) + .Replace("\r", string.Empty) + .Replace("\n", string.Empty) .Trim(); } catch (Exception e) diff --git a/src/OrchardCore.Modules/OrchardCore.Media.AmazonS3/AwsStorageOptionsExtension.cs b/src/OrchardCore.Modules/OrchardCore.Media.AmazonS3/AwsStorageOptionsExtension.cs index 3111656f3fe..fe7e4c11bce 100644 --- a/src/OrchardCore.Modules/OrchardCore.Media.AmazonS3/AwsStorageOptionsExtension.cs +++ b/src/OrchardCore.Modules/OrchardCore.Media.AmazonS3/AwsStorageOptionsExtension.cs @@ -14,7 +14,7 @@ public static class AwsStorageOptionsExtension { public static IEnumerable Validate(this AwsStorageOptions options) { - if (String.IsNullOrWhiteSpace(options.BucketName)) + if (string.IsNullOrWhiteSpace(options.BucketName)) { yield return new ValidationResult(Constants.ValidationMessages.BucketNameIsEmpty); } @@ -37,8 +37,8 @@ public static AwsStorageOptions BindConfiguration(this AwsStorageOptions options return options; } - options.BucketName = section.GetValue(nameof(options.BucketName), String.Empty); - options.BasePath = section.GetValue(nameof(options.BasePath), String.Empty); + options.BucketName = section.GetValue(nameof(options.BucketName), string.Empty); + options.BasePath = section.GetValue(nameof(options.BasePath), string.Empty); options.CreateBucket = section.GetValue(nameof(options.CreateBucket), false); options.RemoveBucket = section.GetValue(nameof(options.RemoveBucket), false); @@ -52,11 +52,11 @@ public static AwsStorageOptions BindConfiguration(this AwsStorageOptions options var credentials = section.GetSection("Credentials"); if (credentials.Exists()) { - var secretKey = credentials.GetValue(Constants.AwsCredentialParamNames.SecretKey, String.Empty); - var accessKey = credentials.GetValue(Constants.AwsCredentialParamNames.AccessKey, String.Empty); + var secretKey = credentials.GetValue(Constants.AwsCredentialParamNames.SecretKey, string.Empty); + var accessKey = credentials.GetValue(Constants.AwsCredentialParamNames.AccessKey, string.Empty); - if (!String.IsNullOrWhiteSpace(accessKey) || - !String.IsNullOrWhiteSpace(secretKey)) + if (!string.IsNullOrWhiteSpace(accessKey) || + !string.IsNullOrWhiteSpace(secretKey)) { var awsCredentials = new BasicAWSCredentials(accessKey, secretKey); options.AwsOptions.Credentials = awsCredentials; diff --git a/src/OrchardCore.Modules/OrchardCore.Media.AmazonS3/Constants.cs b/src/OrchardCore.Modules/OrchardCore.Media.AmazonS3/Constants.cs index 0692606394e..9816984574d 100644 --- a/src/OrchardCore.Modules/OrchardCore.Media.AmazonS3/Constants.cs +++ b/src/OrchardCore.Modules/OrchardCore.Media.AmazonS3/Constants.cs @@ -1,4 +1,4 @@ -namespace OrchardCore.Media.AmazonS3; +namespace OrchardCore.Media.AmazonS3; internal static class Constants { diff --git a/src/OrchardCore.Modules/OrchardCore.Media.AmazonS3/MediaS3BucketTenantEvents.cs b/src/OrchardCore.Modules/OrchardCore.Media.AmazonS3/MediaS3BucketTenantEvents.cs index 4042a443b13..8ce9843355f 100644 --- a/src/OrchardCore.Modules/OrchardCore.Media.AmazonS3/MediaS3BucketTenantEvents.cs +++ b/src/OrchardCore.Modules/OrchardCore.Media.AmazonS3/MediaS3BucketTenantEvents.cs @@ -39,7 +39,7 @@ public override async Task ActivatingAsync() { if (!_options.CreateBucket || _shellSettings.IsUninitialized() || - String.IsNullOrEmpty(_options.BucketName)) + string.IsNullOrEmpty(_options.BucketName)) { return; } @@ -97,7 +97,7 @@ await _amazonS3Client.PutPublicAccessBlockAsync(new PutPublicAccessBlockRequest public override async Task RemovingAsync(ShellRemovingContext context) { - if (!_options.RemoveBucket || String.IsNullOrEmpty(_options.BucketName)) + if (!_options.RemoveBucket || string.IsNullOrEmpty(_options.BucketName)) { return; } diff --git a/src/OrchardCore.Modules/OrchardCore.Media.AmazonS3/Startup.cs b/src/OrchardCore.Modules/OrchardCore.Media.AmazonS3/Startup.cs index fde8564f104..10e235d7837 100644 --- a/src/OrchardCore.Modules/OrchardCore.Media.AmazonS3/Startup.cs +++ b/src/OrchardCore.Modules/OrchardCore.Media.AmazonS3/Startup.cs @@ -60,7 +60,7 @@ public override void ConfigureServices(IServiceCollection services) { var hostingEnvironment = serviceProvider.GetRequiredService(); - if (String.IsNullOrWhiteSpace(hostingEnvironment.WebRootPath)) + if (string.IsNullOrWhiteSpace(hostingEnvironment.WebRootPath)) { throw new MediaConfigurationException("The wwwroot folder for serving cache media files is missing."); } @@ -100,7 +100,7 @@ public override void ConfigureServices(IServiceCollection services) var clock = serviceProvider.GetRequiredService(); var logger = serviceProvider.GetRequiredService>(); var amazonS3Client = serviceProvider.GetService(); - + var options = serviceProvider.GetRequiredService>(); var fileStore = new AwsFileStore(clock, options.Value, amazonS3Client); diff --git a/src/OrchardCore.Modules/OrchardCore.Media.Azure/AdminMenu.cs b/src/OrchardCore.Modules/OrchardCore.Media.Azure/AdminMenu.cs index b3699d95c90..884aee78f11 100644 --- a/src/OrchardCore.Modules/OrchardCore.Media.Azure/AdminMenu.cs +++ b/src/OrchardCore.Modules/OrchardCore.Media.Azure/AdminMenu.cs @@ -16,7 +16,7 @@ public AdminMenu(IStringLocalizer localizer) public Task BuildNavigationAsync(string name, NavigationBuilder builder) { - if (!String.Equals(name, "admin", StringComparison.OrdinalIgnoreCase)) + if (!string.Equals(name, "admin", StringComparison.OrdinalIgnoreCase)) { return Task.CompletedTask; } diff --git a/src/OrchardCore.Modules/OrchardCore.Media.Azure/MediaBlobContainerTenantEvents.cs b/src/OrchardCore.Modules/OrchardCore.Media.Azure/MediaBlobContainerTenantEvents.cs index 21c86de4652..e4f706d62b3 100644 --- a/src/OrchardCore.Modules/OrchardCore.Media.Azure/MediaBlobContainerTenantEvents.cs +++ b/src/OrchardCore.Modules/OrchardCore.Media.Azure/MediaBlobContainerTenantEvents.cs @@ -36,8 +36,8 @@ public override async Task ActivatingAsync() { // Only create container if options are valid. if (_shellSettings.IsUninitialized() || - String.IsNullOrEmpty(_options.ConnectionString) || - String.IsNullOrEmpty(_options.ContainerName) || + string.IsNullOrEmpty(_options.ConnectionString) || + string.IsNullOrEmpty(_options.ContainerName) || !_options.CreateContainer ) { @@ -63,8 +63,8 @@ public override async Task RemovingAsync(ShellRemovingContext context) { // Only remove container if options are valid. if (!_options.RemoveContainer || - String.IsNullOrEmpty(_options.ConnectionString) || - String.IsNullOrEmpty(_options.ContainerName)) + string.IsNullOrEmpty(_options.ConnectionString) || + string.IsNullOrEmpty(_options.ContainerName)) { return; } diff --git a/src/OrchardCore.Modules/OrchardCore.Media.Azure/MediaBlobStorageOptionsConfiguration.cs b/src/OrchardCore.Modules/OrchardCore.Media.Azure/MediaBlobStorageOptionsConfiguration.cs index 0bbbbdfeef9..522b5b5db25 100644 --- a/src/OrchardCore.Modules/OrchardCore.Media.Azure/MediaBlobStorageOptionsConfiguration.cs +++ b/src/OrchardCore.Modules/OrchardCore.Media.Azure/MediaBlobStorageOptionsConfiguration.cs @@ -32,9 +32,9 @@ public void Configure(MediaBlobStorageOptions options) { var section = _shellConfiguration.GetSection("OrchardCore_Media_Azure"); - options.BasePath = section.GetValue(nameof(options.BasePath), String.Empty); - options.ContainerName = section.GetValue(nameof(options.ContainerName), String.Empty); - options.ConnectionString = section.GetValue(nameof(options.ConnectionString), String.Empty); + options.BasePath = section.GetValue(nameof(options.BasePath), string.Empty); + options.ContainerName = section.GetValue(nameof(options.ContainerName), string.Empty); + options.ConnectionString = section.GetValue(nameof(options.ConnectionString), string.Empty); options.CreateContainer = section.GetValue(nameof(options.CreateContainer), true); options.RemoveContainer = section.GetValue(nameof(options.RemoveContainer), false); @@ -57,7 +57,7 @@ private void ParseContainerName(MediaBlobStorageOptions options, TemplateContext // container name must be lowercase options.ContainerName = template.Render(templateContext, NullEncoder.Default).ToLower(); - options.ContainerName = options.ContainerName.Replace("\r", String.Empty).Replace("\n", String.Empty); + options.ContainerName = options.ContainerName.Replace("\r", string.Empty).Replace("\n", string.Empty); } catch (Exception e) { @@ -73,7 +73,7 @@ private void ParseBasePath(MediaBlobStorageOptions options, TemplateContext temp var template = _fluidParser.Parse(options.BasePath); options.BasePath = template.Render(templateContext, NullEncoder.Default); - options.BasePath = options.BasePath.Replace("\r", String.Empty).Replace("\n", String.Empty); + options.BasePath = options.BasePath.Replace("\r", string.Empty).Replace("\n", string.Empty); } catch (Exception e) { diff --git a/src/OrchardCore.Modules/OrchardCore.Media.Azure/Startup.cs b/src/OrchardCore.Modules/OrchardCore.Media.Azure/Startup.cs index 7f404729b62..9d818de66ca 100644 --- a/src/OrchardCore.Modules/OrchardCore.Media.Azure/Startup.cs +++ b/src/OrchardCore.Modules/OrchardCore.Media.Azure/Startup.cs @@ -67,7 +67,7 @@ public override void ConfigureServices(IServiceCollection services) { var hostingEnvironment = serviceProvider.GetRequiredService(); - if (String.IsNullOrWhiteSpace(hostingEnvironment.WebRootPath)) + if (string.IsNullOrWhiteSpace(hostingEnvironment.WebRootPath)) { throw new MediaConfigurationException("The wwwroot folder for serving cache media files is missing."); } @@ -137,13 +137,13 @@ private static bool CheckOptions(string connectionString, string containerName, { var optionsAreValid = true; - if (String.IsNullOrWhiteSpace(connectionString)) + if (string.IsNullOrWhiteSpace(connectionString)) { logger.LogError("Azure Media Storage is enabled but not active because the 'ConnectionString' is missing or empty in application configuration."); optionsAreValid = false; } - if (String.IsNullOrWhiteSpace(containerName)) + if (string.IsNullOrWhiteSpace(containerName)) { logger.LogError("Azure Media Storage is enabled but not active because the 'ContainerName' is missing or empty in application configuration."); optionsAreValid = false; diff --git a/src/OrchardCore.Modules/OrchardCore.Media/AdminMenu.cs b/src/OrchardCore.Modules/OrchardCore.Media/AdminMenu.cs index 5271cf8841a..9b35f1faac0 100644 --- a/src/OrchardCore.Modules/OrchardCore.Media/AdminMenu.cs +++ b/src/OrchardCore.Modules/OrchardCore.Media/AdminMenu.cs @@ -16,7 +16,7 @@ public AdminMenu(IStringLocalizer localizer) public Task BuildNavigationAsync(string name, NavigationBuilder builder) { - if (!String.Equals(name, "admin", StringComparison.OrdinalIgnoreCase)) + if (!string.Equals(name, "admin", StringComparison.OrdinalIgnoreCase)) { return Task.CompletedTask; } @@ -57,7 +57,7 @@ public MediaCacheAdminMenu(IStringLocalizer localizer) public Task BuildNavigationAsync(string name, NavigationBuilder builder) { - if (!String.Equals(name, "admin", StringComparison.OrdinalIgnoreCase)) + if (!string.Equals(name, "admin", StringComparison.OrdinalIgnoreCase)) { return Task.CompletedTask; } diff --git a/src/OrchardCore.Modules/OrchardCore.Media/Controllers/AdminController.cs b/src/OrchardCore.Modules/OrchardCore.Media/Controllers/AdminController.cs index 795d3548465..01508bf3b8b 100644 --- a/src/OrchardCore.Modules/OrchardCore.Media/Controllers/AdminController.cs +++ b/src/OrchardCore.Modules/OrchardCore.Media/Controllers/AdminController.cs @@ -72,9 +72,9 @@ public async Task>> GetFolders(string return Forbid(); } - if (String.IsNullOrEmpty(path)) + if (string.IsNullOrEmpty(path)) { - path = String.Empty; + path = string.Empty; } if (await _mediaFileStore.GetDirectoryInfoAsync(path) == null) @@ -97,9 +97,9 @@ public async Task>> GetFolders(string public async Task>> GetMediaItems(string path, string extensions) { - if (String.IsNullOrEmpty(path)) + if (string.IsNullOrEmpty(path)) { - path = String.Empty; + path = string.Empty; } if (!await _authorizationService.AuthorizeAsync(User, Permissions.ManageMedia) @@ -129,7 +129,7 @@ public async Task> GetMediaItem(string path) return Forbid(); } - if (String.IsNullOrEmpty(path)) + if (string.IsNullOrEmpty(path)) { return NotFound(); } @@ -162,9 +162,9 @@ public async Task Upload(string path, string extensions) (_, _, _) => Task.FromResult(Ok(new { })), async (files) => { - if (String.IsNullOrEmpty(path)) + if (string.IsNullOrEmpty(path)) { - path = String.Empty; + path = string.Empty; } var result = new List(); @@ -236,7 +236,7 @@ public async Task DeleteFolder(string path) return Forbid(); } - if (String.IsNullOrEmpty(path)) + if (string.IsNullOrEmpty(path)) { return StatusCode(StatusCodes.Status403Forbidden, S["Cannot delete root media folder"]); } @@ -264,7 +264,7 @@ public async Task DeleteMedia(string path) return Forbid(); } - if (String.IsNullOrEmpty(path)) + if (string.IsNullOrEmpty(path)) { return NotFound(); } @@ -286,7 +286,7 @@ public async Task MoveMedia(string oldPath, string newPath) return Forbid(); } - if (String.IsNullOrEmpty(oldPath) || String.IsNullOrEmpty(newPath)) + if (string.IsNullOrEmpty(oldPath) || string.IsNullOrEmpty(newPath)) { return NotFound(); } @@ -356,14 +356,14 @@ public async Task MoveMediaList(string[] mediaNames, string sourc } if ((mediaNames == null) || (mediaNames.Length < 1) - || String.IsNullOrEmpty(sourceFolder) - || String.IsNullOrEmpty(targetFolder)) + || string.IsNullOrEmpty(sourceFolder) + || string.IsNullOrEmpty(targetFolder)) { return NotFound(); } - sourceFolder = sourceFolder == "root" ? String.Empty : sourceFolder; - targetFolder = targetFolder == "root" ? String.Empty : targetFolder; + sourceFolder = sourceFolder == "root" ? string.Empty : sourceFolder; + targetFolder = targetFolder == "root" ? string.Empty : targetFolder; var filesOnError = new List(); @@ -383,7 +383,7 @@ public async Task MoveMediaList(string[] mediaNames, string sourc if (filesOnError.Count > 0) { - return BadRequest(S["Error when moving files. Maybe they already exist on the target folder? Files on error: {0}", String.Join(",", filesOnError)].ToString()); + return BadRequest(S["Error when moving files. Maybe they already exist on the target folder? Files on error: {0}", string.Join(",", filesOnError)].ToString()); } return Ok(); @@ -394,9 +394,9 @@ public async Task> CreateFolder( string path, string name, [FromServices] IAuthorizationService authorizationService) { - if (String.IsNullOrEmpty(path)) + if (string.IsNullOrEmpty(path)) { - path = String.Empty; + path = string.Empty; } name = _mediaNameNormalizerService.NormalizeFolderName(name); @@ -446,9 +446,9 @@ public object CreateFileResult(IFileStoreEntry mediaFile) url = _mediaFileStore.MapPathToPublicUrl(mediaFile.Path), mediaPath = mediaFile.Path, mime = contentType ?? "application/octet-stream", - mediaText = String.Empty, + mediaText = string.Empty, anchor = new { x = 0.5f, y = 0.5f }, - attachedFileName = String.Empty + attachedFileName = string.Empty }; } @@ -469,7 +469,7 @@ public async Task Options() private HashSet GetRequestedExtensions(string exts, bool fallback) { - if (!String.IsNullOrWhiteSpace(exts)) + if (!string.IsNullOrWhiteSpace(exts)) { var extensions = exts.Split(ExtensionSeperator, StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries); diff --git a/src/OrchardCore.Modules/OrchardCore.Media/Controllers/MediaProfilesController.cs b/src/OrchardCore.Modules/OrchardCore.Media/Controllers/MediaProfilesController.cs index 54d2af84b26..c6e4cde9175 100644 --- a/src/OrchardCore.Modules/OrchardCore.Media/Controllers/MediaProfilesController.cs +++ b/src/OrchardCore.Modules/OrchardCore.Media/Controllers/MediaProfilesController.cs @@ -66,7 +66,7 @@ public async Task Index(ContentOptions options, PagerParameters p var mediaProfilesDocument = await _mediaProfilesManager.GetMediaProfilesDocumentAsync(); var mediaProfiles = mediaProfilesDocument.MediaProfiles.ToList(); - if (!String.IsNullOrWhiteSpace(options.Search)) + if (!string.IsNullOrWhiteSpace(options.Search)) { mediaProfiles = mediaProfiles.Where(x => x.Key.Contains(options.Search, StringComparison.OrdinalIgnoreCase)).ToList(); } @@ -125,7 +125,7 @@ public async Task CreatePost(MediaProfileViewModel model, string if (ModelState.IsValid) { - if (String.IsNullOrWhiteSpace(model.Name)) + if (string.IsNullOrWhiteSpace(model.Name)) { ModelState.AddModelError(nameof(MediaProfileViewModel.Name), S["The name is mandatory."]); } @@ -229,7 +229,7 @@ public async Task Edit(string sourceName, MediaProfileViewModel m if (ModelState.IsValid) { - if (String.IsNullOrWhiteSpace(model.Name)) + if (string.IsNullOrWhiteSpace(model.Name)) { ModelState.AddModelError(nameof(MediaProfileViewModel.Name), S["The name is mandatory."]); } diff --git a/src/OrchardCore.Modules/OrchardCore.Media/Drivers/MediaFieldDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.Media/Drivers/MediaFieldDisplayDriver.cs index 014bb804e82..1cd3d5bf5e6 100644 --- a/src/OrchardCore.Modules/OrchardCore.Media/Drivers/MediaFieldDisplayDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Media/Drivers/MediaFieldDisplayDriver.cs @@ -99,12 +99,12 @@ public override async Task UpdateAsync(MediaField field, IUpdate if (await updater.TryUpdateModelAsync(model, Prefix, f => f.Paths)) { // Deserializing an empty string doesn't return an array - var items = String.IsNullOrWhiteSpace(model.Paths) + var items = string.IsNullOrWhiteSpace(model.Paths) ? new List() : JsonSerializer.Deserialize>(model.Paths, _settings); // If it's an attached media field editor the files are automatically handled by _attachedMediaFieldFileService. - if (String.Equals(context.PartFieldDefinition.Editor(), "Attached", StringComparison.OrdinalIgnoreCase)) + if (string.Equals(context.PartFieldDefinition.Editor(), "Attached", StringComparison.OrdinalIgnoreCase)) { try { @@ -130,7 +130,7 @@ public override async Task UpdateAsync(MediaField field, IUpdate if (!settings.AllowedExtensions.Contains(extension)) { - updater.ModelState.AddModelError(Prefix, nameof(model.Paths), S["Media extension is not allowed. Only media with '{0}' extensions are allowed.", String.Join(", ", settings.AllowedExtensions)]); + updater.ModelState.AddModelError(Prefix, nameof(model.Paths), S["Media extension is not allowed. Only media with '{0}' extensions are allowed.", string.Join(", ", settings.AllowedExtensions)]); } } } diff --git a/src/OrchardCore.Modules/OrchardCore.Media/GraphQL/MediaAssetQuery.cs b/src/OrchardCore.Modules/OrchardCore.Media/GraphQL/MediaAssetQuery.cs index 78a49b7b3b3..50eb6748716 100644 --- a/src/OrchardCore.Modules/OrchardCore.Media/GraphQL/MediaAssetQuery.cs +++ b/src/OrchardCore.Modules/OrchardCore.Media/GraphQL/MediaAssetQuery.cs @@ -27,7 +27,7 @@ public MediaAssetQuery( _graphQLContentOptions = graphQLContentOptions.Value; } - public Task GetIdentifierAsync() => Task.FromResult(String.Empty); + public Task GetIdentifierAsync() => Task.FromResult(string.Empty); public Task BuildAsync(ISchema schema) { @@ -65,7 +65,7 @@ private async Task> ResolveAsync(IResolveFieldConte { var mediaFileStore = resolveContext.RequestServices.GetService(); - var path = resolveContext.GetArgument("path", String.Empty); + var path = resolveContext.GetArgument("path", string.Empty); var includeSubDirectories = resolveContext.GetArgument("includeSubDirectories", false); var allFiles = mediaFileStore.GetDirectoryContentAsync(path, includeSubDirectories); diff --git a/src/OrchardCore.Modules/OrchardCore.Media/Indexing/PresentationDocumentMediaFileTextProvider.cs b/src/OrchardCore.Modules/OrchardCore.Media/Indexing/PresentationDocumentMediaFileTextProvider.cs index ff5ea6c2de4..6a7c7b9d785 100644 --- a/src/OrchardCore.Modules/OrchardCore.Media/Indexing/PresentationDocumentMediaFileTextProvider.cs +++ b/src/OrchardCore.Modules/OrchardCore.Media/Indexing/PresentationDocumentMediaFileTextProvider.cs @@ -20,7 +20,7 @@ public Task GetTextAsync(string path, Stream fileStream) var slideIds = document.PresentationPart?.Presentation?.SlideIdList?.ChildElements.Cast(); if (slideIds is null || !slideIds.Any()) { - return Task.FromResult(String.Empty); + return Task.FromResult(string.Empty); } using var stringBuilder = ZString.CreateStringBuilder(); @@ -43,7 +43,7 @@ public Task GetTextAsync(string path, Stream fileStream) } catch { - return Task.FromResult(String.Empty); + return Task.FromResult(string.Empty); } } diff --git a/src/OrchardCore.Modules/OrchardCore.Media/Indexing/WordDocumentMediaFileTextProvider.cs b/src/OrchardCore.Modules/OrchardCore.Media/Indexing/WordDocumentMediaFileTextProvider.cs index 3b2c7d630b8..9501b33b1be 100644 --- a/src/OrchardCore.Modules/OrchardCore.Media/Indexing/WordDocumentMediaFileTextProvider.cs +++ b/src/OrchardCore.Modules/OrchardCore.Media/Indexing/WordDocumentMediaFileTextProvider.cs @@ -19,7 +19,7 @@ public Task GetTextAsync(string path, Stream fileStream) var paragraphs = document.MainDocumentPart?.Document?.Body?.Descendants(); if (paragraphs is null || !paragraphs.Any()) { - return Task.FromResult(String.Empty); + return Task.FromResult(string.Empty); } using var stringBuilder = ZString.CreateStringBuilder(); @@ -33,7 +33,7 @@ public Task GetTextAsync(string path, Stream fileStream) } catch { - return Task.FromResult(String.Empty); + return Task.FromResult(string.Empty); } } } diff --git a/src/OrchardCore.Modules/OrchardCore.Media/Liquid/MediaAnchorTag.cs b/src/OrchardCore.Modules/OrchardCore.Media/Liquid/MediaAnchorTag.cs index 5c94bc84eb7..2b0ed2d7e65 100644 --- a/src/OrchardCore.Modules/OrchardCore.Media/Liquid/MediaAnchorTag.cs +++ b/src/OrchardCore.Modules/OrchardCore.Media/Liquid/MediaAnchorTag.cs @@ -59,7 +59,7 @@ public async ValueTask WriteToAsync(List argumentsLi } } - if (String.IsNullOrEmpty(assetHref)) + if (string.IsNullOrEmpty(assetHref)) { return Completion.Normal; } diff --git a/src/OrchardCore.Modules/OrchardCore.Media/Processing/ImageSharpUrlFormatter.cs b/src/OrchardCore.Modules/OrchardCore.Media/Processing/ImageSharpUrlFormatter.cs index 9de4c8e22ae..606e05d8b61 100644 --- a/src/OrchardCore.Modules/OrchardCore.Media/Processing/ImageSharpUrlFormatter.cs +++ b/src/OrchardCore.Modules/OrchardCore.Media/Processing/ImageSharpUrlFormatter.cs @@ -32,7 +32,7 @@ internal class ImageSharpUrlFormatter { public static string GetImageResizeUrl(string path, IDictionary queryStringParams = null, int? width = null, int? height = null, ResizeMode resizeMode = ResizeMode.Undefined, int? quality = null, Format format = Format.Undefined, Anchor anchor = null, string bgcolor = null) { - if (String.IsNullOrEmpty(path) || (!width.HasValue && !height.HasValue && queryStringParams == null)) + if (string.IsNullOrEmpty(path) || (!width.HasValue && !height.HasValue && queryStringParams == null)) { return path; } @@ -71,7 +71,7 @@ public static string GetImageResizeUrl(string path, IDictionary queryStringParams["rxy"] = anchor.X.ToString(CultureInfo.InvariantCulture) + ',' + anchor.Y.ToString(CultureInfo.InvariantCulture); } - if (!String.IsNullOrEmpty(bgcolor)) + if (!string.IsNullOrEmpty(bgcolor)) { queryStringParams["bgcolor"] = bgcolor; } diff --git a/src/OrchardCore.Modules/OrchardCore.Media/Processing/MediaTokenService.cs b/src/OrchardCore.Modules/OrchardCore.Media/Processing/MediaTokenService.cs index bc98794f57a..0d37c51b804 100644 --- a/src/OrchardCore.Modules/OrchardCore.Media/Processing/MediaTokenService.cs +++ b/src/OrchardCore.Modules/OrchardCore.Media/Processing/MediaTokenService.cs @@ -122,7 +122,7 @@ public bool TryValidateToken(KeyedCollection - /// Custom version of that takes our pre-built + /// Custom version of that takes our pre-built /// dictionary, uri as ReadOnlySpan<char> and uses ZString. Otherwise same logic. /// private static string AddQueryString( diff --git a/src/OrchardCore.Modules/OrchardCore.Media/Recipes/MediaProfileStep.cs b/src/OrchardCore.Modules/OrchardCore.Media/Recipes/MediaProfileStep.cs index d242992fb9a..247581e092b 100644 --- a/src/OrchardCore.Modules/OrchardCore.Media/Recipes/MediaProfileStep.cs +++ b/src/OrchardCore.Modules/OrchardCore.Media/Recipes/MediaProfileStep.cs @@ -22,7 +22,7 @@ public MediaProfileStep(MediaProfilesManager mediaProfilesManager) public async Task ExecuteAsync(RecipeExecutionContext context) { - if (!String.Equals(context.Name, "MediaProfiles", StringComparison.OrdinalIgnoreCase)) + if (!string.Equals(context.Name, "MediaProfiles", StringComparison.OrdinalIgnoreCase)) { return; } diff --git a/src/OrchardCore.Modules/OrchardCore.Media/Recipes/MediaStep.cs b/src/OrchardCore.Modules/OrchardCore.Media/Recipes/MediaStep.cs index 4fb3dbb682c..6234f883e10 100644 --- a/src/OrchardCore.Modules/OrchardCore.Media/Recipes/MediaStep.cs +++ b/src/OrchardCore.Modules/OrchardCore.Media/Recipes/MediaStep.cs @@ -34,7 +34,7 @@ public MediaStep( public async Task ExecuteAsync(RecipeExecutionContext context) { - if (!String.Equals(context.Name, "media", StringComparison.OrdinalIgnoreCase)) + if (!string.Equals(context.Name, "media", StringComparison.OrdinalIgnoreCase)) { return; } @@ -52,17 +52,17 @@ public async Task ExecuteAsync(RecipeExecutionContext context) Stream stream = null; - if (!String.IsNullOrWhiteSpace(file.Base64)) + if (!string.IsNullOrWhiteSpace(file.Base64)) { stream = new MemoryStream(Convert.FromBase64String(file.Base64)); } - else if (!String.IsNullOrWhiteSpace(file.SourcePath)) + else if (!string.IsNullOrWhiteSpace(file.SourcePath)) { var fileInfo = context.RecipeDescriptor.FileProvider.GetRelativeFileInfo(context.RecipeDescriptor.BasePath, file.SourcePath); stream = fileInfo.CreateReadStream(); } - else if (!String.IsNullOrWhiteSpace(file.SourceUrl)) + else if (!string.IsNullOrWhiteSpace(file.SourceUrl)) { var response = await _httpClient.GetAsync(file.SourceUrl); if (response.IsSuccessStatusCode) diff --git a/src/OrchardCore.Modules/OrchardCore.Media/Services/AttachedMediaFieldFileService.cs b/src/OrchardCore.Modules/OrchardCore.Media/Services/AttachedMediaFieldFileService.cs index 09e133907fc..984746c06db 100644 --- a/src/OrchardCore.Modules/OrchardCore.Media/Services/AttachedMediaFieldFileService.cs +++ b/src/OrchardCore.Modules/OrchardCore.Media/Services/AttachedMediaFieldFileService.cs @@ -89,7 +89,7 @@ private async Task RemoveTemporaryAsync(List items) // Newly added files private async Task MoveNewFilesToContentItemDirAndUpdatePathsAsync(List items, ContentItem contentItem) { - foreach (var item in items.Where(i => !i.IsRemoved && !String.IsNullOrEmpty(i.Path))) + foreach (var item in items.Where(i => !i.IsRemoved && !string.IsNullOrEmpty(i.Path))) { var fileInfo = await _fileStore.GetFileInfoAsync(item.Path); diff --git a/src/OrchardCore.Modules/OrchardCore.Media/Services/ChunkFileUploadService.cs b/src/OrchardCore.Modules/OrchardCore.Media/Services/ChunkFileUploadService.cs index e3f656ec0c4..c6284c9f1ed 100644 --- a/src/OrchardCore.Modules/OrchardCore.Media/Services/ChunkFileUploadService.cs +++ b/src/OrchardCore.Modules/OrchardCore.Media/Services/ChunkFileUploadService.cs @@ -200,7 +200,7 @@ private static Stream CreateTemporaryFile(string tempPath, long size) private static string CalculateHash(params string[] parts) { - var hash = SHA256.HashData(Encoding.UTF8.GetBytes(String.Join(String.Empty, parts))); + var hash = SHA256.HashData(Encoding.UTF8.GetBytes(string.Join(string.Empty, parts))); return Convert.ToHexString(hash); } diff --git a/src/OrchardCore.Modules/OrchardCore.Media/Services/MediaOptionsConfiguration.cs b/src/OrchardCore.Modules/OrchardCore.Media/Services/MediaOptionsConfiguration.cs index 283bd36db1d..af43887bcd8 100644 --- a/src/OrchardCore.Modules/OrchardCore.Media/Services/MediaOptionsConfiguration.cs +++ b/src/OrchardCore.Modules/OrchardCore.Media/Services/MediaOptionsConfiguration.cs @@ -88,7 +88,7 @@ public void Configure(MediaOptions options) options.MaxBrowserCacheDays = section.GetValue("MaxBrowserCacheDays", DefaultMaxBrowserCacheDays); options.MaxCacheDays = section.GetValue("MaxCacheDays", DefaultMaxCacheDays); options.MaxFileSize = section.GetValue("MaxFileSize", DefaultMaxFileSize); - options.CdnBaseUrl = section.GetValue("CdnBaseUrl", String.Empty).TrimEnd('/').ToLower(); + options.CdnBaseUrl = section.GetValue("CdnBaseUrl", string.Empty).TrimEnd('/').ToLower(); options.AssetsRequestPath = section.GetValue("AssetsRequestPath", DefaultAssetsRequestPath); options.AssetsPath = section.GetValue("AssetsPath", DefaultAssetsPath); options.AssetsUsersFolder = section.GetValue("AssetsUsersFolder", DefaultAssetsUsersFolder); diff --git a/src/OrchardCore.Modules/OrchardCore.Media/Services/MediaProfileService.cs b/src/OrchardCore.Modules/OrchardCore.Media/Services/MediaProfileService.cs index 645b1936e05..0983fe84813 100644 --- a/src/OrchardCore.Modules/OrchardCore.Media/Services/MediaProfileService.cs +++ b/src/OrchardCore.Modules/OrchardCore.Media/Services/MediaProfileService.cs @@ -47,7 +47,7 @@ public async Task> GetMediaProfileCommands(string na commands["quality"] = mediaProfile.Quality.ToString(); } - if (!String.IsNullOrEmpty(mediaProfile.BackgroundColor)) + if (!string.IsNullOrEmpty(mediaProfile.BackgroundColor)) { commands["bgcolor"] = mediaProfile.BackgroundColor; } diff --git a/src/OrchardCore.Modules/OrchardCore.Media/Settings/MediaFieldSettingsDriver.cs b/src/OrchardCore.Modules/OrchardCore.Media/Settings/MediaFieldSettingsDriver.cs index 4411803ee8b..f8db6dbbe2d 100644 --- a/src/OrchardCore.Modules/OrchardCore.Media/Settings/MediaFieldSettingsDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Media/Settings/MediaFieldSettingsDriver.cs @@ -95,7 +95,7 @@ public override async Task UpdateAsync(ContentPartFieldDefinitio if (selectedExtensions.Length == 0) { - context.Updater.ModelState.AddModelError(Prefix, String.Empty, S["Please select at least one extension."]); + context.Updater.ModelState.AddModelError(Prefix, string.Empty, S["Please select at least one extension."]); } settings.AllowedExtensions = selectedExtensions; diff --git a/src/OrchardCore.Modules/OrchardCore.Media/Shortcodes/AssetUrlShortcodeProvider.cs b/src/OrchardCore.Modules/OrchardCore.Media/Shortcodes/AssetUrlShortcodeProvider.cs index c9caff0194b..6ab8093d15d 100644 --- a/src/OrchardCore.Modules/OrchardCore.Media/Shortcodes/AssetUrlShortcodeProvider.cs +++ b/src/OrchardCore.Modules/OrchardCore.Media/Shortcodes/AssetUrlShortcodeProvider.cs @@ -27,16 +27,16 @@ public AssetUrlShortcodeProvider( public ValueTask EvaluateAsync(string identifier, Arguments arguments, string content, Context context) { - if (!String.Equals(identifier, "asset_url", StringComparison.OrdinalIgnoreCase)) + if (!string.Equals(identifier, "asset_url", StringComparison.OrdinalIgnoreCase)) { return new ValueTask((string)null); } // Handle self closing shortcodes. - if (String.IsNullOrEmpty(content)) + if (string.IsNullOrEmpty(content)) { content = arguments.NamedOrDefault("src"); - if (String.IsNullOrEmpty(content)) + if (string.IsNullOrEmpty(content)) { return new ValueTask("[asset_url]"); } @@ -48,7 +48,7 @@ public ValueTask EvaluateAsync(string identifier, Arguments arguments, s if (content.StartsWith("~/", StringComparison.Ordinal)) { content = _httpContextAccessor.HttpContext.Request.PathBase.Add(content[1..]).Value; - if (!String.IsNullOrEmpty(_options.CdnBaseUrl)) + if (!string.IsNullOrEmpty(_options.CdnBaseUrl)) { content = _options.CdnBaseUrl + content; } diff --git a/src/OrchardCore.Modules/OrchardCore.Media/Shortcodes/ImageShortcodeProvider.cs b/src/OrchardCore.Modules/OrchardCore.Media/Shortcodes/ImageShortcodeProvider.cs index 3f0720672b6..b6a8c20a154 100644 --- a/src/OrchardCore.Modules/OrchardCore.Media/Shortcodes/ImageShortcodeProvider.cs +++ b/src/OrchardCore.Modules/OrchardCore.Media/Shortcodes/ImageShortcodeProvider.cs @@ -45,10 +45,10 @@ public ValueTask EvaluateAsync(string identifier, Arguments arguments, s } // Handle self closing shortcodes. - if (String.IsNullOrEmpty(content)) + if (string.IsNullOrEmpty(content)) { content = arguments.NamedOrDefault("src"); - if (String.IsNullOrEmpty(content)) + if (string.IsNullOrEmpty(content)) { // Do not handle the deprecated media shortcode in this edge case. return ImageShortcode; @@ -61,7 +61,7 @@ public ValueTask EvaluateAsync(string identifier, Arguments arguments, s if (content.StartsWith("~/", StringComparison.Ordinal)) { content = _httpContextAccessor.HttpContext.Request.PathBase.Add(content[1..]).Value; - if (!String.IsNullOrEmpty(_options.CdnBaseUrl)) + if (!string.IsNullOrEmpty(_options.CdnBaseUrl)) { content = _options.CdnBaseUrl + content; } @@ -71,8 +71,8 @@ public ValueTask EvaluateAsync(string identifier, Arguments arguments, s content = _mediaFileStore.MapPathToPublicUrl(content); } } - var className = String.Empty; - var altText = String.Empty; + var className = string.Empty; + var altText = string.Empty; if (arguments.Any()) { var queryStringParams = new Dictionary(); diff --git a/src/OrchardCore.Modules/OrchardCore.Media/TagHelpers/AnchorTagHelper.cs b/src/OrchardCore.Modules/OrchardCore.Media/TagHelpers/AnchorTagHelper.cs index 2fa07e524ec..02d68931eed 100644 --- a/src/OrchardCore.Modules/OrchardCore.Media/TagHelpers/AnchorTagHelper.cs +++ b/src/OrchardCore.Modules/OrchardCore.Media/TagHelpers/AnchorTagHelper.cs @@ -44,7 +44,7 @@ IFileVersionProvider fileVersionProvider public override void Process(TagHelperContext context, TagHelperOutput output) { - if (String.IsNullOrEmpty(AssetHref)) + if (string.IsNullOrEmpty(AssetHref)) { return; } diff --git a/src/OrchardCore.Modules/OrchardCore.Media/TagHelpers/ImageResizeTagHelper.cs b/src/OrchardCore.Modules/OrchardCore.Media/TagHelpers/ImageResizeTagHelper.cs index ccdb15359d1..20f2c0fcc0c 100644 --- a/src/OrchardCore.Modules/OrchardCore.Media/TagHelpers/ImageResizeTagHelper.cs +++ b/src/OrchardCore.Modules/OrchardCore.Media/TagHelpers/ImageResizeTagHelper.cs @@ -70,7 +70,7 @@ public ImageResizeTagHelper( public override async Task ProcessAsync(TagHelperContext context, TagHelperOutput output) { - if (!ImageWidth.HasValue && !ImageHeight.HasValue && String.IsNullOrEmpty(ImageProfile)) + if (!ImageWidth.HasValue && !ImageHeight.HasValue && string.IsNullOrEmpty(ImageProfile)) { return; } @@ -84,7 +84,7 @@ public override async Task ProcessAsync(TagHelperContext context, TagHelperOutpu IDictionary queryStringParams = null; - if (!String.IsNullOrEmpty(ImageProfile)) + if (!string.IsNullOrEmpty(ImageProfile)) { queryStringParams = await _mediaProfileService.GetMediaProfileCommands(ImageProfile); } diff --git a/src/OrchardCore.Modules/OrchardCore.Media/TagHelpers/ImageTagHelper.cs b/src/OrchardCore.Modules/OrchardCore.Media/TagHelpers/ImageTagHelper.cs index dc0dd70991e..b93089fbc81 100644 --- a/src/OrchardCore.Modules/OrchardCore.Media/TagHelpers/ImageTagHelper.cs +++ b/src/OrchardCore.Modules/OrchardCore.Media/TagHelpers/ImageTagHelper.cs @@ -49,7 +49,7 @@ IFileVersionProvider fileVersionProvider public override void Process(TagHelperContext context, TagHelperOutput output) { - if (String.IsNullOrEmpty(AssetSrc)) + if (string.IsNullOrEmpty(AssetSrc)) { return; } diff --git a/src/OrchardCore.Modules/OrchardCore.Media/ViewModels/EditMediaFieldViewModel.cs b/src/OrchardCore.Modules/OrchardCore.Media/ViewModels/EditMediaFieldViewModel.cs index 6475771ec52..fcfbe01ef38 100644 --- a/src/OrchardCore.Modules/OrchardCore.Media/ViewModels/EditMediaFieldViewModel.cs +++ b/src/OrchardCore.Modules/OrchardCore.Media/ViewModels/EditMediaFieldViewModel.cs @@ -46,7 +46,7 @@ public class EditMediaFieldItemInfo public bool IsRemoved { get; set; } // Alt text is an option that maybe applied to a media field through settings. - public string MediaText { get; set; } = String.Empty; + public string MediaText { get; set; } = string.Empty; public Anchor Anchor { get; set; } = new Anchor(); } } diff --git a/src/OrchardCore.Modules/OrchardCore.Menu/AdminMenu.cs b/src/OrchardCore.Modules/OrchardCore.Menu/AdminMenu.cs index 9cf51c89673..0fcc3eb9722 100644 --- a/src/OrchardCore.Modules/OrchardCore.Menu/AdminMenu.cs +++ b/src/OrchardCore.Modules/OrchardCore.Menu/AdminMenu.cs @@ -17,7 +17,7 @@ public AdminMenu(IStringLocalizer localizer) public Task BuildNavigationAsync(string name, NavigationBuilder builder) { - if (!String.Equals(name, "admin", StringComparison.OrdinalIgnoreCase)) + if (!string.Equals(name, "admin", StringComparison.OrdinalIgnoreCase)) { return Task.CompletedTask; } diff --git a/src/OrchardCore.Modules/OrchardCore.Menu/Controllers/AdminController.cs b/src/OrchardCore.Modules/OrchardCore.Menu/Controllers/AdminController.cs index 48d70342147..d0f5b3d0d87 100644 --- a/src/OrchardCore.Modules/OrchardCore.Menu/Controllers/AdminController.cs +++ b/src/OrchardCore.Modules/OrchardCore.Menu/Controllers/AdminController.cs @@ -49,7 +49,7 @@ public AdminController( public async Task Create(string id, string menuContentItemId, string menuItemId) { - if (String.IsNullOrWhiteSpace(id)) + if (string.IsNullOrWhiteSpace(id)) { return NotFound(); } diff --git a/src/OrchardCore.Modules/OrchardCore.Menu/Drivers/HtmlMenuItemPartDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.Menu/Drivers/HtmlMenuItemPartDisplayDriver.cs index 28b42171ce5..c10348387e4 100644 --- a/src/OrchardCore.Modules/OrchardCore.Menu/Drivers/HtmlMenuItemPartDisplayDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Menu/Drivers/HtmlMenuItemPartDisplayDriver.cs @@ -84,7 +84,7 @@ public override async Task UpdateAsync(HtmlMenuItemPart part, IU var urlToValidate = part.Url; - if (!String.IsNullOrEmpty(urlToValidate)) + if (!string.IsNullOrEmpty(urlToValidate)) { urlToValidate = urlToValidate.Split('#', 2)[0]; @@ -104,7 +104,7 @@ public override async Task UpdateAsync(HtmlMenuItemPart part, IU { var link = $""; - if (!String.Equals(link, _htmlSanitizerService.Sanitize(link), StringComparison.OrdinalIgnoreCase)) + if (!string.Equals(link, _htmlSanitizerService.Sanitize(link), StringComparison.OrdinalIgnoreCase)) { updater.ModelState.AddModelError(nameof(part.Url), S["{0} is an invalid url.", part.Url]); } diff --git a/src/OrchardCore.Modules/OrchardCore.Menu/Drivers/LinkMenuItemPartDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.Menu/Drivers/LinkMenuItemPartDisplayDriver.cs index 5e0d6c4dd72..1fee2baa094 100644 --- a/src/OrchardCore.Modules/OrchardCore.Menu/Drivers/LinkMenuItemPartDisplayDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Menu/Drivers/LinkMenuItemPartDisplayDriver.cs @@ -79,7 +79,7 @@ public override async Task UpdateAsync(LinkMenuItemPart part, IU var urlToValidate = part.Url; - if (!String.IsNullOrEmpty(urlToValidate)) + if (!string.IsNullOrEmpty(urlToValidate)) { urlToValidate = urlToValidate.Split('#', 2)[0]; @@ -99,7 +99,7 @@ public override async Task UpdateAsync(LinkMenuItemPart part, IU { var link = $""; - if (!String.Equals(link, _htmlSanitizerService.Sanitize(link), StringComparison.OrdinalIgnoreCase)) + if (!string.Equals(link, _htmlSanitizerService.Sanitize(link), StringComparison.OrdinalIgnoreCase)) { updater.ModelState.AddModelError(nameof(part.Url), S["{0} is an invalid url.", part.Url]); } diff --git a/src/OrchardCore.Modules/OrchardCore.Menu/Drivers/MenuPartDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.Menu/Drivers/MenuPartDisplayDriver.cs index f81294f4acf..3561e665928 100644 --- a/src/OrchardCore.Modules/OrchardCore.Menu/Drivers/MenuPartDisplayDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Menu/Drivers/MenuPartDisplayDriver.cs @@ -68,7 +68,7 @@ public override async Task UpdateAsync(MenuPart part, IUpdateMod { var model = new MenuPartEditViewModel(); - if (await updater.TryUpdateModelAsync(model, Prefix, t => t.Hierarchy) && !String.IsNullOrWhiteSpace(model.Hierarchy)) + if (await updater.TryUpdateModelAsync(model, Prefix, t => t.Hierarchy) && !string.IsNullOrWhiteSpace(model.Hierarchy)) { var originalMenuItems = part.ContentItem.As(); diff --git a/src/OrchardCore.Modules/OrchardCore.Menu/MenuShapes.cs b/src/OrchardCore.Modules/OrchardCore.Menu/MenuShapes.cs index 861b77ee688..7ca2c0b6fac 100644 --- a/src/OrchardCore.Modules/OrchardCore.Menu/MenuShapes.cs +++ b/src/OrchardCore.Modules/OrchardCore.Menu/MenuShapes.cs @@ -61,7 +61,7 @@ public void Discover(ShapeTableBuilder builder) var differentiator = FormatName(menu.GetProperty("MenuName")); - if (!String.IsNullOrEmpty(differentiator)) + if (!string.IsNullOrEmpty(differentiator)) { // Menu__[MenuName] e.g. Menu-MainMenu menu.Metadata.Alternates.Add("Menu__" + differentiator); @@ -129,7 +129,7 @@ public void Discover(ShapeTableBuilder builder) menuItem.Metadata.Alternates.Add("MenuItem__" + encodedContentType); menuItem.Metadata.Alternates.Add("MenuItem__" + encodedContentType + "__level__" + level); - if (!String.IsNullOrEmpty(differentiator)) + if (!string.IsNullOrEmpty(differentiator)) { // MenuItem__[MenuName] e.g. MenuItem-MainMenu // MenuItem__[MenuName]__level__[level] e.g. MenuItem-MainMenu-level-2 @@ -161,7 +161,7 @@ public void Discover(ShapeTableBuilder builder) menuItem.Metadata.Alternates.Add("MenuItemLink__" + encodedContentType); menuItem.Metadata.Alternates.Add("MenuItemLink__" + encodedContentType + "__level__" + level); - if (!String.IsNullOrEmpty(differentiator)) + if (!string.IsNullOrEmpty(differentiator)) { // MenuItemLink__[MenuName] e.g. MenuItemLink-MainMenu // MenuItemLink__[MenuName]__level__[level] e.g. MenuItemLink-MainMenu-level-2 @@ -181,7 +181,7 @@ public void Discover(ShapeTableBuilder builder) /// private static string FormatName(string name) { - if (String.IsNullOrEmpty(name)) + if (string.IsNullOrEmpty(name)) { return null; } diff --git a/src/OrchardCore.Modules/OrchardCore.Menu/Models/LinkMenuItemPart.cs b/src/OrchardCore.Modules/OrchardCore.Menu/Models/LinkMenuItemPart.cs index 5a931f0ae3c..f5325a0dbfb 100644 --- a/src/OrchardCore.Modules/OrchardCore.Menu/Models/LinkMenuItemPart.cs +++ b/src/OrchardCore.Modules/OrchardCore.Menu/Models/LinkMenuItemPart.cs @@ -1,4 +1,4 @@ -using System; +using System; using OrchardCore.ContentManagement; namespace OrchardCore.Menu.Models diff --git a/src/OrchardCore.Modules/OrchardCore.Menu/Models/MenuItemsListPart.cs b/src/OrchardCore.Modules/OrchardCore.Menu/Models/MenuItemsListPart.cs index 33ef75c0961..aab8ed9a0de 100644 --- a/src/OrchardCore.Modules/OrchardCore.Menu/Models/MenuItemsListPart.cs +++ b/src/OrchardCore.Modules/OrchardCore.Menu/Models/MenuItemsListPart.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using OrchardCore.ContentManagement; namespace OrchardCore.Menu.Models diff --git a/src/OrchardCore.Modules/OrchardCore.Menu/Models/MenuPart.cs b/src/OrchardCore.Modules/OrchardCore.Menu/Models/MenuPart.cs index e239f5c909a..e728ea35723 100644 --- a/src/OrchardCore.Modules/OrchardCore.Menu/Models/MenuPart.cs +++ b/src/OrchardCore.Modules/OrchardCore.Menu/Models/MenuPart.cs @@ -1,4 +1,4 @@ -using OrchardCore.ContentManagement; +using OrchardCore.ContentManagement; namespace OrchardCore.Menu.Models { diff --git a/src/OrchardCore.Modules/OrchardCore.Menu/ViewModels/LinkMenuItemPartEditViewModel.cs b/src/OrchardCore.Modules/OrchardCore.Menu/ViewModels/LinkMenuItemPartEditViewModel.cs index 7198846cfb8..1848b526e77 100644 --- a/src/OrchardCore.Modules/OrchardCore.Menu/ViewModels/LinkMenuItemPartEditViewModel.cs +++ b/src/OrchardCore.Modules/OrchardCore.Menu/ViewModels/LinkMenuItemPartEditViewModel.cs @@ -1,4 +1,4 @@ -using Microsoft.AspNetCore.Mvc.ModelBinding; +using Microsoft.AspNetCore.Mvc.ModelBinding; using OrchardCore.Menu.Models; namespace OrchardCore.Menu.ViewModels diff --git a/src/OrchardCore.Modules/OrchardCore.Menu/ViewModels/MenuPartEditViewModel.cs b/src/OrchardCore.Modules/OrchardCore.Menu/ViewModels/MenuPartEditViewModel.cs index f0845b871d0..6e4bbd89d4e 100644 --- a/src/OrchardCore.Modules/OrchardCore.Menu/ViewModels/MenuPartEditViewModel.cs +++ b/src/OrchardCore.Modules/OrchardCore.Menu/ViewModels/MenuPartEditViewModel.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using Microsoft.AspNetCore.Mvc.ModelBinding; using OrchardCore.ContentManagement.Metadata.Models; using OrchardCore.Menu.Models; diff --git a/src/OrchardCore.Modules/OrchardCore.Microsoft.Authentication/AdminMenuMicrosoftAccount.cs b/src/OrchardCore.Modules/OrchardCore.Microsoft.Authentication/AdminMenuMicrosoftAccount.cs index 937a6c958d4..0a14773b492 100644 --- a/src/OrchardCore.Modules/OrchardCore.Microsoft.Authentication/AdminMenuMicrosoftAccount.cs +++ b/src/OrchardCore.Modules/OrchardCore.Microsoft.Authentication/AdminMenuMicrosoftAccount.cs @@ -18,7 +18,7 @@ public AdminMenuMicrosoftAccount(IStringLocalizer loc public Task BuildNavigationAsync(string name, NavigationBuilder builder) { - if (String.Equals(name, "admin", StringComparison.OrdinalIgnoreCase)) + if (string.Equals(name, "admin", StringComparison.OrdinalIgnoreCase)) { builder.Add(S["Security"], security => security .Add(S["Authentication"], authentication => authentication @@ -42,7 +42,7 @@ public class AdminMenuAAD : INavigationProvider public Task BuildNavigationAsync(string name, NavigationBuilder builder) { - if (String.Equals(name, "admin", StringComparison.OrdinalIgnoreCase)) + if (string.Equals(name, "admin", StringComparison.OrdinalIgnoreCase)) { builder.Add(S["Security"], security => security .Add(S["Authentication"], authentication => authentication diff --git a/src/OrchardCore.Modules/OrchardCore.Microsoft.Authentication/Configuration/AzureADOptionsConfiguration.cs b/src/OrchardCore.Modules/OrchardCore.Microsoft.Authentication/Configuration/AzureADOptionsConfiguration.cs index 207dd2d4721..5cfbc26a6c9 100644 --- a/src/OrchardCore.Modules/OrchardCore.Microsoft.Authentication/Configuration/AzureADOptionsConfiguration.cs +++ b/src/OrchardCore.Modules/OrchardCore.Microsoft.Authentication/Configuration/AzureADOptionsConfiguration.cs @@ -47,7 +47,7 @@ public void Configure(AuthenticationOptions options) public void Configure(string name, MicrosoftIdentityOptions options) { - if (!String.Equals(name, MicrosoftIdentityDefaults.AzureAd)) + if (!string.Equals(name, MicrosoftIdentityDefaults.AzureAd)) { return; } @@ -72,7 +72,7 @@ public void Configure(string name, MicrosoftIdentityOptions options) public void Configure(string name, PolicySchemeOptions options) { - if (!String.Equals(name, MicrosoftIdentityDefaults.AzureAd)) + if (!string.Equals(name, MicrosoftIdentityDefaults.AzureAd)) { return; } diff --git a/src/OrchardCore.Modules/OrchardCore.Microsoft.Authentication/Configuration/MicrosoftAccountOptionsConfiguration.cs b/src/OrchardCore.Modules/OrchardCore.Microsoft.Authentication/Configuration/MicrosoftAccountOptionsConfiguration.cs index efc9dfc7d2e..6bdd9ccedf5 100644 --- a/src/OrchardCore.Modules/OrchardCore.Microsoft.Authentication/Configuration/MicrosoftAccountOptionsConfiguration.cs +++ b/src/OrchardCore.Modules/OrchardCore.Microsoft.Authentication/Configuration/MicrosoftAccountOptionsConfiguration.cs @@ -45,7 +45,7 @@ public void Configure(AuthenticationOptions options) public void Configure(string name, MicrosoftAccountOptions options) { // Ignore OpenID Connect client handler instances that don't correspond to the instance managed by the OpenID module. - if (!String.Equals(name, MicrosoftAccountDefaults.AuthenticationScheme)) + if (!string.Equals(name, MicrosoftAccountDefaults.AuthenticationScheme)) { return; } diff --git a/src/OrchardCore.Modules/OrchardCore.Microsoft.Authentication/Configuration/OpenIdConnectOptionsConfiguration.cs b/src/OrchardCore.Modules/OrchardCore.Microsoft.Authentication/Configuration/OpenIdConnectOptionsConfiguration.cs index f5b8ebfdf6f..0d523f8fac9 100644 --- a/src/OrchardCore.Modules/OrchardCore.Microsoft.Authentication/Configuration/OpenIdConnectOptionsConfiguration.cs +++ b/src/OrchardCore.Modules/OrchardCore.Microsoft.Authentication/Configuration/OpenIdConnectOptionsConfiguration.cs @@ -3,9 +3,8 @@ using Microsoft.AspNetCore.Authentication.OpenIdConnect; using Microsoft.Extensions.Options; using Microsoft.Identity.Web; -using OrchardCore.Microsoft.Authentication.Services; -using MicrosoftIdentityDefaults = Microsoft.Identity.Web.Constants; using OrchardCore.Microsoft.Authentication.Settings; +using MicrosoftIdentityDefaults = Microsoft.Identity.Web.Constants; namespace OrchardCore.Microsoft.Authentication.Configuration { diff --git a/src/OrchardCore.Modules/OrchardCore.Microsoft.Authentication/Recipes/AzureADSettingsStep.cs b/src/OrchardCore.Modules/OrchardCore.Microsoft.Authentication/Recipes/AzureADSettingsStep.cs index 6a84a5ef0a0..db775ba1fe3 100644 --- a/src/OrchardCore.Modules/OrchardCore.Microsoft.Authentication/Recipes/AzureADSettingsStep.cs +++ b/src/OrchardCore.Modules/OrchardCore.Microsoft.Authentication/Recipes/AzureADSettingsStep.cs @@ -21,7 +21,7 @@ public AzureADSettingsStep(IAzureADService azureADService) public async Task ExecuteAsync(RecipeExecutionContext context) { - if (!String.Equals(context.Name, nameof(AzureADSettings), StringComparison.OrdinalIgnoreCase)) + if (!string.Equals(context.Name, nameof(AzureADSettings), StringComparison.OrdinalIgnoreCase)) { return; } diff --git a/src/OrchardCore.Modules/OrchardCore.Microsoft.Authentication/Recipes/MicrosoftAccountSettingsStep.cs b/src/OrchardCore.Modules/OrchardCore.Microsoft.Authentication/Recipes/MicrosoftAccountSettingsStep.cs index 6c91249157a..afccf61b1d2 100644 --- a/src/OrchardCore.Modules/OrchardCore.Microsoft.Authentication/Recipes/MicrosoftAccountSettingsStep.cs +++ b/src/OrchardCore.Modules/OrchardCore.Microsoft.Authentication/Recipes/MicrosoftAccountSettingsStep.cs @@ -21,7 +21,7 @@ public MicrosoftAccountSettingsStep(IMicrosoftAccountService microsoftAccountSer public async Task ExecuteAsync(RecipeExecutionContext context) { - if (!String.Equals(context.Name, nameof(MicrosoftAccountSettings), StringComparison.OrdinalIgnoreCase)) + if (!string.Equals(context.Name, nameof(MicrosoftAccountSettings), StringComparison.OrdinalIgnoreCase)) { return; } diff --git a/src/OrchardCore.Modules/OrchardCore.Microsoft.Authentication/Services/AzureADService.cs b/src/OrchardCore.Modules/OrchardCore.Microsoft.Authentication/Services/AzureADService.cs index 57fff995a85..e9cbee95a80 100644 --- a/src/OrchardCore.Modules/OrchardCore.Microsoft.Authentication/Services/AzureADService.cs +++ b/src/OrchardCore.Modules/OrchardCore.Microsoft.Authentication/Services/AzureADService.cs @@ -60,17 +60,17 @@ public IEnumerable ValidateSettings(AzureADSettings settings) throw new ArgumentNullException(nameof(settings)); } - if (String.IsNullOrWhiteSpace(settings.DisplayName)) + if (string.IsNullOrWhiteSpace(settings.DisplayName)) { yield return new ValidationResult(S["DisplayName is required"], new string[] { nameof(settings.DisplayName) }); } - if (String.IsNullOrWhiteSpace(settings.AppId)) + if (string.IsNullOrWhiteSpace(settings.AppId)) { yield return new ValidationResult(S["AppId is required"], new string[] { nameof(settings.AppId) }); } - if (String.IsNullOrWhiteSpace(settings.TenantId)) + if (string.IsNullOrWhiteSpace(settings.TenantId)) { yield return new ValidationResult(S["TenantId is required"], new string[] { nameof(settings.TenantId) }); } diff --git a/src/OrchardCore.Modules/OrchardCore.Microsoft.Authentication/Services/MicrosoftAccountService.cs b/src/OrchardCore.Modules/OrchardCore.Microsoft.Authentication/Services/MicrosoftAccountService.cs index f65ec293fba..41355b6e300 100644 --- a/src/OrchardCore.Modules/OrchardCore.Microsoft.Authentication/Services/MicrosoftAccountService.cs +++ b/src/OrchardCore.Modules/OrchardCore.Microsoft.Authentication/Services/MicrosoftAccountService.cs @@ -59,12 +59,12 @@ public IEnumerable ValidateSettings(MicrosoftAccountSettings s throw new ArgumentNullException(nameof(settings)); } - if (String.IsNullOrWhiteSpace(settings.AppId)) + if (string.IsNullOrWhiteSpace(settings.AppId)) { yield return new ValidationResult(S["AppId is required"], new string[] { nameof(settings.AppId) }); } - if (String.IsNullOrWhiteSpace(settings.AppSecret)) + if (string.IsNullOrWhiteSpace(settings.AppSecret)) { yield return new ValidationResult(S["AppSecret is required"], new string[] { nameof(settings.AppSecret) }); } diff --git a/src/OrchardCore.Modules/OrchardCore.Mvc.HelloWorld/Controllers/HomeController.cs b/src/OrchardCore.Modules/OrchardCore.Mvc.HelloWorld/Controllers/HomeController.cs index 43c283caead..dcd0e39e8e6 100644 --- a/src/OrchardCore.Modules/OrchardCore.Mvc.HelloWorld/Controllers/HomeController.cs +++ b/src/OrchardCore.Modules/OrchardCore.Mvc.HelloWorld/Controllers/HomeController.cs @@ -1,4 +1,4 @@ -using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc; namespace HelloWorld.Controllers { diff --git a/src/OrchardCore.Modules/OrchardCore.Navigation/PagerShapesTableProvider.cs b/src/OrchardCore.Modules/OrchardCore.Navigation/PagerShapesTableProvider.cs index f87dbd5fddb..6fe7acaf330 100644 --- a/src/OrchardCore.Modules/OrchardCore.Navigation/PagerShapesTableProvider.cs +++ b/src/OrchardCore.Modules/OrchardCore.Navigation/PagerShapesTableProvider.cs @@ -31,7 +31,7 @@ public void Discover(ShapeTableBuilder builder) }) .OnDisplaying(displaying => { - if (displaying.Shape.TryGetProperty("PagerId", out string pagerId) && !String.IsNullOrEmpty(pagerId)) + if (displaying.Shape.TryGetProperty("PagerId", out string pagerId) && !string.IsNullOrEmpty(pagerId)) { displaying.Shape.Metadata.Alternates.Add("Pager__" + pagerId.EncodeAlternateElement()); }; @@ -47,7 +47,7 @@ public void Discover(ShapeTableBuilder builder) }) .OnDisplaying(displaying => { - if (displaying.Shape.TryGetProperty("PagerId", out string pagerId) && !String.IsNullOrEmpty(pagerId)) + if (displaying.Shape.TryGetProperty("PagerId", out string pagerId) && !string.IsNullOrEmpty(pagerId)) { displaying.Shape.Metadata.Alternates.Add("Pager__" + pagerId.EncodeAlternateElement()); }; @@ -58,7 +58,7 @@ public void Discover(ShapeTableBuilder builder) { var shape = displaying.Shape; - if (shape.TryGetProperty("Pager", out IShape pager) && pager.TryGetProperty("PagerId", out string pagerId) && !String.IsNullOrEmpty(pagerId)) + if (shape.TryGetProperty("Pager", out IShape pager) && pager.TryGetProperty("PagerId", out string pagerId) && !string.IsNullOrEmpty(pagerId)) { displaying.Shape.Metadata.Alternates.Add("Pager_Gap__" + pagerId.EncodeAlternateElement()); } @@ -69,7 +69,7 @@ public void Discover(ShapeTableBuilder builder) { var shape = displaying.Shape; - if (shape.TryGetProperty("Pager", out IShape pager) && pager.TryGetProperty("PagerId", out string pagerId) && !String.IsNullOrEmpty(pagerId)) + if (shape.TryGetProperty("Pager", out IShape pager) && pager.TryGetProperty("PagerId", out string pagerId) && !string.IsNullOrEmpty(pagerId)) { displaying.Shape.Metadata.Alternates.Add("Pager_First__" + pagerId.EncodeAlternateElement()); } @@ -80,7 +80,7 @@ public void Discover(ShapeTableBuilder builder) { var shape = displaying.Shape; - if (shape.TryGetProperty("Pager", out IShape pager) && pager.TryGetProperty("PagerId", out string pagerId) && !String.IsNullOrEmpty(pagerId)) + if (shape.TryGetProperty("Pager", out IShape pager) && pager.TryGetProperty("PagerId", out string pagerId) && !string.IsNullOrEmpty(pagerId)) { displaying.Shape.Metadata.Alternates.Add("Pager_Previous__" + pagerId.EncodeAlternateElement()); } @@ -91,7 +91,7 @@ public void Discover(ShapeTableBuilder builder) { var shape = displaying.Shape; - if (shape.TryGetProperty("Pager", out IShape pager) && pager.TryGetProperty("PagerId", out string pagerId) && !String.IsNullOrEmpty(pagerId)) + if (shape.TryGetProperty("Pager", out IShape pager) && pager.TryGetProperty("PagerId", out string pagerId) && !string.IsNullOrEmpty(pagerId)) { displaying.Shape.Metadata.Alternates.Add("Pager_Next__" + pagerId.EncodeAlternateElement()); } @@ -102,7 +102,7 @@ public void Discover(ShapeTableBuilder builder) { var shape = displaying.Shape; - if (shape.TryGetProperty("Pager", out IShape pager) && pager.TryGetProperty("PagerId", out string pagerId) && !String.IsNullOrEmpty(pagerId)) + if (shape.TryGetProperty("Pager", out IShape pager) && pager.TryGetProperty("PagerId", out string pagerId) && !string.IsNullOrEmpty(pagerId)) { displaying.Shape.Metadata.Alternates.Add("Pager_Last__" + pagerId.EncodeAlternateElement()); } @@ -113,7 +113,7 @@ public void Discover(ShapeTableBuilder builder) { var shape = displaying.Shape; - if (shape.TryGetProperty("Pager", out IShape pager) && pager.TryGetProperty("PagerId", out string pagerId) && !String.IsNullOrEmpty(pagerId)) + if (shape.TryGetProperty("Pager", out IShape pager) && pager.TryGetProperty("PagerId", out string pagerId) && !string.IsNullOrEmpty(pagerId)) { displaying.Shape.Metadata.Alternates.Add("Pager_CurrentPage__" + pagerId.EncodeAlternateElement()); } @@ -186,7 +186,7 @@ public async Task Pager_Links(Shape shape, DisplayContext displayC var firstPage = Math.Max(1, Page - (numberOfPagesToShow / 2)); var lastPage = Math.Min(totalPageCount, Page + (numberOfPagesToShow / 2)); - var pageKey = String.IsNullOrEmpty(PagerId) ? "pagenum" : PagerId; + var pageKey = string.IsNullOrEmpty(PagerId) ? "pagenum" : PagerId; shape.Classes.Add("pager"); shape.Metadata.Alternates.Clear(); diff --git a/src/OrchardCore.Modules/OrchardCore.Navigation/Properties/AssemblyInfo.cs b/src/OrchardCore.Modules/OrchardCore.Navigation/Properties/AssemblyInfo.cs index 47bf6c56f85..43b42cc60ee 100644 --- a/src/OrchardCore.Modules/OrchardCore.Navigation/Properties/AssemblyInfo.cs +++ b/src/OrchardCore.Modules/OrchardCore.Navigation/Properties/AssemblyInfo.cs @@ -1,4 +1,4 @@ -using System.Reflection; +using System.Reflection; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following diff --git a/src/OrchardCore.Modules/OrchardCore.Notifications/Activities/NotifyContentOwnerTask.cs b/src/OrchardCore.Modules/OrchardCore.Notifications/Activities/NotifyContentOwnerTask.cs index 5f0ca652611..b8a11dac220 100644 --- a/src/OrchardCore.Modules/OrchardCore.Notifications/Activities/NotifyContentOwnerTask.cs +++ b/src/OrchardCore.Modules/OrchardCore.Notifications/Activities/NotifyContentOwnerTask.cs @@ -43,7 +43,7 @@ protected override async Task> GetUsersAsync(WorkflowExecutio { if (workflowContext.Input.TryGetValue("ContentItem", out var obj) && obj is ContentItem contentItem - && !String.IsNullOrEmpty(contentItem.Owner)) + && !string.IsNullOrEmpty(contentItem.Owner)) { if (workflowContext.Input.TryGetValue("Owner", out var ownerObject) && ownerObject is User user && user.IsEnabled) { diff --git a/src/OrchardCore.Modules/OrchardCore.Notifications/Controllers/AdminController.cs b/src/OrchardCore.Modules/OrchardCore.Notifications/Controllers/AdminController.cs index 03e64aa20b1..989250e22c0 100644 --- a/src/OrchardCore.Modules/OrchardCore.Notifications/Controllers/AdminController.cs +++ b/src/OrchardCore.Modules/OrchardCore.Notifications/Controllers/AdminController.cs @@ -129,7 +129,7 @@ public async Task List( options.NotficationsItemsCount = notificationSummaries.Count; options.TotalItemCount = pagerShape.TotalItemCount; - var header = await _notificationOptionsDisplayManager.BuildEditorAsync(options, this, false, String.Empty, String.Empty); + var header = await _notificationOptionsDisplayManager.BuildEditorAsync(options, this, false, string.Empty, string.Empty); var shapeViewModel = await _shapeFactory.CreateAsync("NotificationsAdminList", viewModel => { @@ -147,13 +147,13 @@ public async Task List( public async Task ListFilterPOST(ListNotificationOptions options) { // When the user has typed something into the search input, no further evaluation of the form post is required. - if (!String.Equals(options.SearchText, options.OriginalSearchText, StringComparison.OrdinalIgnoreCase)) + if (!string.Equals(options.SearchText, options.OriginalSearchText, StringComparison.OrdinalIgnoreCase)) { return RedirectToAction(nameof(List), new RouteValueDictionary { { "q", options.SearchText } }); } // Evaluate the values provided in the form post and map them to the filter result and route values. - await _notificationOptionsDisplayManager.UpdateEditorAsync(options, this, false, String.Empty, String.Empty); + await _notificationOptionsDisplayManager.UpdateEditorAsync(options, this, false, string.Empty, string.Empty); // The route value must always be added after the editors have updated the models. options.RouteValues.TryAdd("q", options.FilterResult.ToString()); @@ -271,7 +271,7 @@ public async Task Toggle(string notificationId, bool markAsRead, return Forbid(); } - if (!String.IsNullOrWhiteSpace(notificationId)) + if (!string.IsNullOrWhiteSpace(notificationId)) { var notification = await _session.Query(x => x.UserId == CurrentUserId() && x.NotificationId == notificationId && x.IsRead != markAsRead, collection: NotificationConstants.NotificationCollection).FirstOrDefaultAsync(); @@ -306,7 +306,7 @@ public async Task Delete(string notificationId, string returnUrl) return Forbid(); } - if (!String.IsNullOrWhiteSpace(notificationId)) + if (!string.IsNullOrWhiteSpace(notificationId)) { var notification = await _session.Query(x => x.UserId == CurrentUserId() && x.NotificationId == notificationId, collection: NotificationConstants.NotificationCollection).FirstOrDefaultAsync(); @@ -321,7 +321,7 @@ public async Task Delete(string notificationId, string returnUrl) private IActionResult RedirectTo(string returnUrl) { - return !String.IsNullOrEmpty(returnUrl) && Url.IsLocalUrl(returnUrl) ? (IActionResult)this.LocalRedirect(returnUrl, true) : RedirectToAction(nameof(List)); + return !string.IsNullOrEmpty(returnUrl) && Url.IsLocalUrl(returnUrl) ? (IActionResult)this.LocalRedirect(returnUrl, true) : RedirectToAction(nameof(List)); } private string CurrentUserId() diff --git a/src/OrchardCore.Modules/OrchardCore.Notifications/ViewModels/UserNotificationMessageViewModel.cs b/src/OrchardCore.Modules/OrchardCore.Notifications/ViewModels/UserNotificationMessageViewModel.cs index 95381199713..9b5f31f21fe 100644 --- a/src/OrchardCore.Modules/OrchardCore.Notifications/ViewModels/UserNotificationMessageViewModel.cs +++ b/src/OrchardCore.Modules/OrchardCore.Notifications/ViewModels/UserNotificationMessageViewModel.cs @@ -19,5 +19,5 @@ public class UserNotificationMessageViewModel public string Url { get; set; } - public bool HasBody() => !String.IsNullOrWhiteSpace(Body); + public bool HasBody() => !string.IsNullOrWhiteSpace(Body); } diff --git a/src/OrchardCore.Modules/OrchardCore.OpenId/AdminMenu.cs b/src/OrchardCore.Modules/OrchardCore.OpenId/AdminMenu.cs index 26e8d5508a5..631b98b6abf 100644 --- a/src/OrchardCore.Modules/OrchardCore.OpenId/AdminMenu.cs +++ b/src/OrchardCore.Modules/OrchardCore.OpenId/AdminMenu.cs @@ -23,7 +23,7 @@ public AdminMenu( public Task BuildNavigationAsync(string name, NavigationBuilder builder) { - if (!String.Equals(name, "admin", StringComparison.OrdinalIgnoreCase)) + if (!string.Equals(name, "admin", StringComparison.OrdinalIgnoreCase)) { return Task.CompletedTask; } diff --git a/src/OrchardCore.Modules/OrchardCore.OpenId/Configuration/OpenIdClientConfiguration.cs b/src/OrchardCore.Modules/OrchardCore.OpenId/Configuration/OpenIdClientConfiguration.cs index 99295f5e27f..396b1a3172b 100644 --- a/src/OrchardCore.Modules/OrchardCore.OpenId/Configuration/OpenIdClientConfiguration.cs +++ b/src/OrchardCore.Modules/OrchardCore.OpenId/Configuration/OpenIdClientConfiguration.cs @@ -52,7 +52,7 @@ public void Configure(AuthenticationOptions options) public void Configure(string name, OpenIdConnectOptions options) { // Ignore OpenID Connect client handler instances that don't correspond to the instance managed by the OpenID module. - if (!String.Equals(name, OpenIdConnectDefaults.AuthenticationScheme)) + if (!string.Equals(name, OpenIdConnectDefaults.AuthenticationScheme)) { return; } @@ -67,7 +67,7 @@ public void Configure(string name, OpenIdConnectOptions options) options.ClientId = settings.ClientId; options.SignedOutRedirectUri = settings.SignedOutRedirectUri ?? options.SignedOutRedirectUri; options.SignedOutCallbackPath = settings.SignedOutCallbackPath ?? options.SignedOutCallbackPath; - options.RequireHttpsMetadata = String.Equals(settings.Authority.Scheme, Uri.UriSchemeHttps, StringComparison.OrdinalIgnoreCase); + options.RequireHttpsMetadata = string.Equals(settings.Authority.Scheme, Uri.UriSchemeHttps, StringComparison.OrdinalIgnoreCase); options.GetClaimsFromUserInfoEndpoint = true; options.ResponseMode = settings.ResponseMode; options.ResponseType = settings.ResponseType; @@ -83,7 +83,7 @@ public void Configure(string name, OpenIdConnectOptions options) } } - if (!String.IsNullOrEmpty(settings.ClientSecret)) + if (!string.IsNullOrEmpty(settings.ClientSecret)) { var protector = _dataProtectionProvider.CreateProtector(nameof(OpenIdClientConfiguration)); diff --git a/src/OrchardCore.Modules/OrchardCore.OpenId/Configuration/OpenIdValidationConfiguration.cs b/src/OrchardCore.Modules/OrchardCore.OpenId/Configuration/OpenIdValidationConfiguration.cs index f816c483647..731c2093e13 100644 --- a/src/OrchardCore.Modules/OrchardCore.OpenId/Configuration/OpenIdValidationConfiguration.cs +++ b/src/OrchardCore.Modules/OrchardCore.OpenId/Configuration/OpenIdValidationConfiguration.cs @@ -180,7 +180,7 @@ public void Configure(OpenIddictValidationOptions options) } var tenant = _runningShellTable.Match(HostString.FromUriComponent(uri), uri.AbsolutePath); - if (tenant == null || !String.Equals(tenant.Name, settings.Tenant)) + if (tenant == null || !string.Equals(tenant.Name, settings.Tenant)) { throw new SecurityTokenInvalidIssuerException("The token issuer is not valid."); } @@ -201,8 +201,8 @@ public void Configure(OpenIddictValidationDataProtectionOptions options) // If the tokens are issued by an authorization server located in a separate tenant, // resolve the isolated data protection provider associated with the specified tenant. - if (!String.IsNullOrEmpty(settings.Tenant) && - !String.Equals(settings.Tenant, _shellSettings.Name)) + if (!string.IsNullOrEmpty(settings.Tenant) && + !string.Equals(settings.Tenant, _shellSettings.Name)) { CreateTenantScope(settings.Tenant).UsingAsync(async scope => { @@ -235,7 +235,7 @@ public void Configure(ApiAuthorizationOptions options) private ShellScope CreateTenantScope(string tenant) { // Optimization: if the specified name corresponds to the current tenant, use the current 'ShellScope'. - if (String.IsNullOrEmpty(tenant) || String.Equals(tenant, _shellSettings.Name)) + if (string.IsNullOrEmpty(tenant) || string.Equals(tenant, _shellSettings.Name)) { return ShellScope.Current; } diff --git a/src/OrchardCore.Modules/OrchardCore.OpenId/Controllers/ApplicationController.cs b/src/OrchardCore.Modules/OrchardCore.OpenId/Controllers/ApplicationController.cs index f04a7743834..b3dbec6f075 100644 --- a/src/OrchardCore.Modules/OrchardCore.OpenId/Controllers/ApplicationController.cs +++ b/src/OrchardCore.Modules/OrchardCore.OpenId/Controllers/ApplicationController.cs @@ -132,18 +132,18 @@ public async Task Create(CreateOpenIdApplicationViewModel model, return Forbid(); } - if (!String.IsNullOrEmpty(model.ClientSecret) && - String.Equals(model.Type, OpenIddictConstants.ClientTypes.Public, StringComparison.OrdinalIgnoreCase)) + if (!string.IsNullOrEmpty(model.ClientSecret) && + string.Equals(model.Type, OpenIddictConstants.ClientTypes.Public, StringComparison.OrdinalIgnoreCase)) { ModelState.AddModelError(nameof(model.ClientSecret), S["No client secret can be set for public applications."]); } - else if (String.IsNullOrEmpty(model.ClientSecret) && - String.Equals(model.Type, OpenIddictConstants.ClientTypes.Confidential, StringComparison.OrdinalIgnoreCase)) + else if (string.IsNullOrEmpty(model.ClientSecret) && + string.Equals(model.Type, OpenIddictConstants.ClientTypes.Confidential, StringComparison.OrdinalIgnoreCase)) { ModelState.AddModelError(nameof(model.ClientSecret), S["The client secret is required for confidential applications."]); } - if (!String.IsNullOrEmpty(model.ClientId) && await _applicationManager.FindByClientIdAsync(model.ClientId) != null) + if (!string.IsNullOrEmpty(model.ClientId) && await _applicationManager.FindByClientIdAsync(model.ClientId) != null) { ModelState.AddModelError(nameof(model.ClientId), S["The client identifier is already taken by another application."]); } @@ -180,7 +180,7 @@ public async Task Create(CreateOpenIdApplicationViewModel model, await _applicationManager.UpdateDescriptorFromSettings(settings); - if (String.IsNullOrEmpty(returnUrl)) + if (string.IsNullOrEmpty(returnUrl)) { return RedirectToAction(nameof(Index)); } @@ -234,8 +234,8 @@ await HasPermissionAsync(OpenIddictConstants.Permissions.ResponseTypes.Token)), ConsentType = await _applicationManager.GetConsentTypeAsync(application), DisplayName = await _applicationManager.GetDisplayNameAsync(application), Id = await _applicationManager.GetPhysicalIdAsync(application), - PostLogoutRedirectUris = String.Join(" ", await _applicationManager.GetPostLogoutRedirectUrisAsync(application)), - RedirectUris = String.Join(" ", await _applicationManager.GetRedirectUrisAsync(application)), + PostLogoutRedirectUris = string.Join(" ", await _applicationManager.GetPostLogoutRedirectUrisAsync(application)), + RedirectUris = string.Join(" ", await _applicationManager.GetRedirectUrisAsync(application)), Type = await _applicationManager.GetClientTypeAsync(application), RequireProofKeyForCodeExchange = await HasRequirementAsync(OpenIddictConstants.Requirements.Features.ProofKeyForCodeExchange) }; @@ -290,15 +290,15 @@ public async Task Edit(EditOpenIdApplicationViewModel model, stri } // If the application was a public client and is now a confidential client, ensure a client secret was provided. - if (String.IsNullOrEmpty(model.ClientSecret) && - !String.Equals(model.Type, OpenIddictConstants.ClientTypes.Public, StringComparison.OrdinalIgnoreCase) && + if (string.IsNullOrEmpty(model.ClientSecret) && + !string.Equals(model.Type, OpenIddictConstants.ClientTypes.Public, StringComparison.OrdinalIgnoreCase) && await _applicationManager.HasClientTypeAsync(application, OpenIddictConstants.ClientTypes.Public)) { ModelState.AddModelError(nameof(model.ClientSecret), S["Setting a new client secret is required."]); } - if (!String.IsNullOrEmpty(model.ClientSecret) && - String.Equals(model.Type, OpenIddictConstants.ClientTypes.Public, StringComparison.OrdinalIgnoreCase)) + if (!string.IsNullOrEmpty(model.ClientSecret) && + string.Equals(model.Type, OpenIddictConstants.ClientTypes.Public, StringComparison.OrdinalIgnoreCase)) { ModelState.AddModelError(nameof(model.ClientSecret), S["No client secret can be set for public applications."]); } @@ -306,7 +306,7 @@ await _applicationManager.HasClientTypeAsync(application, OpenIddictConstants.Cl if (ModelState.IsValid) { var other = await _applicationManager.FindByClientIdAsync(model.ClientId); - if (other != null && !String.Equals( + if (other != null && !string.Equals( await _applicationManager.GetIdAsync(other), await _applicationManager.GetIdAsync(application), StringComparison.Ordinal)) { @@ -346,7 +346,7 @@ await _applicationManager.GetIdAsync(application), StringComparison.Ordinal)) await _applicationManager.UpdateDescriptorFromSettings(settings, application); - if (String.IsNullOrEmpty(returnUrl)) + if (string.IsNullOrEmpty(returnUrl)) { return RedirectToAction(nameof(Index)); } diff --git a/src/OrchardCore.Modules/OrchardCore.OpenId/Controllers/ScopeController.cs b/src/OrchardCore.Modules/OrchardCore.OpenId/Controllers/ScopeController.cs index d8b9b9f8b2c..1129c715978 100644 --- a/src/OrchardCore.Modules/OrchardCore.OpenId/Controllers/ScopeController.cs +++ b/src/OrchardCore.Modules/OrchardCore.OpenId/Controllers/ScopeController.cs @@ -96,7 +96,7 @@ public async Task Create(string returnUrl = null) { model.Tenants.Add(new CreateOpenIdScopeViewModel.TenantEntry { - Current = String.Equals(tenant.Name, _shellSettings.Name), + Current = string.Equals(tenant.Name, _shellSettings.Name), Name = tenant.Name }); } @@ -131,19 +131,19 @@ public async Task Create(CreateOpenIdScopeViewModel model, string Name = model.Name }; - if (!String.IsNullOrEmpty(model.Resources)) + if (!string.IsNullOrEmpty(model.Resources)) { descriptor.Resources.UnionWith(model.Resources.Split(' ', StringSplitOptions.RemoveEmptyEntries)); } descriptor.Resources.UnionWith(model.Tenants .Where(tenant => tenant.Selected) - .Where(tenant => !String.Equals(tenant.Name, _shellSettings.Name)) + .Where(tenant => !string.Equals(tenant.Name, _shellSettings.Name)) .Select(tenant => OpenIdConstants.Prefixes.Tenant + tenant.Name)); await _scopeManager.CreateAsync(descriptor); - if (String.IsNullOrEmpty(returnUrl)) + if (string.IsNullOrEmpty(returnUrl)) { return RedirectToAction("Index"); } @@ -174,16 +174,16 @@ public async Task Edit(string id, string returnUrl = null) var resources = await _scopeManager.GetResourcesAsync(scope); - model.Resources = String.Join(" ", + model.Resources = string.Join(" ", from resource in resources - where !String.IsNullOrEmpty(resource) && !resource.StartsWith(OpenIdConstants.Prefixes.Tenant, StringComparison.Ordinal) + where !string.IsNullOrEmpty(resource) && !resource.StartsWith(OpenIdConstants.Prefixes.Tenant, StringComparison.Ordinal) select resource); foreach (var tenant in _shellHost.GetAllSettings().Where(s => s.IsRunning())) { model.Tenants.Add(new EditOpenIdScopeViewModel.TenantEntry { - Current = String.Equals(tenant.Name, _shellSettings.Name), + Current = string.Equals(tenant.Name, _shellSettings.Name), Name = tenant.Name, Selected = resources.Contains(OpenIdConstants.Prefixes.Tenant + tenant.Name) }); @@ -210,7 +210,7 @@ public async Task Edit(EditOpenIdScopeViewModel model, string ret if (ModelState.IsValid) { var other = await _scopeManager.FindByNameAsync(model.Name); - if (other != null && !String.Equals( + if (other != null && !string.Equals( await _scopeManager.GetIdAsync(other), await _scopeManager.GetIdAsync(scope))) { @@ -233,19 +233,19 @@ await _scopeManager.GetIdAsync(scope))) descriptor.Resources.Clear(); - if (!String.IsNullOrEmpty(model.Resources)) + if (!string.IsNullOrEmpty(model.Resources)) { descriptor.Resources.UnionWith(model.Resources.Split(' ', StringSplitOptions.RemoveEmptyEntries)); } descriptor.Resources.UnionWith(model.Tenants .Where(tenant => tenant.Selected) - .Where(tenant => !String.Equals(tenant.Name, _shellSettings.Name)) + .Where(tenant => !string.Equals(tenant.Name, _shellSettings.Name)) .Select(tenant => OpenIdConstants.Prefixes.Tenant + tenant.Name)); await _scopeManager.UpdateAsync(scope, descriptor); - if (String.IsNullOrEmpty(returnUrl)) + if (string.IsNullOrEmpty(returnUrl)) { return RedirectToAction("Index"); } diff --git a/src/OrchardCore.Modules/OrchardCore.OpenId/Controllers/ServerConfigurationController.cs b/src/OrchardCore.Modules/OrchardCore.OpenId/Controllers/ServerConfigurationController.cs index 14614515b68..956ea349eac 100644 --- a/src/OrchardCore.Modules/OrchardCore.OpenId/Controllers/ServerConfigurationController.cs +++ b/src/OrchardCore.Modules/OrchardCore.OpenId/Controllers/ServerConfigurationController.cs @@ -82,7 +82,7 @@ public async Task IndexPost() { if (result != ValidationResult.Success) { - var key = result.MemberNames.FirstOrDefault() ?? String.Empty; + var key = result.MemberNames.FirstOrDefault() ?? string.Empty; ModelState.AddModelError(key, result.ErrorMessage); } } diff --git a/src/OrchardCore.Modules/OrchardCore.OpenId/Controllers/ValidationConfigurationController.cs b/src/OrchardCore.Modules/OrchardCore.OpenId/Controllers/ValidationConfigurationController.cs index 2a12a76761c..c73b32a4bf6 100644 --- a/src/OrchardCore.Modules/OrchardCore.OpenId/Controllers/ValidationConfigurationController.cs +++ b/src/OrchardCore.Modules/OrchardCore.OpenId/Controllers/ValidationConfigurationController.cs @@ -82,7 +82,7 @@ public async Task IndexPost() { if (result != ValidationResult.Success) { - var key = result.MemberNames.FirstOrDefault() ?? String.Empty; + var key = result.MemberNames.FirstOrDefault() ?? string.Empty; ModelState.AddModelError(key, result.ErrorMessage); } } diff --git a/src/OrchardCore.Modules/OrchardCore.OpenId/Deployment/OpenIdServerDeploymentSource.cs b/src/OrchardCore.Modules/OrchardCore.OpenId/Deployment/OpenIdServerDeploymentSource.cs index 80456ab962f..6d16be63598 100644 --- a/src/OrchardCore.Modules/OrchardCore.OpenId/Deployment/OpenIdServerDeploymentSource.cs +++ b/src/OrchardCore.Modules/OrchardCore.OpenId/Deployment/OpenIdServerDeploymentSource.cs @@ -44,12 +44,12 @@ public async Task ProcessDeploymentStepAsync(DeploymentStep step, DeploymentPlan // The recipe step only reads these flags, and uses constants for the paths. // Conversely, we export true for endpoints with a path, false for those without. - EnableAuthorizationEndpoint = !String.IsNullOrWhiteSpace(settings.AuthorizationEndpointPath), - EnableLogoutEndpoint = !String.IsNullOrWhiteSpace(settings.LogoutEndpointPath), - EnableTokenEndpoint = !String.IsNullOrWhiteSpace(settings.TokenEndpointPath), - EnableUserInfoEndpoint = !String.IsNullOrWhiteSpace(settings.UserinfoEndpointPath), - EnableIntrospectionEndpoint = !String.IsNullOrWhiteSpace(settings.IntrospectionEndpointPath), - EnableRevocationEndpoint = !String.IsNullOrWhiteSpace(settings.RevocationEndpointPath), + EnableAuthorizationEndpoint = !string.IsNullOrWhiteSpace(settings.AuthorizationEndpointPath), + EnableLogoutEndpoint = !string.IsNullOrWhiteSpace(settings.LogoutEndpointPath), + EnableTokenEndpoint = !string.IsNullOrWhiteSpace(settings.TokenEndpointPath), + EnableUserInfoEndpoint = !string.IsNullOrWhiteSpace(settings.UserinfoEndpointPath), + EnableIntrospectionEndpoint = !string.IsNullOrWhiteSpace(settings.IntrospectionEndpointPath), + EnableRevocationEndpoint = !string.IsNullOrWhiteSpace(settings.RevocationEndpointPath), AllowAuthorizationCodeFlow = settings.AllowAuthorizationCodeFlow, AllowClientCredentialsFlow = settings.AllowClientCredentialsFlow, diff --git a/src/OrchardCore.Modules/OrchardCore.OpenId/Drivers/OpenIdClientSettingsDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.OpenId/Drivers/OpenIdClientSettingsDisplayDriver.cs index edadfa7e954..b35713e0bde 100644 --- a/src/OrchardCore.Modules/OrchardCore.OpenId/Drivers/OpenIdClientSettingsDisplayDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.OpenId/Drivers/OpenIdClientSettingsDisplayDriver.cs @@ -66,7 +66,7 @@ public override async Task EditAsync(OpenIdClientSettings settin return Initialize("OpenIdClientSettings_Edit", model => { model.DisplayName = settings.DisplayName; - model.Scopes = settings.Scopes != null ? String.Join(" ", settings.Scopes) : null; + model.Scopes = settings.Scopes != null ? string.Join(" ", settings.Scopes) : null; model.Authority = settings.Authority?.AbsoluteUri; model.CallbackPath = settings.CallbackPath; model.ClientId = settings.ClientId; @@ -119,11 +119,11 @@ public override async Task UpdateAsync(OpenIdClientSettings sett var model = new OpenIdClientSettingsViewModel(); await context.Updater.TryUpdateModelAsync(model, Prefix); - model.Scopes ??= String.Empty; + model.Scopes ??= string.Empty; settings.DisplayName = model.DisplayName; settings.Scopes = model.Scopes.Split(new char[] { ' ', ',' }, StringSplitOptions.RemoveEmptyEntries); - settings.Authority = !String.IsNullOrEmpty(model.Authority) ? new Uri(model.Authority, UriKind.Absolute) : null; + settings.Authority = !string.IsNullOrEmpty(model.Authority) ? new Uri(model.Authority, UriKind.Absolute) : null; settings.CallbackPath = model.CallbackPath; settings.ClientId = model.ClientId; settings.SignedOutCallbackPath = model.SignedOutCallbackPath; @@ -167,7 +167,7 @@ public override async Task UpdateAsync(OpenIdClientSettings sett try { - settings.Parameters = String.IsNullOrWhiteSpace(model.Parameters) + settings.Parameters = string.IsNullOrWhiteSpace(model.Parameters) ? Array.Empty() : JsonConvert.DeserializeObject(model.Parameters); } @@ -182,7 +182,7 @@ public override async Task UpdateAsync(OpenIdClientSettings sett } // Restore the client secret if the input is empty (i.e if it hasn't been reset). - if (String.IsNullOrEmpty(model.ClientSecret)) + if (string.IsNullOrEmpty(model.ClientSecret)) { settings.ClientSecret = previousClientSecret; } @@ -196,7 +196,7 @@ public override async Task UpdateAsync(OpenIdClientSettings sett { if (result != ValidationResult.Success) { - var key = result.MemberNames.FirstOrDefault() ?? String.Empty; + var key = result.MemberNames.FirstOrDefault() ?? string.Empty; context.Updater.ModelState.AddModelError(key, result.ErrorMessage); } } diff --git a/src/OrchardCore.Modules/OrchardCore.OpenId/Recipes/OpenIdServerSettingsStep.cs b/src/OrchardCore.Modules/OrchardCore.OpenId/Recipes/OpenIdServerSettingsStep.cs index d069f52122b..9ee0c9dc74c 100644 --- a/src/OrchardCore.Modules/OrchardCore.OpenId/Recipes/OpenIdServerSettingsStep.cs +++ b/src/OrchardCore.Modules/OrchardCore.OpenId/Recipes/OpenIdServerSettingsStep.cs @@ -20,7 +20,7 @@ public OpenIdServerSettingsStep(IOpenIdServerService serverService) public async Task ExecuteAsync(RecipeExecutionContext context) { - if (!String.Equals(context.Name, nameof(OpenIdServerSettings), StringComparison.OrdinalIgnoreCase)) + if (!string.Equals(context.Name, nameof(OpenIdServerSettings), StringComparison.OrdinalIgnoreCase)) { return; } @@ -29,7 +29,7 @@ public async Task ExecuteAsync(RecipeExecutionContext context) var settings = await _serverService.LoadSettingsAsync(); settings.AccessTokenFormat = model.AccessTokenFormat; - settings.Authority = !String.IsNullOrEmpty(model.Authority) ? new Uri(model.Authority, UriKind.Absolute) : null; + settings.Authority = !string.IsNullOrEmpty(model.Authority) ? new Uri(model.Authority, UriKind.Absolute) : null; settings.EncryptionCertificateStoreLocation = model.EncryptionCertificateStoreLocation; settings.EncryptionCertificateStoreName = model.EncryptionCertificateStoreName; diff --git a/src/OrchardCore.Modules/OrchardCore.OpenId/Recipes/OpenIdValidationSettingsStep.cs b/src/OrchardCore.Modules/OrchardCore.OpenId/Recipes/OpenIdValidationSettingsStep.cs index 3bc65116646..650ca2d0597 100644 --- a/src/OrchardCore.Modules/OrchardCore.OpenId/Recipes/OpenIdValidationSettingsStep.cs +++ b/src/OrchardCore.Modules/OrchardCore.OpenId/Recipes/OpenIdValidationSettingsStep.cs @@ -19,7 +19,7 @@ public OpenIdValidationSettingsStep(IOpenIdValidationService validationService) public async Task ExecuteAsync(RecipeExecutionContext context) { - if (!String.Equals(context.Name, nameof(OpenIdValidationSettings), StringComparison.OrdinalIgnoreCase)) + if (!string.Equals(context.Name, nameof(OpenIdValidationSettings), StringComparison.OrdinalIgnoreCase)) { return; } @@ -28,8 +28,8 @@ public async Task ExecuteAsync(RecipeExecutionContext context) var settings = await _validationService.LoadSettingsAsync(); settings.Tenant = model.Tenant; - settings.MetadataAddress = !String.IsNullOrEmpty(model.MetadataAddress) ? new Uri(model.MetadataAddress, UriKind.Absolute) : null; - settings.Authority = !String.IsNullOrEmpty(model.Authority) ? new Uri(model.Authority, UriKind.Absolute) : null; + settings.MetadataAddress = !string.IsNullOrEmpty(model.MetadataAddress) ? new Uri(model.MetadataAddress, UriKind.Absolute) : null; + settings.Authority = !string.IsNullOrEmpty(model.Authority) ? new Uri(model.Authority, UriKind.Absolute) : null; settings.Audience = model.Audience; settings.DisableTokenTypeValidation = model.DisableTokenTypeValidation; diff --git a/src/OrchardCore.Modules/OrchardCore.OpenId/Services/OpenIdClientService.cs b/src/OrchardCore.Modules/OrchardCore.OpenId/Services/OpenIdClientService.cs index 8140c5d904a..01ee51d8282 100644 --- a/src/OrchardCore.Modules/OrchardCore.OpenId/Services/OpenIdClientService.cs +++ b/src/OrchardCore.Modules/OrchardCore.OpenId/Services/OpenIdClientService.cs @@ -71,7 +71,7 @@ public Task> ValidateSettingsAsync(OpenIdClient nameof(settings.Authority) })); } - else if (!String.IsNullOrEmpty(settings.Authority.Query) || !String.IsNullOrEmpty(settings.Authority.Fragment)) + else if (!string.IsNullOrEmpty(settings.Authority.Query) || !string.IsNullOrEmpty(settings.Authority.Fragment)) { results.Add(new ValidationResult(S["The authority cannot contain a query string or a fragment."], new[] { @@ -79,7 +79,7 @@ public Task> ValidateSettingsAsync(OpenIdClient })); } - if (String.IsNullOrEmpty(settings.ResponseType)) + if (string.IsNullOrEmpty(settings.ResponseType)) { results.Add(new ValidationResult(S["The response type cannot be null or empty."], new[] { @@ -96,7 +96,7 @@ public Task> ValidateSettingsAsync(OpenIdClient })); } - if (String.IsNullOrEmpty(settings.ResponseMode)) + if (string.IsNullOrEmpty(settings.ResponseMode)) { results.Add(new ValidationResult(S["The response mode cannot be null or empty."], new[] { diff --git a/src/OrchardCore.Modules/OrchardCore.OpenId/Services/OpenIdServerService.cs b/src/OrchardCore.Modules/OrchardCore.OpenId/Services/OpenIdServerService.cs index 474e366e4e8..28bf8cf2782 100644 --- a/src/OrchardCore.Modules/OrchardCore.OpenId/Services/OpenIdServerService.cs +++ b/src/OrchardCore.Modules/OrchardCore.OpenId/Services/OpenIdServerService.cs @@ -122,7 +122,7 @@ public Task> ValidateSettingsAsync(OpenIdServer })); } - if (!String.IsNullOrEmpty(settings.Authority.Query) || !String.IsNullOrEmpty(settings.Authority.Fragment)) + if (!string.IsNullOrEmpty(settings.Authority.Query) || !string.IsNullOrEmpty(settings.Authority.Fragment)) { results.Add(new ValidationResult(S["The authority cannot contain a query string or a fragment."], new[] { @@ -133,7 +133,7 @@ public Task> ValidateSettingsAsync(OpenIdServer if (settings.SigningCertificateStoreLocation != null && settings.SigningCertificateStoreName != null && - !String.IsNullOrEmpty(settings.SigningCertificateThumbprint)) + !string.IsNullOrEmpty(settings.SigningCertificateThumbprint)) { var certificate = GetCertificate( settings.SigningCertificateStoreLocation.Value, @@ -280,7 +280,7 @@ public async Task> GetEncryptionKeysAsync() // instead of using the fallback managed certificates logic. if (settings.EncryptionCertificateStoreLocation != null && settings.EncryptionCertificateStoreName != null && - !String.IsNullOrEmpty(settings.EncryptionCertificateThumbprint)) + !string.IsNullOrEmpty(settings.EncryptionCertificateThumbprint)) { var certificate = GetCertificate( settings.EncryptionCertificateStoreLocation.Value, @@ -349,7 +349,7 @@ public async Task> GetSigningKeysAsync() // instead of using the fallback managed certificates logic. if (settings.SigningCertificateStoreLocation != null && settings.SigningCertificateStoreName != null && - !String.IsNullOrEmpty(settings.SigningCertificateThumbprint)) + !string.IsNullOrEmpty(settings.SigningCertificateThumbprint)) { var certificate = GetCertificate( settings.SigningCertificateStoreLocation.Value, diff --git a/src/OrchardCore.Modules/OrchardCore.OpenId/Services/OpenIdValidationService.cs b/src/OrchardCore.Modules/OrchardCore.OpenId/Services/OpenIdValidationService.cs index 93cca9039b3..765e5f9adfc 100644 --- a/src/OrchardCore.Modules/OrchardCore.OpenId/Services/OpenIdValidationService.cs +++ b/src/OrchardCore.Modules/OrchardCore.OpenId/Services/OpenIdValidationService.cs @@ -91,7 +91,7 @@ public async Task> ValidateSettingsAsync(OpenId var results = ImmutableArray.CreateBuilder(); - if (!(settings.Authority == null ^ String.IsNullOrEmpty(settings.Tenant))) + if (!(settings.Authority == null ^ string.IsNullOrEmpty(settings.Tenant))) { results.Add(new ValidationResult(S["Either a tenant or an authority must be registered."], new[] { @@ -110,7 +110,7 @@ public async Task> ValidateSettingsAsync(OpenId })); } - if (!String.IsNullOrEmpty(settings.Authority.Query) || !String.IsNullOrEmpty(settings.Authority.Fragment)) + if (!string.IsNullOrEmpty(settings.Authority.Query) || !string.IsNullOrEmpty(settings.Authority.Fragment)) { results.Add(new ValidationResult(S["The authority cannot contain a query string or a fragment."], new[] { @@ -130,7 +130,7 @@ public async Task> ValidateSettingsAsync(OpenId })); } - if (!String.IsNullOrEmpty(settings.MetadataAddress.Query) || !String.IsNullOrEmpty(settings.MetadataAddress.Fragment)) + if (!string.IsNullOrEmpty(settings.MetadataAddress.Query) || !string.IsNullOrEmpty(settings.MetadataAddress.Fragment)) { results.Add(new ValidationResult(S["The metadata address cannot contain a query string or a fragment."], new[] { @@ -138,7 +138,7 @@ public async Task> ValidateSettingsAsync(OpenId })); } - if (!String.IsNullOrEmpty(settings.Tenant)) + if (!string.IsNullOrEmpty(settings.Tenant)) { results.Add(new ValidationResult(S["No metatada address can be set when using another tenant."], new[] { @@ -147,7 +147,7 @@ public async Task> ValidateSettingsAsync(OpenId } } - if (!String.IsNullOrEmpty(settings.Tenant) && !String.IsNullOrEmpty(settings.Audience)) + if (!string.IsNullOrEmpty(settings.Tenant) && !string.IsNullOrEmpty(settings.Audience)) { results.Add(new ValidationResult(S["No audience can be set when using another tenant."], new[] { @@ -155,7 +155,7 @@ public async Task> ValidateSettingsAsync(OpenId })); } - if (settings.Authority != null && String.IsNullOrEmpty(settings.Audience)) + if (settings.Authority != null && string.IsNullOrEmpty(settings.Audience)) { results.Add(new ValidationResult(S["An audience must be set when configuring the authority."], new[] { @@ -171,7 +171,7 @@ public async Task> ValidateSettingsAsync(OpenId })); } - if (!String.IsNullOrEmpty(settings.Audience) && + if (!string.IsNullOrEmpty(settings.Audience) && settings.Audience.StartsWith(OpenIdConstants.Prefixes.Tenant, StringComparison.OrdinalIgnoreCase)) { results.Add(new ValidationResult(S["The audience cannot start with the special 'oct:' prefix."], new[] @@ -182,8 +182,8 @@ public async Task> ValidateSettingsAsync(OpenId // If a tenant was specified, ensure it is valid, that the OpenID server feature // was enabled and that at least a scope linked with the current tenant exists. - if (!String.IsNullOrEmpty(settings.Tenant) && - !String.Equals(settings.Tenant, _shellSettings.Name)) + if (!string.IsNullOrEmpty(settings.Tenant) && + !string.Equals(settings.Tenant, _shellSettings.Name)) { if (!_shellHost.TryGetSettings(settings.Tenant, out var shellSettings)) { diff --git a/src/OrchardCore.Modules/OrchardCore.Placements/AdminMenu.cs b/src/OrchardCore.Modules/OrchardCore.Placements/AdminMenu.cs index fac4dd3a278..fd40c58e46f 100644 --- a/src/OrchardCore.Modules/OrchardCore.Placements/AdminMenu.cs +++ b/src/OrchardCore.Modules/OrchardCore.Placements/AdminMenu.cs @@ -16,7 +16,7 @@ public AdminMenu(IStringLocalizer localizer) public Task BuildNavigationAsync(string name, NavigationBuilder builder) { - if (!String.Equals(name, "admin", StringComparison.OrdinalIgnoreCase)) + if (!string.Equals(name, "admin", StringComparison.OrdinalIgnoreCase)) { return Task.CompletedTask; } diff --git a/src/OrchardCore.Modules/OrchardCore.Placements/Controllers/AdminController.cs b/src/OrchardCore.Modules/OrchardCore.Placements/Controllers/AdminController.cs index b2051e41bcb..e2ee830f58f 100644 --- a/src/OrchardCore.Modules/OrchardCore.Placements/Controllers/AdminController.cs +++ b/src/OrchardCore.Modules/OrchardCore.Placements/Controllers/AdminController.cs @@ -70,7 +70,7 @@ public async Task Index(ContentOptions options, PagerParameters p ShapeType = entry.Key }).ToList(); - if (!String.IsNullOrWhiteSpace(options.Search)) + if (!string.IsNullOrWhiteSpace(options.Search)) { shapeList = shapeList.Where(x => x.ShapeType.Contains(options.Search, StringComparison.OrdinalIgnoreCase)).ToList(); } @@ -142,11 +142,11 @@ public async Task Edit(string shapeType, string displayType = nul DisplayType = displayType, Differentiator = differentiator }; - if (!String.IsNullOrEmpty(contentType)) + if (!string.IsNullOrEmpty(contentType)) { generatedNode.Filters.Add("contentType", new JArray(contentType)); } - if (!String.IsNullOrEmpty(contentPart)) + if (!string.IsNullOrEmpty(contentPart)) { generatedNode.Filters.Add("contentPart", new JArray(contentPart)); } @@ -275,7 +275,7 @@ public async Task IndexPost(ViewModels.ContentOptions options, IEn private IActionResult RedirectToReturnUrlOrIndex(string returnUrl) { - if ((String.IsNullOrEmpty(returnUrl) == false) && (Url.IsLocalUrl(returnUrl))) + if ((string.IsNullOrEmpty(returnUrl) == false) && (Url.IsLocalUrl(returnUrl))) { return this.Redirect(returnUrl, true); } @@ -287,24 +287,24 @@ private IActionResult RedirectToReturnUrlOrIndex(string returnUrl) private static bool ShouldCreateNode(IEnumerable nodes, string displayType, string contentType, string contentPart, string differentiator) { - if (String.IsNullOrEmpty(displayType) && String.IsNullOrEmpty(differentiator)) + if (string.IsNullOrEmpty(displayType) && string.IsNullOrEmpty(differentiator)) { return false; } else { return !nodes.Any(node => - (String.IsNullOrEmpty(displayType) || node.DisplayType == displayType) && - (String.IsNullOrEmpty(contentType) || (node.Filters.ContainsKey("contentType") && FilterEquals(node.Filters["contentType"], contentType))) && - (String.IsNullOrEmpty(contentPart) || (node.Filters.ContainsKey("contentPart") && FilterEquals(node.Filters["contentPart"], contentPart))) && - (String.IsNullOrEmpty(differentiator) || node.Differentiator == differentiator)); + (string.IsNullOrEmpty(displayType) || node.DisplayType == displayType) && + (string.IsNullOrEmpty(contentType) || (node.Filters.ContainsKey("contentType") && FilterEquals(node.Filters["contentType"], contentType))) && + (string.IsNullOrEmpty(contentPart) || (node.Filters.ContainsKey("contentPart") && FilterEquals(node.Filters["contentPart"], contentPart))) && + (string.IsNullOrEmpty(differentiator) || node.Differentiator == differentiator)); } } private static bool IsEmpty(PlacementNode node) { - return String.IsNullOrEmpty(node.Location) - && String.IsNullOrEmpty(node.ShapeType) + return string.IsNullOrEmpty(node.Location) + && string.IsNullOrEmpty(node.ShapeType) && (node.Alternates == null || node.Alternates.Length == 0) && (node.Wrappers == null || node.Wrappers.Length == 0); } diff --git a/src/OrchardCore.Modules/OrchardCore.Placements/Recipes/PlacementStep.cs b/src/OrchardCore.Modules/OrchardCore.Placements/Recipes/PlacementStep.cs index d90ef923324..ee63bbadc66 100644 --- a/src/OrchardCore.Modules/OrchardCore.Placements/Recipes/PlacementStep.cs +++ b/src/OrchardCore.Modules/OrchardCore.Placements/Recipes/PlacementStep.cs @@ -22,7 +22,7 @@ public PlacementStep(PlacementsManager placementsManager) public async Task ExecuteAsync(RecipeExecutionContext context) { - if (!String.Equals(context.Name, "Placements", StringComparison.OrdinalIgnoreCase)) + if (!string.Equals(context.Name, "Placements", StringComparison.OrdinalIgnoreCase)) { return; } diff --git a/src/OrchardCore.Modules/OrchardCore.Placements/Services/PlacementProvider.cs b/src/OrchardCore.Modules/OrchardCore.Placements/Services/PlacementProvider.cs index eb0862ee8e8..0b6c04745a0 100644 --- a/src/OrchardCore.Modules/OrchardCore.Placements/Services/PlacementProvider.cs +++ b/src/OrchardCore.Modules/OrchardCore.Placements/Services/PlacementProvider.cs @@ -72,12 +72,12 @@ public PlacementInfo ResolvePlacement(ShapePlacementContext placementContext) Source = "OrchardCore.Placements", }; - if (!String.IsNullOrEmpty(placementRule.Location)) + if (!string.IsNullOrEmpty(placementRule.Location)) { placement.Location = placementRule.Location; } - if (!String.IsNullOrEmpty(placementRule.ShapeType)) + if (!string.IsNullOrEmpty(placementRule.ShapeType)) { placement.ShapeType = placementRule.ShapeType; } diff --git a/src/OrchardCore.Modules/OrchardCore.Queries/AdminMenu.cs b/src/OrchardCore.Modules/OrchardCore.Queries/AdminMenu.cs index bedda8766a4..ec2e861933c 100644 --- a/src/OrchardCore.Modules/OrchardCore.Queries/AdminMenu.cs +++ b/src/OrchardCore.Modules/OrchardCore.Queries/AdminMenu.cs @@ -16,7 +16,7 @@ public AdminMenu(IStringLocalizer localizer) public Task BuildNavigationAsync(string name, NavigationBuilder builder) { - if (!String.Equals(name, "admin", StringComparison.OrdinalIgnoreCase)) + if (!string.Equals(name, "admin", StringComparison.OrdinalIgnoreCase)) { return Task.CompletedTask; } diff --git a/src/OrchardCore.Modules/OrchardCore.Queries/Controllers/AdminController.cs b/src/OrchardCore.Modules/OrchardCore.Queries/Controllers/AdminController.cs index 2f767ebee1c..dce9666193f 100644 --- a/src/OrchardCore.Modules/OrchardCore.Queries/Controllers/AdminController.cs +++ b/src/OrchardCore.Modules/OrchardCore.Queries/Controllers/AdminController.cs @@ -67,7 +67,7 @@ public async Task Index(ContentOptions options, PagerParameters p var queries = await _queryManager.ListQueriesAsync(); queries = queries.OrderBy(x => x.Name); - if (!String.IsNullOrWhiteSpace(options.Search)) + if (!string.IsNullOrWhiteSpace(options.Search)) { queries = queries.Where(q => q.Name.Contains(options.Search, StringComparison.OrdinalIgnoreCase)); } diff --git a/src/OrchardCore.Modules/OrchardCore.Queries/Drivers/QueryDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.Queries/Drivers/QueryDisplayDriver.cs index 6835ba8ef44..ddc05b21586 100644 --- a/src/OrchardCore.Modules/OrchardCore.Queries/Drivers/QueryDisplayDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Queries/Drivers/QueryDisplayDriver.cs @@ -64,16 +64,16 @@ public override async Task UpdateAsync(Query model, IUpdateModel { await updater.TryUpdateModelAsync(model, Prefix, m => m.Name, m => m.Source, m => m.Schema); - if (String.IsNullOrEmpty(model.Name)) + if (string.IsNullOrEmpty(model.Name)) { updater.ModelState.AddModelError(nameof(model.Name), S["Name is required"]); } - if (!String.IsNullOrEmpty(model.Schema) && !model.Schema.IsJson()) + if (!string.IsNullOrEmpty(model.Schema) && !model.Schema.IsJson()) { updater.ModelState.AddModelError(nameof(model.Schema), S["Invalid schema JSON supplied."]); } var safeName = model.Name.ToSafeName(); - if (String.IsNullOrEmpty(safeName) || model.Name != safeName) + if (string.IsNullOrEmpty(safeName) || model.Name != safeName) { updater.ModelState.AddModelError(nameof(model.Name), S["Name contains illegal characters"]); } diff --git a/src/OrchardCore.Modules/OrchardCore.Queries/Permissions.cs b/src/OrchardCore.Modules/OrchardCore.Queries/Permissions.cs index 6ca898e991f..60c1661f926 100644 --- a/src/OrchardCore.Modules/OrchardCore.Queries/Permissions.cs +++ b/src/OrchardCore.Modules/OrchardCore.Queries/Permissions.cs @@ -50,8 +50,8 @@ public IEnumerable GetDefaultStereotypes() public static Permission CreatePermissionForQuery(string name) { return new Permission( - String.Format(_executeApi.Name, name), - String.Format(_executeApi.Description, name), + string.Format(_executeApi.Name, name), + string.Format(_executeApi.Description, name), _executeApi.ImpliedBy ); } diff --git a/src/OrchardCore.Modules/OrchardCore.Queries/Recipes/QueryStep.cs b/src/OrchardCore.Modules/OrchardCore.Queries/Recipes/QueryStep.cs index 451015488de..5c031807502 100644 --- a/src/OrchardCore.Modules/OrchardCore.Queries/Recipes/QueryStep.cs +++ b/src/OrchardCore.Modules/OrchardCore.Queries/Recipes/QueryStep.cs @@ -30,7 +30,7 @@ public QueryStep( public async Task ExecuteAsync(RecipeExecutionContext context) { - if (!String.Equals(context.Name, "Queries", StringComparison.OrdinalIgnoreCase)) + if (!string.Equals(context.Name, "Queries", StringComparison.OrdinalIgnoreCase)) { return; } diff --git a/src/OrchardCore.Modules/OrchardCore.Queries/Sql/AdminMenu.cs b/src/OrchardCore.Modules/OrchardCore.Queries/Sql/AdminMenu.cs index 8758b076ffa..4fd44f1c6aa 100644 --- a/src/OrchardCore.Modules/OrchardCore.Queries/Sql/AdminMenu.cs +++ b/src/OrchardCore.Modules/OrchardCore.Queries/Sql/AdminMenu.cs @@ -16,7 +16,7 @@ public AdminMenu(IStringLocalizer localizer) public Task BuildNavigationAsync(string name, NavigationBuilder builder) { - if (!String.Equals(name, "admin", StringComparison.OrdinalIgnoreCase)) + if (!string.Equals(name, "admin", StringComparison.OrdinalIgnoreCase)) { return Task.CompletedTask; } diff --git a/src/OrchardCore.Modules/OrchardCore.Queries/Sql/Controllers/AdminController.cs b/src/OrchardCore.Modules/OrchardCore.Queries/Sql/Controllers/AdminController.cs index a51b5d94f7c..b107070c3b4 100644 --- a/src/OrchardCore.Modules/OrchardCore.Queries/Sql/Controllers/AdminController.cs +++ b/src/OrchardCore.Modules/OrchardCore.Queries/Sql/Controllers/AdminController.cs @@ -44,7 +44,7 @@ public AdminController( public Task Query(string query) { - query = String.IsNullOrWhiteSpace(query) ? "" : System.Text.Encoding.UTF8.GetString(Convert.FromBase64String(query)); + query = string.IsNullOrWhiteSpace(query) ? "" : System.Text.Encoding.UTF8.GetString(Convert.FromBase64String(query)); return Query(new AdminQueryViewModel { DecodedQuery = query, @@ -60,12 +60,12 @@ public async Task Query(AdminQueryViewModel model) return Forbid(); } - if (String.IsNullOrWhiteSpace(model.DecodedQuery)) + if (string.IsNullOrWhiteSpace(model.DecodedQuery)) { return View(model); } - if (String.IsNullOrEmpty(model.Parameters)) + if (string.IsNullOrEmpty(model.Parameters)) { model.Parameters = "{ }"; } diff --git a/src/OrchardCore.Modules/OrchardCore.Queries/Sql/Drivers/SqlQueryDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.Queries/Sql/Drivers/SqlQueryDisplayDriver.cs index 51198880ccc..d00e79e15d3 100644 --- a/src/OrchardCore.Modules/OrchardCore.Queries/Sql/Drivers/SqlQueryDisplayDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Queries/Sql/Drivers/SqlQueryDisplayDriver.cs @@ -39,7 +39,7 @@ public override IDisplayResult Edit(SqlQuery query, IUpdateModel updater) model.ReturnDocuments = query.ReturnDocuments; // Extract query from the query string if we come from the main query editor. - if (String.IsNullOrEmpty(query.Template)) + if (string.IsNullOrEmpty(query.Template)) { updater.TryUpdateModelAsync(model, "", m => m.Query); } @@ -55,7 +55,7 @@ public override async Task UpdateAsync(SqlQuery model, IUpdateMo model.ReturnDocuments = viewModel.ReturnDocuments; } - if (String.IsNullOrWhiteSpace(model.Template)) + if (string.IsNullOrWhiteSpace(model.Template)) { updater.ModelState.AddModelError(nameof(model.Template), S["The query field is required"]); } diff --git a/src/OrchardCore.Modules/OrchardCore.Queries/Sql/GraphQL/SqlQueryFieldTypeProvider.cs b/src/OrchardCore.Modules/OrchardCore.Queries/Sql/GraphQL/SqlQueryFieldTypeProvider.cs index bc3ec6c1cfb..bae72a147e0 100644 --- a/src/OrchardCore.Modules/OrchardCore.Queries/Sql/GraphQL/SqlQueryFieldTypeProvider.cs +++ b/src/OrchardCore.Modules/OrchardCore.Queries/Sql/GraphQL/SqlQueryFieldTypeProvider.cs @@ -43,7 +43,7 @@ public async Task BuildAsync(ISchema schema) foreach (var query in queries.OfType()) { - if (String.IsNullOrWhiteSpace(query.Schema)) + if (string.IsNullOrWhiteSpace(query.Schema)) continue; var name = query.Name; diff --git a/src/OrchardCore.Modules/OrchardCore.Queries/Sql/SqlParser.cs b/src/OrchardCore.Modules/OrchardCore.Queries/Sql/SqlParser.cs index 834d1618759..ab417187e2a 100644 --- a/src/OrchardCore.Modules/OrchardCore.Queries/Sql/SqlParser.cs +++ b/src/OrchardCore.Modules/OrchardCore.Queries/Sql/SqlParser.cs @@ -149,49 +149,49 @@ private string EvaluateSelectStatement(ParseTreeNode selectStatement) EvaluateFromClause(selectStatement.ChildNodes[3]); - if (!String.IsNullOrEmpty(_from)) + if (!string.IsNullOrEmpty(_from)) { sqlBuilder.From(_from); } EvaluateWhereClause(selectStatement.ChildNodes[4]); - if (!String.IsNullOrEmpty(_where)) + if (!string.IsNullOrEmpty(_where)) { sqlBuilder.WhereAnd(_where); } EvaluateGroupClause(selectStatement.ChildNodes[5]); - if (!String.IsNullOrEmpty(_groupBy)) + if (!string.IsNullOrEmpty(_groupBy)) { sqlBuilder.GroupBy(_groupBy); } EvaluateHavingClause(selectStatement.ChildNodes[6]); - if (!String.IsNullOrEmpty(_having)) + if (!string.IsNullOrEmpty(_having)) { sqlBuilder.Having(_having); } EvaluateOrderClause(selectStatement.ChildNodes[7]); - if (!String.IsNullOrEmpty(_orderBy)) + if (!string.IsNullOrEmpty(_orderBy)) { sqlBuilder.OrderBy(_orderBy); } EvaluateLimitClause(selectStatement.ChildNodes[8]); - if (!String.IsNullOrEmpty(_limit)) + if (!string.IsNullOrEmpty(_limit)) { sqlBuilder.Take(_limit); } EvaluateOffsetClause(selectStatement.ChildNodes[9]); - if (!String.IsNullOrEmpty(_offset)) + if (!string.IsNullOrEmpty(_offset)) { sqlBuilder.Skip(_offset); } diff --git a/src/OrchardCore.Modules/OrchardCore.ReCaptcha/AdminMenu.cs b/src/OrchardCore.Modules/OrchardCore.ReCaptcha/AdminMenu.cs index f23f667483c..a534fdbfd95 100644 --- a/src/OrchardCore.Modules/OrchardCore.ReCaptcha/AdminMenu.cs +++ b/src/OrchardCore.Modules/OrchardCore.ReCaptcha/AdminMenu.cs @@ -17,7 +17,7 @@ public AdminMenu(IStringLocalizer localizer) public Task BuildNavigationAsync(string name, NavigationBuilder builder) { - if (!String.Equals(name, "admin", StringComparison.OrdinalIgnoreCase)) + if (!string.Equals(name, "admin", StringComparison.OrdinalIgnoreCase)) { return Task.CompletedTask; } diff --git a/src/OrchardCore.Modules/OrchardCore.ReCaptcha/ReCaptchaLoginFilter.cs b/src/OrchardCore.Modules/OrchardCore.ReCaptcha/ReCaptchaLoginFilter.cs index d9bf794056f..d02a07fe56e 100644 --- a/src/OrchardCore.Modules/OrchardCore.ReCaptcha/ReCaptchaLoginFilter.cs +++ b/src/OrchardCore.Modules/OrchardCore.ReCaptcha/ReCaptchaLoginFilter.cs @@ -32,7 +32,7 @@ public ReCaptchaLoginFilter( public async Task OnResultExecutionAsync(ResultExecutingContext context, ResultExecutionDelegate next) { if (!context.IsViewOrPageResult() - || !String.Equals("OrchardCore.Users", Convert.ToString(context.RouteData.Values["area"]), StringComparison.OrdinalIgnoreCase)) + || !string.Equals("OrchardCore.Users", Convert.ToString(context.RouteData.Values["area"]), StringComparison.OrdinalIgnoreCase)) { await next(); return; diff --git a/src/OrchardCore.Modules/OrchardCore.Recipes/AdminMenu.cs b/src/OrchardCore.Modules/OrchardCore.Recipes/AdminMenu.cs index 7b14704b279..4d45133120d 100644 --- a/src/OrchardCore.Modules/OrchardCore.Recipes/AdminMenu.cs +++ b/src/OrchardCore.Modules/OrchardCore.Recipes/AdminMenu.cs @@ -17,7 +17,7 @@ public AdminMenu(IStringLocalizer localizer) public Task BuildNavigationAsync(string name, NavigationBuilder builder) { - if (!String.Equals(name, "admin", StringComparison.OrdinalIgnoreCase)) + if (!string.Equals(name, "admin", StringComparison.OrdinalIgnoreCase)) { return Task.CompletedTask; } diff --git a/src/OrchardCore.Modules/OrchardCore.Recipes/RecipeSteps/CommandStep.cs b/src/OrchardCore.Modules/OrchardCore.Recipes/RecipeSteps/CommandStep.cs index 7e41af8768d..034fbe4f876 100644 --- a/src/OrchardCore.Modules/OrchardCore.Recipes/RecipeSteps/CommandStep.cs +++ b/src/OrchardCore.Modules/OrchardCore.Recipes/RecipeSteps/CommandStep.cs @@ -32,7 +32,7 @@ public CommandStep(ICommandManager commandManager, public async Task ExecuteAsync(RecipeExecutionContext context) { - if (!String.Equals(context.Name, "Command", StringComparison.OrdinalIgnoreCase)) + if (!string.Equals(context.Name, "Command", StringComparison.OrdinalIgnoreCase)) { return; } diff --git a/src/OrchardCore.Modules/OrchardCore.Recipes/RecipeSteps/RecipesStep.cs b/src/OrchardCore.Modules/OrchardCore.Recipes/RecipeSteps/RecipesStep.cs index 5dd55c6b145..2ab4673e51d 100644 --- a/src/OrchardCore.Modules/OrchardCore.Recipes/RecipeSteps/RecipesStep.cs +++ b/src/OrchardCore.Modules/OrchardCore.Recipes/RecipeSteps/RecipesStep.cs @@ -21,7 +21,7 @@ public RecipesStep(IEnumerable recipeHarvesters) public async Task ExecuteAsync(RecipeExecutionContext context) { - if (!String.Equals(context.Name, "Recipes", StringComparison.OrdinalIgnoreCase)) + if (!string.Equals(context.Name, "Recipes", StringComparison.OrdinalIgnoreCase)) { return; } diff --git a/src/OrchardCore.Modules/OrchardCore.Redis/Services/RedisCacheWrapper.cs b/src/OrchardCore.Modules/OrchardCore.Redis/Services/RedisCacheWrapper.cs index 263a709febc..31327781423 100644 --- a/src/OrchardCore.Modules/OrchardCore.Redis/Services/RedisCacheWrapper.cs +++ b/src/OrchardCore.Modules/OrchardCore.Redis/Services/RedisCacheWrapper.cs @@ -12,7 +12,7 @@ namespace OrchardCore.Redis.Services; /// public class RedisCacheWrapper : IDistributedCache { - private readonly RedisCache _cache; + private readonly RedisCache _cache; public RedisCacheWrapper(IOptions optionsAccessor) => _cache = new RedisCache(optionsAccessor); diff --git a/src/OrchardCore.Modules/OrchardCore.Resources/Liquid/LinkTag.cs b/src/OrchardCore.Modules/OrchardCore.Resources/Liquid/LinkTag.cs index 224e3c1bbcd..f3c3f3674b8 100644 --- a/src/OrchardCore.Modules/OrchardCore.Resources/Liquid/LinkTag.cs +++ b/src/OrchardCore.Modules/OrchardCore.Resources/Liquid/LinkTag.cs @@ -43,27 +43,27 @@ public static async ValueTask WriteToAsync(List argu var linkEntry = new LinkEntry(); - if (!String.IsNullOrEmpty(src)) + if (!string.IsNullOrEmpty(src)) { linkEntry.Href = src; } - if (!String.IsNullOrEmpty(rel)) + if (!string.IsNullOrEmpty(rel)) { linkEntry.Rel = rel; } - if (!String.IsNullOrEmpty(condition)) + if (!string.IsNullOrEmpty(condition)) { linkEntry.Condition = condition; } - if (!String.IsNullOrEmpty(title)) + if (!string.IsNullOrEmpty(title)) { linkEntry.Title = title; } - if (!String.IsNullOrEmpty(type)) + if (!string.IsNullOrEmpty(type)) { linkEntry.Type = type; } diff --git a/src/OrchardCore.Modules/OrchardCore.Resources/Liquid/ScriptBlock.cs b/src/OrchardCore.Modules/OrchardCore.Resources/Liquid/ScriptBlock.cs index 8e5775f24b5..bfc63220735 100644 --- a/src/OrchardCore.Modules/OrchardCore.Resources/Liquid/ScriptBlock.cs +++ b/src/OrchardCore.Modules/OrchardCore.Resources/Liquid/ScriptBlock.cs @@ -48,7 +48,7 @@ public static async ValueTask WriteToAsync(List argu } } - if (!String.IsNullOrEmpty(name)) + if (!string.IsNullOrEmpty(name)) { // Resource required @@ -64,7 +64,7 @@ public static async ValueTask WriteToAsync(List argu setting.UseCdn(useCdn.Value); } - if (!String.IsNullOrEmpty(condition)) + if (!string.IsNullOrEmpty(condition)) { setting.UseCondition(condition); } @@ -74,18 +74,18 @@ public static async ValueTask WriteToAsync(List argu setting.UseDebugMode(debug.Value); } - if (!String.IsNullOrEmpty(culture)) + if (!string.IsNullOrEmpty(culture)) { setting.UseCulture(culture); } - if (!String.IsNullOrEmpty(version)) + if (!string.IsNullOrEmpty(version)) { setting.UseVersion(version); } // This allows additions to the pre registered scripts dependencies. - if (!String.IsNullOrEmpty(dependsOn)) + if (!string.IsNullOrEmpty(dependsOn)) { setting.SetDependencies(dependsOn.Split(_separators, StringSplitOptions.RemoveEmptyEntries)); } @@ -109,7 +109,7 @@ public static async ValueTask WriteToAsync(List argu } // Named inline declaration. - if (!String.IsNullOrWhiteSpace(content)) + if (!string.IsNullOrWhiteSpace(content)) { // Inline content definition resourceManager.InlineManifest.DefineScript(name).SetInnerContent(content); diff --git a/src/OrchardCore.Modules/OrchardCore.Resources/Liquid/ScriptTag.cs b/src/OrchardCore.Modules/OrchardCore.Resources/Liquid/ScriptTag.cs index 75b546a68a8..3efdfc85533 100644 --- a/src/OrchardCore.Modules/OrchardCore.Resources/Liquid/ScriptTag.cs +++ b/src/OrchardCore.Modules/OrchardCore.Resources/Liquid/ScriptTag.cs @@ -57,12 +57,12 @@ public static async ValueTask WriteToAsync(List argu } } - if (String.IsNullOrEmpty(name) && !String.IsNullOrEmpty(src)) + if (string.IsNullOrEmpty(name) && !string.IsNullOrEmpty(src)) { // {% script src:"~/TheBlogTheme/js/clean-blog.min.js" %} RequireSettings setting; - if (String.IsNullOrEmpty(dependsOn)) + if (string.IsNullOrEmpty(dependsOn)) { // Include custom script url setting = resourceManager.RegisterUrl("script", src, debugSrc); @@ -77,22 +77,22 @@ public static async ValueTask WriteToAsync(List argu var definition = resourceManager.InlineManifest.DefineScript(s); definition.SetUrl(src, debugSrc); - if (!String.IsNullOrEmpty(version)) + if (!string.IsNullOrEmpty(version)) { definition.SetVersion(version); } - if (!String.IsNullOrEmpty(cdnSrc)) + if (!string.IsNullOrEmpty(cdnSrc)) { definition.SetCdn(cdnSrc, debugCdnSrc); } - if (!String.IsNullOrEmpty(culture)) + if (!string.IsNullOrEmpty(culture)) { definition.SetCultures(culture.Split(_separators, StringSplitOptions.RemoveEmptyEntries)); } - if (!String.IsNullOrEmpty(dependsOn)) + if (!string.IsNullOrEmpty(dependsOn)) { definition.SetDependencies(dependsOn.Split(_separators, StringSplitOptions.RemoveEmptyEntries)); } @@ -102,7 +102,7 @@ public static async ValueTask WriteToAsync(List argu definition.ShouldAppendVersion(appendVersion); } - if (!String.IsNullOrEmpty(version)) + if (!string.IsNullOrEmpty(version)) { definition.SetVersion(version); } @@ -115,7 +115,7 @@ public static async ValueTask WriteToAsync(List argu setting.AtLocation(at); } - if (!String.IsNullOrEmpty(condition)) + if (!string.IsNullOrEmpty(condition)) { setting.UseCondition(condition); } @@ -125,7 +125,7 @@ public static async ValueTask WriteToAsync(List argu setting.UseDebugMode(debug.Value); } - if (!String.IsNullOrEmpty(culture)) + if (!string.IsNullOrEmpty(culture)) { setting.UseCulture(culture); } @@ -148,7 +148,7 @@ public static async ValueTask WriteToAsync(List argu resourceManager.RenderLocalScript(setting, writer); } } - else if (!String.IsNullOrEmpty(name) && String.IsNullOrEmpty(src)) + else if (!string.IsNullOrEmpty(name) && string.IsNullOrEmpty(src)) { // Resource required // {% script name:"bootstrap" %} @@ -165,7 +165,7 @@ public static async ValueTask WriteToAsync(List argu setting.UseCdn(useCdn.Value); } - if (!String.IsNullOrEmpty(condition)) + if (!string.IsNullOrEmpty(condition)) { setting.UseCondition(condition); } @@ -175,7 +175,7 @@ public static async ValueTask WriteToAsync(List argu setting.UseDebugMode(debug.Value); } - if (!String.IsNullOrEmpty(culture)) + if (!string.IsNullOrEmpty(culture)) { setting.UseCulture(culture); } @@ -185,13 +185,13 @@ public static async ValueTask WriteToAsync(List argu setting.ShouldAppendVersion(appendVersion); } - if (!String.IsNullOrEmpty(version)) + if (!string.IsNullOrEmpty(version)) { setting.UseVersion(version); } // This allows additions to the pre registered scripts dependencies. - if (!String.IsNullOrEmpty(dependsOn)) + if (!string.IsNullOrEmpty(dependsOn)) { setting.SetDependencies(dependsOn.Split(_separators, StringSplitOptions.RemoveEmptyEntries)); } @@ -201,29 +201,29 @@ public static async ValueTask WriteToAsync(List argu resourceManager.RenderLocalScript(setting, writer); } } - else if (!String.IsNullOrEmpty(name) && !String.IsNullOrEmpty(src)) + else if (!string.IsNullOrEmpty(name) && !string.IsNullOrEmpty(src)) { // Inline declaration var definition = resourceManager.InlineManifest.DefineScript(name); definition.SetUrl(src, debugSrc); - if (!String.IsNullOrEmpty(version)) + if (!string.IsNullOrEmpty(version)) { definition.SetVersion(version); } - if (!String.IsNullOrEmpty(cdnSrc)) + if (!string.IsNullOrEmpty(cdnSrc)) { definition.SetCdn(cdnSrc, debugCdnSrc); } - if (!String.IsNullOrEmpty(culture)) + if (!string.IsNullOrEmpty(culture)) { definition.SetCultures(culture.Split(_separators, StringSplitOptions.RemoveEmptyEntries)); } - if (!String.IsNullOrEmpty(dependsOn)) + if (!string.IsNullOrEmpty(dependsOn)) { definition.SetDependencies(dependsOn.Split(_separators, StringSplitOptions.RemoveEmptyEntries)); } @@ -233,7 +233,7 @@ public static async ValueTask WriteToAsync(List argu definition.ShouldAppendVersion(appendVersion); } - if (!String.IsNullOrEmpty(version)) + if (!string.IsNullOrEmpty(version)) { definition.SetVersion(version); } @@ -250,7 +250,7 @@ public static async ValueTask WriteToAsync(List argu setting.UseCdn(useCdn.Value); } - if (!String.IsNullOrEmpty(condition)) + if (!string.IsNullOrEmpty(condition)) { setting.UseCondition(condition); } @@ -260,7 +260,7 @@ public static async ValueTask WriteToAsync(List argu setting.UseDebugMode(debug.Value); } - if (!String.IsNullOrEmpty(culture)) + if (!string.IsNullOrEmpty(culture)) { setting.UseCulture(culture); } diff --git a/src/OrchardCore.Modules/OrchardCore.Resources/Liquid/StyleBlock.cs b/src/OrchardCore.Modules/OrchardCore.Resources/Liquid/StyleBlock.cs index d8189bdae5b..18a68917a88 100644 --- a/src/OrchardCore.Modules/OrchardCore.Resources/Liquid/StyleBlock.cs +++ b/src/OrchardCore.Modules/OrchardCore.Resources/Liquid/StyleBlock.cs @@ -46,7 +46,7 @@ public static async ValueTask WriteToAsync(List argu } } - if (!String.IsNullOrEmpty(name)) + if (!string.IsNullOrEmpty(name)) { // Resource required @@ -69,7 +69,7 @@ public static async ValueTask WriteToAsync(List argu setting.AtLocation(ResourceLocation.Head); } - if (!String.IsNullOrEmpty(condition)) + if (!string.IsNullOrEmpty(condition)) { setting.UseCondition(condition); } @@ -79,18 +79,18 @@ public static async ValueTask WriteToAsync(List argu setting.UseDebugMode(debug.Value); } - if (!String.IsNullOrEmpty(culture)) + if (!string.IsNullOrEmpty(culture)) { setting.UseCulture(culture); } - if (!String.IsNullOrEmpty(version)) + if (!string.IsNullOrEmpty(version)) { setting.UseVersion(version); } // This allows additions to the pre registered style dependencies. - if (!String.IsNullOrEmpty(dependsOn)) + if (!string.IsNullOrEmpty(dependsOn)) { setting.SetDependencies(dependsOn.Split(_separators, StringSplitOptions.RemoveEmptyEntries)); } @@ -110,7 +110,7 @@ public static async ValueTask WriteToAsync(List argu content = sw.ToString(); } - if (!String.IsNullOrWhiteSpace(content)) + if (!string.IsNullOrWhiteSpace(content)) { // Inline named style definition resourceManager.InlineManifest.DefineStyle(name).SetInnerContent(content); diff --git a/src/OrchardCore.Modules/OrchardCore.Resources/Liquid/StyleTag.cs b/src/OrchardCore.Modules/OrchardCore.Resources/Liquid/StyleTag.cs index 8b1b57e009a..00594244545 100644 --- a/src/OrchardCore.Modules/OrchardCore.Resources/Liquid/StyleTag.cs +++ b/src/OrchardCore.Modules/OrchardCore.Resources/Liquid/StyleTag.cs @@ -57,7 +57,7 @@ public static async ValueTask WriteToAsync(List argu } } - if (String.IsNullOrEmpty(name) && !String.IsNullOrEmpty(src)) + if (string.IsNullOrEmpty(name) && !string.IsNullOrEmpty(src)) { // Include custom style var setting = resourceManager.RegisterUrl("stylesheet", src, debugSrc); @@ -79,7 +79,7 @@ public static async ValueTask WriteToAsync(List argu setting.AtLocation(ResourceLocation.Head); } - if (!String.IsNullOrEmpty(condition)) + if (!string.IsNullOrEmpty(condition)) { setting.UseCondition(condition); } @@ -94,12 +94,12 @@ public static async ValueTask WriteToAsync(List argu setting.UseDebugMode(debug.Value); } - if (!String.IsNullOrEmpty(culture)) + if (!string.IsNullOrEmpty(culture)) { setting.UseCulture(culture); } - if (!String.IsNullOrEmpty(dependsOn)) + if (!string.IsNullOrEmpty(dependsOn)) { setting.SetDependencies(dependsOn.Split(_separators, StringSplitOptions.RemoveEmptyEntries)); } @@ -109,7 +109,7 @@ public static async ValueTask WriteToAsync(List argu resourceManager.RenderLocalStyle(setting, writer); } } - else if (!String.IsNullOrEmpty(name) && String.IsNullOrEmpty(src)) + else if (!string.IsNullOrEmpty(name) && string.IsNullOrEmpty(src)) { // Resource required @@ -137,7 +137,7 @@ public static async ValueTask WriteToAsync(List argu setting.UseCdn(useCdn.Value); } - if (!String.IsNullOrEmpty(condition)) + if (!string.IsNullOrEmpty(condition)) { setting.UseCondition(condition); } @@ -147,7 +147,7 @@ public static async ValueTask WriteToAsync(List argu setting.UseDebugMode(debug.Value); } - if (!String.IsNullOrEmpty(culture)) + if (!string.IsNullOrEmpty(culture)) { setting.UseCulture(culture); } @@ -157,13 +157,13 @@ public static async ValueTask WriteToAsync(List argu setting.ShouldAppendVersion(appendversion); } - if (!String.IsNullOrEmpty(version)) + if (!string.IsNullOrEmpty(version)) { setting.UseVersion(version); } // This allows additions to the pre registered style dependencies. - if (!String.IsNullOrEmpty(dependsOn)) + if (!string.IsNullOrEmpty(dependsOn)) { setting.SetDependencies(dependsOn.Split(_separators, StringSplitOptions.RemoveEmptyEntries)); } @@ -173,7 +173,7 @@ public static async ValueTask WriteToAsync(List argu resourceManager.RenderLocalStyle(setting, writer); } } - else if (!String.IsNullOrEmpty(name) && !String.IsNullOrEmpty(src)) + else if (!string.IsNullOrEmpty(name) && !string.IsNullOrEmpty(src)) { // Inline declaration @@ -188,22 +188,22 @@ public static async ValueTask WriteToAsync(List argu } } - if (!String.IsNullOrEmpty(version)) + if (!string.IsNullOrEmpty(version)) { definition.SetVersion(version); } - if (!String.IsNullOrEmpty(cdnSrc)) + if (!string.IsNullOrEmpty(cdnSrc)) { definition.SetCdn(cdnSrc, debugCdnSrc); } - if (!String.IsNullOrEmpty(culture)) + if (!string.IsNullOrEmpty(culture)) { definition.SetCultures(culture.Split(_separators, StringSplitOptions.RemoveEmptyEntries)); } - if (!String.IsNullOrEmpty(dependsOn)) + if (!string.IsNullOrEmpty(dependsOn)) { definition.SetDependencies(dependsOn.Split(_separators, StringSplitOptions.RemoveEmptyEntries)); } @@ -216,7 +216,7 @@ public static async ValueTask WriteToAsync(List argu setting.UseCdn(useCdn.Value); } - if (!String.IsNullOrEmpty(condition)) + if (!string.IsNullOrEmpty(condition)) { setting.UseCondition(condition); } @@ -226,7 +226,7 @@ public static async ValueTask WriteToAsync(List argu setting.UseDebugMode(debug.Value); } - if (!String.IsNullOrEmpty(culture)) + if (!string.IsNullOrEmpty(culture)) { setting.UseCulture(culture); } diff --git a/src/OrchardCore.Modules/OrchardCore.ReverseProxy/AdminMenu.cs b/src/OrchardCore.Modules/OrchardCore.ReverseProxy/AdminMenu.cs index 0a7a3ef85bd..8d3c8316b14 100644 --- a/src/OrchardCore.Modules/OrchardCore.ReverseProxy/AdminMenu.cs +++ b/src/OrchardCore.Modules/OrchardCore.ReverseProxy/AdminMenu.cs @@ -16,7 +16,7 @@ public AdminMenu(IStringLocalizer localizer) public Task BuildNavigationAsync(string name, NavigationBuilder builder) { - if (String.Equals(name, "admin", StringComparison.OrdinalIgnoreCase)) + if (string.Equals(name, "admin", StringComparison.OrdinalIgnoreCase)) { builder .Add(S["Configuration"], configuration => configuration diff --git a/src/OrchardCore.Modules/OrchardCore.Roles/AdminMenu.cs b/src/OrchardCore.Modules/OrchardCore.Roles/AdminMenu.cs index 235df710dfc..62fabd6f469 100644 --- a/src/OrchardCore.Modules/OrchardCore.Roles/AdminMenu.cs +++ b/src/OrchardCore.Modules/OrchardCore.Roles/AdminMenu.cs @@ -16,7 +16,7 @@ public AdminMenu(IStringLocalizer localizer) public Task BuildNavigationAsync(string name, NavigationBuilder builder) { - if (!String.Equals(name, "admin", StringComparison.OrdinalIgnoreCase)) + if (!string.Equals(name, "admin", StringComparison.OrdinalIgnoreCase)) { return Task.CompletedTask; } diff --git a/src/OrchardCore.Modules/OrchardCore.Roles/Controllers/AdminController.cs b/src/OrchardCore.Modules/OrchardCore.Roles/Controllers/AdminController.cs index 6aef915ccca..7369c58a1af 100644 --- a/src/OrchardCore.Modules/OrchardCore.Roles/Controllers/AdminController.cs +++ b/src/OrchardCore.Modules/OrchardCore.Roles/Controllers/AdminController.cs @@ -96,12 +96,12 @@ public async Task Create(CreateRoleViewModel model) if (model.RoleName.Contains('/')) { - ModelState.AddModelError(String.Empty, S["Invalid role name."]); + ModelState.AddModelError(string.Empty, S["Invalid role name."]); } if (await _roleManager.FindByNameAsync(_roleManager.NormalizeKey(model.RoleName)) != null) { - ModelState.AddModelError(String.Empty, S["The role is already used."]); + ModelState.AddModelError(string.Empty, S["The role is already used."]); } } @@ -119,7 +119,7 @@ public async Task Create(CreateRoleViewModel model) foreach (var error in result.Errors) { - ModelState.AddModelError(String.Empty, error.Description); + ModelState.AddModelError(string.Empty, error.Description); } } @@ -264,12 +264,12 @@ private async Task>> Get private PermissionGroupKey GetGroupKey(IFeatureInfo feature, string category) { - if (!String.IsNullOrWhiteSpace(category)) + if (!string.IsNullOrWhiteSpace(category)) { return new PermissionGroupKey(category, category); } - var title = String.IsNullOrWhiteSpace(feature.Name) ? S["{0} Feature", feature.Id] : feature.Name; + var title = string.IsNullOrWhiteSpace(feature.Name) ? S["{0} Feature", feature.Id] : feature.Name; return new PermissionGroupKey(feature.Id, title) { diff --git a/src/OrchardCore.Modules/OrchardCore.Roles/Properties/AssemblyInfo.cs b/src/OrchardCore.Modules/OrchardCore.Roles/Properties/AssemblyInfo.cs index 7906c602d77..8d0a5522152 100644 --- a/src/OrchardCore.Modules/OrchardCore.Roles/Properties/AssemblyInfo.cs +++ b/src/OrchardCore.Modules/OrchardCore.Roles/Properties/AssemblyInfo.cs @@ -1,4 +1,4 @@ -using System.Reflection; +using System.Reflection; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following diff --git a/src/OrchardCore.Modules/OrchardCore.Roles/Recipes/RolesStep.cs b/src/OrchardCore.Modules/OrchardCore.Roles/Recipes/RolesStep.cs index c500ec0ea7a..e0bc02a9745 100644 --- a/src/OrchardCore.Modules/OrchardCore.Roles/Recipes/RolesStep.cs +++ b/src/OrchardCore.Modules/OrchardCore.Roles/Recipes/RolesStep.cs @@ -23,7 +23,7 @@ public RolesStep(RoleManager roleManager) public async Task ExecuteAsync(RecipeExecutionContext context) { - if (!String.Equals(context.Name, "Roles", StringComparison.OrdinalIgnoreCase)) + if (!string.Equals(context.Name, "Roles", StringComparison.OrdinalIgnoreCase)) { return; } @@ -32,7 +32,7 @@ public async Task ExecuteAsync(RecipeExecutionContext context) foreach (var importedRole in model.Roles) { - if (String.IsNullOrWhiteSpace(importedRole.Name)) + if (string.IsNullOrWhiteSpace(importedRole.Name)) continue; var role = (Role)await _roleManager.FindByNameAsync(importedRole.Name); diff --git a/src/OrchardCore.Modules/OrchardCore.Roles/Services/RoleStore.cs b/src/OrchardCore.Modules/OrchardCore.Roles/Services/RoleStore.cs index a34d8f62932..617e6353668 100644 --- a/src/OrchardCore.Modules/OrchardCore.Roles/Services/RoleStore.cs +++ b/src/OrchardCore.Modules/OrchardCore.Roles/Services/RoleStore.cs @@ -90,8 +90,8 @@ public async Task DeleteAsync(IRole role, CancellationToken canc var roleToRemove = (Role)role; - if (String.Equals(roleToRemove.NormalizedRoleName, "ANONYMOUS") || - String.Equals(roleToRemove.NormalizedRoleName, "AUTHENTICATED")) + if (string.Equals(roleToRemove.NormalizedRoleName, "ANONYMOUS") || + string.Equals(roleToRemove.NormalizedRoleName, "AUTHENTICATED")) { return IdentityResult.Failed(new IdentityError { Description = S["Can't delete system roles."] }); } diff --git a/src/OrchardCore.Modules/OrchardCore.Roles/ViewModels/CreateRoleViewModel.cs b/src/OrchardCore.Modules/OrchardCore.Roles/ViewModels/CreateRoleViewModel.cs index 0cabc2918fd..9e0a534ded9 100644 --- a/src/OrchardCore.Modules/OrchardCore.Roles/ViewModels/CreateRoleViewModel.cs +++ b/src/OrchardCore.Modules/OrchardCore.Roles/ViewModels/CreateRoleViewModel.cs @@ -1,4 +1,4 @@ -using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations; namespace OrchardCore.Roles.ViewModels { diff --git a/src/OrchardCore.Modules/OrchardCore.Roles/ViewModels/PermissionGroupKey.cs b/src/OrchardCore.Modules/OrchardCore.Roles/ViewModels/PermissionGroupKey.cs index ac3a6087547..ed3228c6fb4 100644 --- a/src/OrchardCore.Modules/OrchardCore.Roles/ViewModels/PermissionGroupKey.cs +++ b/src/OrchardCore.Modules/OrchardCore.Roles/ViewModels/PermissionGroupKey.cs @@ -12,7 +12,7 @@ public class PermissionGroupKey public PermissionGroupKey(string key) { - if (String.IsNullOrWhiteSpace(key)) + if (string.IsNullOrWhiteSpace(key)) { throw new ArgumentException("The 'key' cannot be null or empty", nameof(key)); } diff --git a/src/OrchardCore.Modules/OrchardCore.Roles/ViewModels/RolesViewModel.cs b/src/OrchardCore.Modules/OrchardCore.Roles/ViewModels/RolesViewModel.cs index 4cf1751a478..b54e838da23 100644 --- a/src/OrchardCore.Modules/OrchardCore.Roles/ViewModels/RolesViewModel.cs +++ b/src/OrchardCore.Modules/OrchardCore.Roles/ViewModels/RolesViewModel.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; namespace OrchardCore.Roles.ViewModels { diff --git a/src/OrchardCore.Modules/OrchardCore.Rules/Drivers/ContentTypeConditionDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.Rules/Drivers/ContentTypeConditionDisplayDriver.cs index b8edfdc07f0..2b09410cf49 100644 --- a/src/OrchardCore.Modules/OrchardCore.Rules/Drivers/ContentTypeConditionDisplayDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Rules/Drivers/ContentTypeConditionDisplayDriver.cs @@ -46,7 +46,7 @@ public override async Task UpdateAsync(ContentTypeCondition cond if (await updater.TryUpdateModelAsync(model, Prefix)) { condition.Value = model.Value; - if (!String.IsNullOrEmpty(model.SelectedOperation) && _options.Factories.TryGetValue(model.SelectedOperation, out var factory)) + if (!string.IsNullOrEmpty(model.SelectedOperation) && _options.Factories.TryGetValue(model.SelectedOperation, out var factory)) { condition.Operation = factory.Create() as StringOperator; } diff --git a/src/OrchardCore.Modules/OrchardCore.Rules/Drivers/CultureConditionDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.Rules/Drivers/CultureConditionDisplayDriver.cs index 1a7c2ecb63a..9e43e5516c6 100644 --- a/src/OrchardCore.Modules/OrchardCore.Rules/Drivers/CultureConditionDisplayDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Rules/Drivers/CultureConditionDisplayDriver.cs @@ -46,7 +46,7 @@ public override async Task UpdateAsync(CultureCondition conditio if (await updater.TryUpdateModelAsync(model, Prefix)) { condition.Value = model.Value; - if (!String.IsNullOrEmpty(model.SelectedOperation) && _options.Factories.TryGetValue(model.SelectedOperation, out var factory)) + if (!string.IsNullOrEmpty(model.SelectedOperation) && _options.Factories.TryGetValue(model.SelectedOperation, out var factory)) { condition.Operation = factory.Create() as StringOperator; // Set to default. diff --git a/src/OrchardCore.Modules/OrchardCore.Rules/Drivers/RoleConditionDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.Rules/Drivers/RoleConditionDisplayDriver.cs index cbe09c10dca..f24f0a94692 100644 --- a/src/OrchardCore.Modules/OrchardCore.Rules/Drivers/RoleConditionDisplayDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Rules/Drivers/RoleConditionDisplayDriver.cs @@ -46,7 +46,7 @@ public override async Task UpdateAsync(RoleCondition condition, if (await updater.TryUpdateModelAsync(model, Prefix)) { condition.Value = model.Value; - if (!String.IsNullOrEmpty(model.SelectedOperation) && _options.Factories.TryGetValue(model.SelectedOperation, out var factory)) + if (!string.IsNullOrEmpty(model.SelectedOperation) && _options.Factories.TryGetValue(model.SelectedOperation, out var factory)) { condition.Operation = factory.Create() as StringOperator; // Set to default. diff --git a/src/OrchardCore.Modules/OrchardCore.Rules/Drivers/UrlConditionDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.Rules/Drivers/UrlConditionDisplayDriver.cs index a1ddf7e132b..7a5e7e125bf 100644 --- a/src/OrchardCore.Modules/OrchardCore.Rules/Drivers/UrlConditionDisplayDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Rules/Drivers/UrlConditionDisplayDriver.cs @@ -46,7 +46,7 @@ public override async Task UpdateAsync(UrlCondition condition, I if (await updater.TryUpdateModelAsync(model, Prefix)) { condition.Value = model.Value; - if (!String.IsNullOrEmpty(model.SelectedOperation) && _options.Factories.TryGetValue(model.SelectedOperation, out var factory)) + if (!string.IsNullOrEmpty(model.SelectedOperation) && _options.Factories.TryGetValue(model.SelectedOperation, out var factory)) { condition.Operation = factory.Create() as StringOperator; // Set to default. diff --git a/src/OrchardCore.Modules/OrchardCore.Rules/Services/AllConditionEvaluator.cs b/src/OrchardCore.Modules/OrchardCore.Rules/Services/AllConditionEvaluator.cs index a801b15dede..07c7b17ae25 100644 --- a/src/OrchardCore.Modules/OrchardCore.Rules/Services/AllConditionEvaluator.cs +++ b/src/OrchardCore.Modules/OrchardCore.Rules/Services/AllConditionEvaluator.cs @@ -33,4 +33,4 @@ public async override ValueTask EvaluateAsync(AllConditionGroup condition) return false; } } -} \ No newline at end of file +} diff --git a/src/OrchardCore.Modules/OrchardCore.Rules/Services/AnyConditionEvaluator.cs b/src/OrchardCore.Modules/OrchardCore.Rules/Services/AnyConditionEvaluator.cs index 16c7f00196f..3c30f7494d6 100644 --- a/src/OrchardCore.Modules/OrchardCore.Rules/Services/AnyConditionEvaluator.cs +++ b/src/OrchardCore.Modules/OrchardCore.Rules/Services/AnyConditionEvaluator.cs @@ -26,4 +26,4 @@ public async override ValueTask EvaluateAsync(AnyConditionGroup condition) return false; } } -} \ No newline at end of file +} diff --git a/src/OrchardCore.Modules/OrchardCore.Rules/Services/HomepageConditionEvaluator.cs b/src/OrchardCore.Modules/OrchardCore.Rules/Services/HomepageConditionEvaluator.cs index 34be6c9c53c..8a6103cb516 100644 --- a/src/OrchardCore.Modules/OrchardCore.Rules/Services/HomepageConditionEvaluator.cs +++ b/src/OrchardCore.Modules/OrchardCore.Rules/Services/HomepageConditionEvaluator.cs @@ -18,7 +18,7 @@ public override ValueTask EvaluateAsync(HomepageCondition condition) { var requestPath = _httpContextAccessor.HttpContext.Request.Path.Value; - var result = String.Equals("/", requestPath, StringComparison.Ordinal) || String.IsNullOrEmpty(requestPath); + var result = string.Equals("/", requestPath, StringComparison.Ordinal) || string.IsNullOrEmpty(requestPath); if (!condition.Value) { diff --git a/src/OrchardCore.Modules/OrchardCore.Rules/Services/RuleService.cs b/src/OrchardCore.Modules/OrchardCore.Rules/Services/RuleService.cs index 2f0532c5ad1..05d8aaf3c33 100644 --- a/src/OrchardCore.Modules/OrchardCore.Rules/Services/RuleService.cs +++ b/src/OrchardCore.Modules/OrchardCore.Rules/Services/RuleService.cs @@ -32,4 +32,4 @@ public async ValueTask EvaluateAsync(Rule rule) return false; } } -} \ No newline at end of file +} diff --git a/src/OrchardCore.Modules/OrchardCore.Rules/Services/StringOperatorComparer.cs b/src/OrchardCore.Modules/OrchardCore.Rules/Services/StringOperatorComparer.cs index c8b47c0c002..f2990d374e0 100644 --- a/src/OrchardCore.Modules/OrchardCore.Rules/Services/StringOperatorComparer.cs +++ b/src/OrchardCore.Modules/OrchardCore.Rules/Services/StringOperatorComparer.cs @@ -7,16 +7,16 @@ public class StringEqualsOperatorComparer : OperatorComparer conditionOperator.CaseSensitive ? - String.Equals(a, b) : - String.Equals(a, b, StringComparison.OrdinalIgnoreCase); + string.Equals(a, b) : + string.Equals(a, b, StringComparison.OrdinalIgnoreCase); } public class StringNotEqualsOperatorComparer : OperatorComparer { public override bool Compare(StringOperator conditionOperator, string a, string b) => conditionOperator.CaseSensitive ? - !String.Equals(a, b) : - !String.Equals(a, b, StringComparison.OrdinalIgnoreCase); + !string.Equals(a, b) : + !string.Equals(a, b, StringComparison.OrdinalIgnoreCase); } public class StringStartsWithOperatorComparer : OperatorComparer diff --git a/src/OrchardCore.Modules/OrchardCore.Rules/Services/UrlConditionEvaluator.cs b/src/OrchardCore.Modules/OrchardCore.Rules/Services/UrlConditionEvaluator.cs index 52bf58ceb40..6d663b3fae1 100644 --- a/src/OrchardCore.Modules/OrchardCore.Rules/Services/UrlConditionEvaluator.cs +++ b/src/OrchardCore.Modules/OrchardCore.Rules/Services/UrlConditionEvaluator.cs @@ -27,7 +27,7 @@ public override ValueTask EvaluateAsync(UrlCondition condition) // Tenant home page could have an empty string as a request path, where // the default tenant does not. - if (String.IsNullOrEmpty(requestPath)) + if (string.IsNullOrEmpty(requestPath)) { requestPath = "/"; } diff --git a/src/OrchardCore.Modules/OrchardCore.Rules/ViewComponents/SelectStringOperationViewComponent.cs b/src/OrchardCore.Modules/OrchardCore.Rules/ViewComponents/SelectStringOperationViewComponent.cs index e241c0dc2be..dce865427a9 100644 --- a/src/OrchardCore.Modules/OrchardCore.Rules/ViewComponents/SelectStringOperationViewComponent.cs +++ b/src/OrchardCore.Modules/OrchardCore.Rules/ViewComponents/SelectStringOperationViewComponent.cs @@ -28,7 +28,7 @@ public IViewComponentResult Invoke(string selectedOperation, string htmlName) new SelectListItem( x.DisplayText(_serviceProvider), x.Operator.Name, - String.Equals(x.Factory.Name, selectedOperation, StringComparison.OrdinalIgnoreCase)) + string.Equals(x.Factory.Name, selectedOperation, StringComparison.OrdinalIgnoreCase)) ).ToList(); var model = new SelectStringOperationViewModel diff --git a/src/OrchardCore.Modules/OrchardCore.Scripting/Properties/AssemblyInfo.cs b/src/OrchardCore.Modules/OrchardCore.Scripting/Properties/AssemblyInfo.cs index 0bc36381619..b8e9281b53e 100644 --- a/src/OrchardCore.Modules/OrchardCore.Scripting/Properties/AssemblyInfo.cs +++ b/src/OrchardCore.Modules/OrchardCore.Scripting/Properties/AssemblyInfo.cs @@ -1,4 +1,4 @@ -using System.Reflection; +using System.Reflection; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following diff --git a/src/OrchardCore.Modules/OrchardCore.Search.Elasticsearch/AdminMenu.cs b/src/OrchardCore.Modules/OrchardCore.Search.Elasticsearch/AdminMenu.cs index de1ce10dce7..be180cbc52d 100644 --- a/src/OrchardCore.Modules/OrchardCore.Search.Elasticsearch/AdminMenu.cs +++ b/src/OrchardCore.Modules/OrchardCore.Search.Elasticsearch/AdminMenu.cs @@ -17,7 +17,7 @@ public AdminMenu(IStringLocalizer localizer) public Task BuildNavigationAsync(string name, NavigationBuilder builder) { - if (!String.Equals(name, "admin", StringComparison.OrdinalIgnoreCase)) + if (!string.Equals(name, "admin", StringComparison.OrdinalIgnoreCase)) { return Task.CompletedTask; } diff --git a/src/OrchardCore.Modules/OrchardCore.Search.Elasticsearch/Controllers/AdminController.cs b/src/OrchardCore.Modules/OrchardCore.Search.Elasticsearch/Controllers/AdminController.cs index 06a2c8887a9..812da45789a 100644 --- a/src/OrchardCore.Modules/OrchardCore.Search.Elasticsearch/Controllers/AdminController.cs +++ b/src/OrchardCore.Modules/OrchardCore.Search.Elasticsearch/Controllers/AdminController.cs @@ -105,7 +105,7 @@ public async Task Index(ContentOptions options, PagerParameters p var count = indexes.Count(); var results = indexes; - if (!String.IsNullOrWhiteSpace(options.Search)) + if (!string.IsNullOrWhiteSpace(options.Search)) { results = results.Where(q => q.Name.Contains(options.Search, StringComparison.OrdinalIgnoreCase)); } @@ -145,7 +145,7 @@ public ActionResult IndexFilterPOST(AdminIndexViewModel model) public async Task Edit(string indexName = null) { - var IsCreate = String.IsNullOrWhiteSpace(indexName); + var IsCreate = string.IsNullOrWhiteSpace(indexName); var settings = new ElasticIndexSettings(); if (!await _authorizationService.AuthorizeAsync(User, Permissions.ManageElasticIndexes)) @@ -229,7 +229,7 @@ public async Task EditPost(ElasticIndexSettingsViewModel model, st QueryAnalyzerName = model.AnalyzerName, IndexLatest = model.IndexLatest, IndexedContentTypes = indexedContentTypes, - Culture = model.Culture ?? String.Empty, + Culture = model.Culture ?? string.Empty, StoreSourceData = model.StoreSourceData }; @@ -256,7 +256,7 @@ public async Task EditPost(ElasticIndexSettingsViewModel model, st AnalyzerName = model.AnalyzerName, IndexLatest = model.IndexLatest, IndexedContentTypes = indexedContentTypes, - Culture = model.Culture ?? String.Empty, + Culture = model.Culture ?? string.Empty, StoreSourceData = model.StoreSourceData }; @@ -406,7 +406,7 @@ public async Task SyncSettings() public Task Query(string indexName, string query) { - query = String.IsNullOrWhiteSpace(query) ? String.Empty : System.Text.Encoding.UTF8.GetString(Convert.FromBase64String(query)); + query = string.IsNullOrWhiteSpace(query) ? string.Empty : System.Text.Encoding.UTF8.GetString(Convert.FromBase64String(query)); return Query(new AdminQueryViewModel { IndexName = indexName, @@ -430,7 +430,7 @@ public async Task Query(AdminQueryViewModel model) return RedirectToAction("Index"); } - if (String.IsNullOrEmpty(model.IndexName)) + if (string.IsNullOrEmpty(model.IndexName)) { model.IndexName = model.Indices[0]; } @@ -440,12 +440,12 @@ public async Task Query(AdminQueryViewModel model) return NotFound(); } - if (String.IsNullOrWhiteSpace(model.DecodedQuery)) + if (string.IsNullOrWhiteSpace(model.DecodedQuery)) { return View(model); } - if (String.IsNullOrEmpty(model.Parameters)) + if (string.IsNullOrEmpty(model.Parameters)) { model.Parameters = "{ }"; } @@ -545,7 +545,7 @@ private void ValidateModel(ElasticIndexSettingsViewModel model) ModelState.AddModelError(nameof(ElasticIndexSettingsViewModel.IndexedContentTypes), S["At least one content type selection is required."]); } - if (String.IsNullOrWhiteSpace(model.IndexName)) + if (string.IsNullOrWhiteSpace(model.IndexName)) { ModelState.AddModelError(nameof(ElasticIndexSettingsViewModel.IndexName), S["The index name is required."]); } diff --git a/src/OrchardCore.Modules/OrchardCore.Search.Elasticsearch/Drivers/ContentPickerFieldElasticEditorSettingsDriver.cs b/src/OrchardCore.Modules/OrchardCore.Search.Elasticsearch/Drivers/ContentPickerFieldElasticEditorSettingsDriver.cs index ed79390cbee..db6e8adb42c 100644 --- a/src/OrchardCore.Modules/OrchardCore.Search.Elasticsearch/Drivers/ContentPickerFieldElasticEditorSettingsDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Search.Elasticsearch/Drivers/ContentPickerFieldElasticEditorSettingsDriver.cs @@ -43,7 +43,7 @@ public override async Task UpdateAsync(ContentPartFieldDefinitio public override bool CanHandleModel(ContentPartFieldDefinition model) { - return String.Equals("ContentPickerField", model.FieldDefinition.Name); + return string.Equals("ContentPickerField", model.FieldDefinition.Name); } } } diff --git a/src/OrchardCore.Modules/OrchardCore.Search.Elasticsearch/Drivers/ElasticQueryDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.Search.Elasticsearch/Drivers/ElasticQueryDisplayDriver.cs index e87bf7ae8dd..37aa78884bf 100644 --- a/src/OrchardCore.Modules/OrchardCore.Search.Elasticsearch/Drivers/ElasticQueryDisplayDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Search.Elasticsearch/Drivers/ElasticQueryDisplayDriver.cs @@ -43,7 +43,7 @@ public override IDisplayResult Edit(ElasticQuery query, IUpdateModel updater) model.Indices = (await _elasticIndexSettingsService.GetSettingsAsync()).Select(x => x.IndexName).ToArray(); // Extract query from the query string if we come from the main query editor - if (String.IsNullOrEmpty(query.Template)) + if (string.IsNullOrEmpty(query.Template)) { await updater.TryUpdateModelAsync(model, "", m => m.Query); } @@ -60,12 +60,12 @@ public override async Task UpdateAsync(ElasticQuery model, IUpda model.ReturnContentItems = viewModel.ReturnContentItems; } - if (String.IsNullOrWhiteSpace(model.Template)) + if (string.IsNullOrWhiteSpace(model.Template)) { updater.ModelState.AddModelError(nameof(model.Template), S["The query field is required"]); } - if (String.IsNullOrWhiteSpace(model.Index)) + if (string.IsNullOrWhiteSpace(model.Index)) { updater.ModelState.AddModelError(nameof(model.Index), S["The index field is required"]); } diff --git a/src/OrchardCore.Modules/OrchardCore.Search.Elasticsearch/Drivers/ElasticSettingsDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.Search.Elasticsearch/Drivers/ElasticSettingsDisplayDriver.cs index 40b71391658..869bea6bdf0 100644 --- a/src/OrchardCore.Modules/OrchardCore.Search.Elasticsearch/Drivers/ElasticSettingsDisplayDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Search.Elasticsearch/Drivers/ElasticSettingsDisplayDriver.cs @@ -43,7 +43,7 @@ public override async Task EditAsync(ElasticSettings settings, B return Initialize("ElasticSettings_Edit", async model => { model.SearchIndex = settings.SearchIndex; - model.SearchFields = String.Join(", ", settings.DefaultSearchFields ?? Array.Empty()); + model.SearchFields = string.Join(", ", settings.DefaultSearchFields ?? Array.Empty()); model.SearchIndexes = (await _elasticIndexSettingsService.GetSettingsAsync()).Select(x => x.IndexName); model.AllowElasticQueryStringQueryInSearch = settings.AllowElasticQueryStringQueryInSearch; }).Location("Content:2").OnGroup(GroupId); diff --git a/src/OrchardCore.Modules/OrchardCore.Search.Elasticsearch/ElasticsearchIndexPermissionHelper.cs b/src/OrchardCore.Modules/OrchardCore.Search.Elasticsearch/ElasticsearchIndexPermissionHelper.cs index ca3b49cec51..3bdd5210b0b 100644 --- a/src/OrchardCore.Modules/OrchardCore.Search.Elasticsearch/ElasticsearchIndexPermissionHelper.cs +++ b/src/OrchardCore.Modules/OrchardCore.Search.Elasticsearch/ElasticsearchIndexPermissionHelper.cs @@ -14,7 +14,7 @@ public class ElasticsearchIndexPermissionHelper public static Permission GetElasticIndexPermission(string indexName) { - if (String.IsNullOrEmpty(indexName)) + if (string.IsNullOrEmpty(indexName)) { throw new ArgumentException($"{nameof(indexName)} cannot be null or empty"); } @@ -22,8 +22,8 @@ public static Permission GetElasticIndexPermission(string indexName) if (!_permissions.TryGetValue(indexName, out var permission)) { permission = new Permission( - String.Format(_indexPermissionTemplate.Name, indexName), - String.Format(_indexPermissionTemplate.Description, indexName), + string.Format(_indexPermissionTemplate.Name, indexName), + string.Format(_indexPermissionTemplate.Description, indexName), _indexPermissionTemplate.ImpliedBy ); diff --git a/src/OrchardCore.Modules/OrchardCore.Search.Elasticsearch/GraphQL/ElasticQueryFieldTypeProvider.cs b/src/OrchardCore.Modules/OrchardCore.Search.Elasticsearch/GraphQL/ElasticQueryFieldTypeProvider.cs index 95818492886..e5ce04b67ab 100644 --- a/src/OrchardCore.Modules/OrchardCore.Search.Elasticsearch/GraphQL/ElasticQueryFieldTypeProvider.cs +++ b/src/OrchardCore.Modules/OrchardCore.Search.Elasticsearch/GraphQL/ElasticQueryFieldTypeProvider.cs @@ -42,7 +42,7 @@ public async Task BuildAsync(ISchema schema) foreach (var query in queries.OfType()) { - if (String.IsNullOrWhiteSpace(query.Schema)) + if (string.IsNullOrWhiteSpace(query.Schema)) continue; var name = query.Name; diff --git a/src/OrchardCore.Modules/OrchardCore.Search.Elasticsearch/Handlers/ElasticsearchAuthorizationHandler.cs b/src/OrchardCore.Modules/OrchardCore.Search.Elasticsearch/Handlers/ElasticsearchAuthorizationHandler.cs index 593b995861a..e402f2921ef 100644 --- a/src/OrchardCore.Modules/OrchardCore.Search.Elasticsearch/Handlers/ElasticsearchAuthorizationHandler.cs +++ b/src/OrchardCore.Modules/OrchardCore.Search.Elasticsearch/Handlers/ElasticsearchAuthorizationHandler.cs @@ -47,7 +47,7 @@ protected override async Task HandleRequirementAsync(AuthorizationHandlerContext var indexName = await GetIndexNameAsync(parameters); - if (!String.IsNullOrEmpty(indexName)) + if (!string.IsNullOrEmpty(indexName)) { _authorizationService ??= _serviceProvider?.GetService(); @@ -64,7 +64,7 @@ protected override async Task HandleRequirementAsync(AuthorizationHandlerContext private async Task GetIndexNameAsync(SearchPermissionParameters parameters) { - if (!String.IsNullOrWhiteSpace(parameters.IndexName)) + if (!string.IsNullOrWhiteSpace(parameters.IndexName)) { return parameters.IndexName.Trim(); } diff --git a/src/OrchardCore.Modules/OrchardCore.Search.Elasticsearch/Services/ElasticSearchService.cs b/src/OrchardCore.Modules/OrchardCore.Search.Elasticsearch/Services/ElasticSearchService.cs index 18690d0fdbf..32a03be3032 100644 --- a/src/OrchardCore.Modules/OrchardCore.Search.Elasticsearch/Services/ElasticSearchService.cs +++ b/src/OrchardCore.Modules/OrchardCore.Search.Elasticsearch/Services/ElasticSearchService.cs @@ -37,7 +37,7 @@ ILogger logger public async Task SearchAsync(string indexName, string term, int start, int pageSize) { - var index = !String.IsNullOrWhiteSpace(indexName) ? indexName.Trim() : await DefaultIndexAsync(); + var index = !string.IsNullOrWhiteSpace(indexName) ? indexName.Trim() : await DefaultIndexAsync(); var result = new SearchResult(); diff --git a/src/OrchardCore.Modules/OrchardCore.Search.Elasticsearch/Startup.cs b/src/OrchardCore.Modules/OrchardCore.Search.Elasticsearch/Startup.cs index a4f1f84f6c9..b11bb653db8 100644 --- a/src/OrchardCore.Modules/OrchardCore.Search.Elasticsearch/Startup.cs +++ b/src/OrchardCore.Modules/OrchardCore.Search.Elasticsearch/Startup.cs @@ -76,7 +76,7 @@ public override void ConfigureServices(IServiceCollection services) case "CloudConnectionPool": BasicAuthenticationCredentials credentials = null; - if (!String.IsNullOrWhiteSpace(elasticConfiguration.Username) && !String.IsNullOrWhiteSpace(elasticConfiguration.Password) && !String.IsNullOrWhiteSpace(elasticConfiguration.CloudId)) + if (!string.IsNullOrWhiteSpace(elasticConfiguration.Username) && !string.IsNullOrWhiteSpace(elasticConfiguration.Password) && !string.IsNullOrWhiteSpace(elasticConfiguration.CloudId)) { credentials = new BasicAuthenticationCredentials(elasticConfiguration.Username, elasticConfiguration.Password); pool = new CloudConnectionPool(elasticConfiguration.CloudId, credentials); @@ -102,12 +102,12 @@ public override void ConfigureServices(IServiceCollection services) var settings = new ConnectionSettings(pool).ThrowExceptions(); - if (elasticConfiguration.ConnectionType != "CloudConnectionPool" && !String.IsNullOrWhiteSpace(elasticConfiguration.Username) && !String.IsNullOrWhiteSpace(elasticConfiguration.Password)) + if (elasticConfiguration.ConnectionType != "CloudConnectionPool" && !string.IsNullOrWhiteSpace(elasticConfiguration.Username) && !string.IsNullOrWhiteSpace(elasticConfiguration.Password)) { settings.BasicAuthentication(elasticConfiguration.Username, elasticConfiguration.Password); } - if (!String.IsNullOrWhiteSpace(elasticConfiguration.CertificateFingerprint)) + if (!string.IsNullOrWhiteSpace(elasticConfiguration.CertificateFingerprint)) { settings.CertificateFingerprint(elasticConfiguration.CertificateFingerprint); } @@ -247,7 +247,7 @@ private static bool CheckOptions(ElasticConnectionOptions elasticConnectionOptio return false; } - if (String.IsNullOrWhiteSpace(elasticConnectionOptions.Url)) + if (string.IsNullOrWhiteSpace(elasticConnectionOptions.Url)) { logger.LogError("Elasticsearch is enabled but not active because the 'Url' is missing or empty in application configuration."); optionsAreValid = false; diff --git a/src/OrchardCore.Modules/OrchardCore.Search.Lucene/AdminMenu.cs b/src/OrchardCore.Modules/OrchardCore.Search.Lucene/AdminMenu.cs index d61bfe44ccc..82be44b0d40 100644 --- a/src/OrchardCore.Modules/OrchardCore.Search.Lucene/AdminMenu.cs +++ b/src/OrchardCore.Modules/OrchardCore.Search.Lucene/AdminMenu.cs @@ -17,7 +17,7 @@ public AdminMenu(IStringLocalizer localizer) public Task BuildNavigationAsync(string name, NavigationBuilder builder) { - if (!String.Equals(name, "admin", StringComparison.OrdinalIgnoreCase)) + if (!string.Equals(name, "admin", StringComparison.OrdinalIgnoreCase)) { return Task.CompletedTask; } diff --git a/src/OrchardCore.Modules/OrchardCore.Search.Lucene/Controllers/AdminController.cs b/src/OrchardCore.Modules/OrchardCore.Search.Lucene/Controllers/AdminController.cs index 4badde368c0..90f05f36447 100644 --- a/src/OrchardCore.Modules/OrchardCore.Search.Lucene/Controllers/AdminController.cs +++ b/src/OrchardCore.Modules/OrchardCore.Search.Lucene/Controllers/AdminController.cs @@ -104,7 +104,7 @@ public async Task Index(ContentOptions options, PagerParameters p var count = indexes.Count(); var results = indexes; - if (!String.IsNullOrWhiteSpace(options.Search)) + if (!string.IsNullOrWhiteSpace(options.Search)) { results = results.Where(q => q.Name.Contains(options.Search, StringComparison.OrdinalIgnoreCase)); } @@ -144,7 +144,7 @@ public ActionResult IndexFilterPOST(AdminIndexViewModel model) public async Task Edit(string indexName = null) { - var IsCreate = String.IsNullOrWhiteSpace(indexName); + var IsCreate = string.IsNullOrWhiteSpace(indexName); var settings = new LuceneIndexSettings(); if (!await _authorizationService.AuthorizeAsync(User, Permissions.ManageLuceneIndexes)) @@ -343,7 +343,7 @@ public async Task Delete(LuceneIndexSettingsViewModel model) public Task Query(string indexName, string query) { - query = String.IsNullOrWhiteSpace(query) ? "" : System.Text.Encoding.UTF8.GetString(Convert.FromBase64String(query)); + query = string.IsNullOrWhiteSpace(query) ? "" : System.Text.Encoding.UTF8.GetString(Convert.FromBase64String(query)); return Query(new AdminQueryViewModel { IndexName = indexName, DecodedQuery = query }); } @@ -363,7 +363,7 @@ public async Task Query(AdminQueryViewModel model) return RedirectToAction(nameof(Index)); } - if (String.IsNullOrEmpty(model.IndexName)) + if (string.IsNullOrEmpty(model.IndexName)) { model.IndexName = model.Indices[0]; } @@ -373,12 +373,12 @@ public async Task Query(AdminQueryViewModel model) return NotFound(); } - if (String.IsNullOrWhiteSpace(model.DecodedQuery)) + if (string.IsNullOrWhiteSpace(model.DecodedQuery)) { return View(model); } - if (String.IsNullOrEmpty(model.Parameters)) + if (string.IsNullOrEmpty(model.Parameters)) { model.Parameters = "{ }"; } @@ -486,7 +486,7 @@ private void ValidateModel(LuceneIndexSettingsViewModel model) ModelState.AddModelError(nameof(LuceneIndexSettingsViewModel.IndexedContentTypes), S["At least one content type selection is required."]); } - if (String.IsNullOrWhiteSpace(model.IndexName)) + if (string.IsNullOrWhiteSpace(model.IndexName)) { ModelState.AddModelError(nameof(LuceneIndexSettingsViewModel.IndexName), S["The index name is required."]); } diff --git a/src/OrchardCore.Modules/OrchardCore.Search.Lucene/Drivers/LuceneQueryDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.Search.Lucene/Drivers/LuceneQueryDisplayDriver.cs index 3cbcc0c29d3..0852b24f499 100644 --- a/src/OrchardCore.Modules/OrchardCore.Search.Lucene/Drivers/LuceneQueryDisplayDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Search.Lucene/Drivers/LuceneQueryDisplayDriver.cs @@ -41,7 +41,7 @@ public override IDisplayResult Edit(LuceneQuery query, IUpdateModel updater) model.Indices = (await _luceneIndexSettingsService.GetSettingsAsync()).Select(x => x.IndexName).ToArray(); // Extract query from the query string if we come from the main query editor - if (String.IsNullOrEmpty(query.Template)) + if (string.IsNullOrEmpty(query.Template)) { await updater.TryUpdateModelAsync(model, "", m => m.Query); } @@ -58,12 +58,12 @@ public override async Task UpdateAsync(LuceneQuery model, IUpdat model.ReturnContentItems = viewModel.ReturnContentItems; } - if (String.IsNullOrWhiteSpace(model.Template)) + if (string.IsNullOrWhiteSpace(model.Template)) { updater.ModelState.AddModelError(nameof(model.Template), S["The query field is required"]); } - if (String.IsNullOrWhiteSpace(model.Index)) + if (string.IsNullOrWhiteSpace(model.Index)) { updater.ModelState.AddModelError(nameof(model.Index), S["The index field is required"]); } diff --git a/src/OrchardCore.Modules/OrchardCore.Search.Lucene/Drivers/LuceneSettingsDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.Search.Lucene/Drivers/LuceneSettingsDisplayDriver.cs index ed7b4994c5f..54fb3e9af86 100644 --- a/src/OrchardCore.Modules/OrchardCore.Search.Lucene/Drivers/LuceneSettingsDisplayDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Search.Lucene/Drivers/LuceneSettingsDisplayDriver.cs @@ -42,7 +42,7 @@ public override async Task EditAsync(LuceneSettings settings, Bu return Initialize("LuceneSettings_Edit", async model => { model.SearchIndex = settings.SearchIndex; - model.SearchFields = String.Join(", ", settings.DefaultSearchFields ?? Array.Empty()); + model.SearchFields = string.Join(", ", settings.DefaultSearchFields ?? Array.Empty()); model.SearchIndexes = (await _luceneIndexSettingsService.GetSettingsAsync()).Select(x => x.IndexName); model.AllowLuceneQueriesInSearch = settings.AllowLuceneQueriesInSearch; }).Location("Content:2").OnGroup(GroupId); diff --git a/src/OrchardCore.Modules/OrchardCore.Search.Lucene/GraphQL/LuceneQueryFieldTypeProvider.cs b/src/OrchardCore.Modules/OrchardCore.Search.Lucene/GraphQL/LuceneQueryFieldTypeProvider.cs index 53c9b8f7d5a..9815739b37f 100644 --- a/src/OrchardCore.Modules/OrchardCore.Search.Lucene/GraphQL/LuceneQueryFieldTypeProvider.cs +++ b/src/OrchardCore.Modules/OrchardCore.Search.Lucene/GraphQL/LuceneQueryFieldTypeProvider.cs @@ -41,7 +41,7 @@ public async Task BuildAsync(ISchema schema) foreach (var query in queries.OfType()) { - if (String.IsNullOrWhiteSpace(query.Schema)) + if (string.IsNullOrWhiteSpace(query.Schema)) continue; var name = query.Name; diff --git a/src/OrchardCore.Modules/OrchardCore.Search.Lucene/Handler/LuceneAuthorizationHandler.cs b/src/OrchardCore.Modules/OrchardCore.Search.Lucene/Handler/LuceneAuthorizationHandler.cs index eba39ce27a1..5f7441515b1 100644 --- a/src/OrchardCore.Modules/OrchardCore.Search.Lucene/Handler/LuceneAuthorizationHandler.cs +++ b/src/OrchardCore.Modules/OrchardCore.Search.Lucene/Handler/LuceneAuthorizationHandler.cs @@ -46,7 +46,7 @@ protected override async Task HandleRequirementAsync(AuthorizationHandlerContext var indexName = await GetIndexNameAsync(parameters); - if (!String.IsNullOrEmpty(indexName)) + if (!string.IsNullOrEmpty(indexName)) { _authorizationService ??= _serviceProvider?.GetService(); @@ -63,7 +63,7 @@ protected override async Task HandleRequirementAsync(AuthorizationHandlerContext private async Task GetIndexNameAsync(SearchPermissionParameters parameters) { - if (!String.IsNullOrWhiteSpace(parameters.IndexName)) + if (!string.IsNullOrWhiteSpace(parameters.IndexName)) { return parameters.IndexName.Trim(); } diff --git a/src/OrchardCore.Modules/OrchardCore.Search.Lucene/LuceneIndexPermissionHelper.cs b/src/OrchardCore.Modules/OrchardCore.Search.Lucene/LuceneIndexPermissionHelper.cs index b85161f7b70..deb621ffac4 100644 --- a/src/OrchardCore.Modules/OrchardCore.Search.Lucene/LuceneIndexPermissionHelper.cs +++ b/src/OrchardCore.Modules/OrchardCore.Search.Lucene/LuceneIndexPermissionHelper.cs @@ -14,7 +14,7 @@ public class LuceneIndexPermissionHelper public static Permission GetLuceneIndexPermission(string indexName) { - if (String.IsNullOrEmpty(indexName)) + if (string.IsNullOrEmpty(indexName)) { throw new ArgumentException($"{nameof(indexName)} cannot be null or empty"); } @@ -22,8 +22,8 @@ public static Permission GetLuceneIndexPermission(string indexName) if (!_permissions.TryGetValue(indexName, out var permission)) { permission = new Permission( - String.Format(_indexPermissionTemplate.Name, indexName), - String.Format(_indexPermissionTemplate.Description, indexName), + string.Format(_indexPermissionTemplate.Name, indexName), + string.Format(_indexPermissionTemplate.Description, indexName), _indexPermissionTemplate.ImpliedBy ); diff --git a/src/OrchardCore.Modules/OrchardCore.Search.Lucene/Recipes/LuceneIndexRebuildStep.cs b/src/OrchardCore.Modules/OrchardCore.Search.Lucene/Recipes/LuceneIndexRebuildStep.cs index b8533a6b1f8..dd1b476f1de 100644 --- a/src/OrchardCore.Modules/OrchardCore.Search.Lucene/Recipes/LuceneIndexRebuildStep.cs +++ b/src/OrchardCore.Modules/OrchardCore.Search.Lucene/Recipes/LuceneIndexRebuildStep.cs @@ -15,7 +15,7 @@ public class LuceneIndexRebuildStep : IRecipeStepHandler { public async Task ExecuteAsync(RecipeExecutionContext context) { - if (!String.Equals(context.Name, "lucene-index-rebuild", StringComparison.OrdinalIgnoreCase)) + if (!string.Equals(context.Name, "lucene-index-rebuild", StringComparison.OrdinalIgnoreCase)) { return; } diff --git a/src/OrchardCore.Modules/OrchardCore.Search.Lucene/Recipes/LuceneIndexResetStep.cs b/src/OrchardCore.Modules/OrchardCore.Search.Lucene/Recipes/LuceneIndexResetStep.cs index 792c96975e5..ab4fffae74f 100644 --- a/src/OrchardCore.Modules/OrchardCore.Search.Lucene/Recipes/LuceneIndexResetStep.cs +++ b/src/OrchardCore.Modules/OrchardCore.Search.Lucene/Recipes/LuceneIndexResetStep.cs @@ -15,7 +15,7 @@ public class LuceneIndexResetStep : IRecipeStepHandler { public async Task ExecuteAsync(RecipeExecutionContext context) { - if (!String.Equals(context.Name, "lucene-index-reset", StringComparison.OrdinalIgnoreCase)) + if (!string.Equals(context.Name, "lucene-index-reset", StringComparison.OrdinalIgnoreCase)) { return; } diff --git a/src/OrchardCore.Modules/OrchardCore.Search.Lucene/Recipes/LuceneIndexStep.cs b/src/OrchardCore.Modules/OrchardCore.Search.Lucene/Recipes/LuceneIndexStep.cs index b63d96b55d4..dc2dec2d0fb 100644 --- a/src/OrchardCore.Modules/OrchardCore.Search.Lucene/Recipes/LuceneIndexStep.cs +++ b/src/OrchardCore.Modules/OrchardCore.Search.Lucene/Recipes/LuceneIndexStep.cs @@ -28,7 +28,7 @@ LuceneIndexManager luceneIndexManager public async Task ExecuteAsync(RecipeExecutionContext context) { - if (!String.Equals(context.Name, "lucene-index", StringComparison.OrdinalIgnoreCase)) + if (!string.Equals(context.Name, "lucene-index", StringComparison.OrdinalIgnoreCase)) { return; } diff --git a/src/OrchardCore.Modules/OrchardCore.Search.Lucene/Services/LuceneContentPickerResultProvider.cs b/src/OrchardCore.Modules/OrchardCore.Search.Lucene/Services/LuceneContentPickerResultProvider.cs index bb679792d71..6d2b5707f15 100644 --- a/src/OrchardCore.Modules/OrchardCore.Search.Lucene/Services/LuceneContentPickerResultProvider.cs +++ b/src/OrchardCore.Modules/OrchardCore.Search.Lucene/Services/LuceneContentPickerResultProvider.cs @@ -26,7 +26,7 @@ public async Task> Search(ContentPickerSearchCo var fieldSettings = searchContext.PartFieldDefinition?.GetSettings(); - if (!String.IsNullOrWhiteSpace(fieldSettings?.Index)) + if (!string.IsNullOrWhiteSpace(fieldSettings?.Index)) { indexName = fieldSettings.Index; } @@ -42,7 +42,7 @@ await _luceneIndexManager.SearchAsync(indexName, searcher => { Query query = null; - if (String.IsNullOrWhiteSpace(searchContext.Query)) + if (string.IsNullOrWhiteSpace(searchContext.Query)) { query = new MatchAllDocsQuery(); } diff --git a/src/OrchardCore.Modules/OrchardCore.Search.Lucene/Services/LuceneIndexManager.cs b/src/OrchardCore.Modules/OrchardCore.Search.Lucene/Services/LuceneIndexManager.cs index a467e1b1653..13b7cb8fcee 100644 --- a/src/OrchardCore.Modules/OrchardCore.Search.Lucene/Services/LuceneIndexManager.cs +++ b/src/OrchardCore.Modules/OrchardCore.Search.Lucene/Services/LuceneIndexManager.cs @@ -130,7 +130,7 @@ public void DeleteIndex(string indexName) public bool Exists(string indexName) { - if (String.IsNullOrWhiteSpace(indexName)) + if (string.IsNullOrWhiteSpace(indexName)) { return false; } @@ -261,7 +261,7 @@ private Document CreateLuceneDocument(DocumentIndex documentIndex, LuceneIndexSe break; case DocumentIndex.Types.Integer: - if (entry.Value != null && Int64.TryParse(entry.Value.ToString(), out var value)) + if (entry.Value != null && long.TryParse(entry.Value.ToString(), out var value)) { doc.Add(new Int64Field(entry.Name, value, store)); @@ -294,7 +294,7 @@ private Document CreateLuceneDocument(DocumentIndex documentIndex, LuceneIndexSe break; case DocumentIndex.Types.Text: - if (entry.Value != null && !String.IsNullOrEmpty(Convert.ToString(entry.Value))) + if (entry.Value != null && !string.IsNullOrEmpty(Convert.ToString(entry.Value))) { var stringValue = Convert.ToString(entry.Value); diff --git a/src/OrchardCore.Modules/OrchardCore.Search.Lucene/Services/LuceneIndexingService.cs b/src/OrchardCore.Modules/OrchardCore.Search.Lucene/Services/LuceneIndexingService.cs index aa9791a78d7..cb66f585709 100644 --- a/src/OrchardCore.Modules/OrchardCore.Search.Lucene/Services/LuceneIndexingService.cs +++ b/src/OrchardCore.Modules/OrchardCore.Search.Lucene/Services/LuceneIndexingService.cs @@ -56,10 +56,10 @@ public async Task ProcessContentItemsAsync(string indexName = default) { // TODO: Lock over the filesystem in case two instances get a command to rebuild the index concurrently. var allIndices = new Dictionary(); - var lastTaskId = Int64.MaxValue; + var lastTaskId = long.MaxValue; IEnumerable indexSettingsList = null; - if (String.IsNullOrEmpty(indexName)) + if (string.IsNullOrEmpty(indexName)) { indexSettingsList = await _luceneIndexSettingsService.GetSettingsAsync(); diff --git a/src/OrchardCore.Modules/OrchardCore.Search.Lucene/Services/LuceneSearchService.cs b/src/OrchardCore.Modules/OrchardCore.Search.Lucene/Services/LuceneSearchService.cs index 53752abd336..369c7f57fcd 100644 --- a/src/OrchardCore.Modules/OrchardCore.Search.Lucene/Services/LuceneSearchService.cs +++ b/src/OrchardCore.Modules/OrchardCore.Search.Lucene/Services/LuceneSearchService.cs @@ -41,7 +41,7 @@ public LuceneSearchService( public async Task SearchAsync(string indexName, string term, int start, int size) { - var index = !String.IsNullOrWhiteSpace(indexName) ? indexName.Trim() : await DefaultIndexAsync(); + var index = !string.IsNullOrWhiteSpace(indexName) ? indexName.Trim() : await DefaultIndexAsync(); var result = new SearchResult(); diff --git a/src/OrchardCore.Modules/OrchardCore.Search.Lucene/Settings/ContentPickerFieldLuceneEditorSettingsDriver.cs b/src/OrchardCore.Modules/OrchardCore.Search.Lucene/Settings/ContentPickerFieldLuceneEditorSettingsDriver.cs index d2a433db611..f0da853fcc0 100644 --- a/src/OrchardCore.Modules/OrchardCore.Search.Lucene/Settings/ContentPickerFieldLuceneEditorSettingsDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Search.Lucene/Settings/ContentPickerFieldLuceneEditorSettingsDriver.cs @@ -41,7 +41,7 @@ public override async Task UpdateAsync(ContentPartFieldDefinitio public override bool CanHandleModel(ContentPartFieldDefinition model) { - return String.Equals("ContentPickerField", model.FieldDefinition.Name); + return string.Equals("ContentPickerField", model.FieldDefinition.Name); } } } diff --git a/src/OrchardCore.Modules/OrchardCore.Search/AdminMenu.cs b/src/OrchardCore.Modules/OrchardCore.Search/AdminMenu.cs index a67ab5da961..3e24843a234 100644 --- a/src/OrchardCore.Modules/OrchardCore.Search/AdminMenu.cs +++ b/src/OrchardCore.Modules/OrchardCore.Search/AdminMenu.cs @@ -17,7 +17,7 @@ public AdminMenu(IStringLocalizer localizer) public Task BuildNavigationAsync(string name, NavigationBuilder builder) { - if (!String.Equals(name, "admin", StringComparison.OrdinalIgnoreCase)) + if (!string.Equals(name, "admin", StringComparison.OrdinalIgnoreCase)) { return Task.CompletedTask; } diff --git a/src/OrchardCore.Modules/OrchardCore.Search/Controllers/SearchController.cs b/src/OrchardCore.Modules/OrchardCore.Search/Controllers/SearchController.cs index 838f4241b01..713c98cffc5 100644 --- a/src/OrchardCore.Modules/OrchardCore.Search/Controllers/SearchController.cs +++ b/src/OrchardCore.Modules/OrchardCore.Search/Controllers/SearchController.cs @@ -75,7 +75,7 @@ public async Task Search(SearchViewModel viewModel, PagerSlimPara var searchSettings = siteSettings.As(); ISearchService searchService = null; - if (!String.IsNullOrEmpty(searchSettings.ProviderName)) + if (!string.IsNullOrEmpty(searchSettings.ProviderName)) { searchService = searchServices.FirstOrDefault(service => service.Name == searchSettings.ProviderName); } @@ -87,7 +87,7 @@ public async Task Search(SearchViewModel viewModel, PagerSlimPara return this.ChallengeOrForbid(); } - if (String.IsNullOrWhiteSpace(viewModel.Terms)) + if (string.IsNullOrWhiteSpace(viewModel.Terms)) { return View(new SearchIndexViewModel() { diff --git a/src/OrchardCore.Modules/OrchardCore.Search/Drivers/SearchFormPartDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.Search/Drivers/SearchFormPartDisplayDriver.cs index 7fa2f156c07..240e6ad60cd 100644 --- a/src/OrchardCore.Modules/OrchardCore.Search/Drivers/SearchFormPartDisplayDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Search/Drivers/SearchFormPartDisplayDriver.cs @@ -32,7 +32,7 @@ public override async Task UpdateAsync(SearchFormPart part, IUpd if (await updater.TryUpdateModelAsync(model, Prefix)) { part.Placeholder = model.Placeholder; - part.IndexName = String.IsNullOrWhiteSpace(model.IndexName) ? null : model.IndexName.Trim(); + part.IndexName = string.IsNullOrWhiteSpace(model.IndexName) ? null : model.IndexName.Trim(); } return Edit(part); diff --git a/src/OrchardCore.Modules/OrchardCore.Security/AdminMenu.cs b/src/OrchardCore.Modules/OrchardCore.Security/AdminMenu.cs index 9722200cecb..59e81be62b0 100644 --- a/src/OrchardCore.Modules/OrchardCore.Security/AdminMenu.cs +++ b/src/OrchardCore.Modules/OrchardCore.Security/AdminMenu.cs @@ -17,7 +17,7 @@ public AdminMenu(IStringLocalizer localizer) public Task BuildNavigationAsync(string name, NavigationBuilder builder) { - if (String.Equals(name, "admin", StringComparison.OrdinalIgnoreCase)) + if (string.Equals(name, "admin", StringComparison.OrdinalIgnoreCase)) { builder.Add(S["Security"], NavigationConstants.AdminMenuSecurityPosition, security => security .AddClass("security").Id("security") diff --git a/src/OrchardCore.Modules/OrchardCore.Security/Options/SecurityHeadersOptions.cs b/src/OrchardCore.Modules/OrchardCore.Security/Options/SecurityHeadersOptions.cs index 3b8665a2202..a592931bc3e 100644 --- a/src/OrchardCore.Modules/OrchardCore.Security/Options/SecurityHeadersOptions.cs +++ b/src/OrchardCore.Modules/OrchardCore.Security/Options/SecurityHeadersOptions.cs @@ -34,7 +34,7 @@ public SecurityHeadersOptions AddContentSecurityPolicy(Dictionary kvp.Value != null || kvp.Key == ContentSecurityPolicyValue.Sandbox || kvp.Key == ContentSecurityPolicyValue.UpgradeInsecureRequests) - .Select(kvp => kvp.Key + (kvp.Value != null ? " " + kvp.Value : String.Empty)) + .Select(kvp => kvp.Key + (kvp.Value != null ? " " + kvp.Value : string.Empty)) .ToArray(); return this; diff --git a/src/OrchardCore.Modules/OrchardCore.Security/Services/ContentSecurityPolicyHeaderPolicyProvider.cs b/src/OrchardCore.Modules/OrchardCore.Security/Services/ContentSecurityPolicyHeaderPolicyProvider.cs index d412c54f674..c55355b10aa 100644 --- a/src/OrchardCore.Modules/OrchardCore.Security/Services/ContentSecurityPolicyHeaderPolicyProvider.cs +++ b/src/OrchardCore.Modules/OrchardCore.Security/Services/ContentSecurityPolicyHeaderPolicyProvider.cs @@ -11,7 +11,7 @@ public override void InitializePolicy() { if (Options.ContentSecurityPolicy.Length > 0) { - _policy = String.Join(SecurityHeaderDefaults.PoliciesSeparator, Options.ContentSecurityPolicy); + _policy = string.Join(SecurityHeaderDefaults.PoliciesSeparator, Options.ContentSecurityPolicy); } } diff --git a/src/OrchardCore.Modules/OrchardCore.Security/Services/PermissionsHeaderPolicyProvider.cs b/src/OrchardCore.Modules/OrchardCore.Security/Services/PermissionsHeaderPolicyProvider.cs index e1334a018b5..6e7df5b6cbf 100644 --- a/src/OrchardCore.Modules/OrchardCore.Security/Services/PermissionsHeaderPolicyProvider.cs +++ b/src/OrchardCore.Modules/OrchardCore.Security/Services/PermissionsHeaderPolicyProvider.cs @@ -11,7 +11,7 @@ public override void InitializePolicy() { if (Options.PermissionsPolicy.Length > 0) { - _policy = String.Join(SecurityHeaderDefaults.PoliciesSeparator, Options.PermissionsPolicy); + _policy = string.Join(SecurityHeaderDefaults.PoliciesSeparator, Options.PermissionsPolicy); } } diff --git a/src/OrchardCore.Modules/OrchardCore.Seo/AdminMenu.cs b/src/OrchardCore.Modules/OrchardCore.Seo/AdminMenu.cs index 6e3167e4fa3..910fce477d5 100644 --- a/src/OrchardCore.Modules/OrchardCore.Seo/AdminMenu.cs +++ b/src/OrchardCore.Modules/OrchardCore.Seo/AdminMenu.cs @@ -16,7 +16,7 @@ public AdminMenu(IStringLocalizer localizer) public Task BuildNavigationAsync(string name, NavigationBuilder builder) { - if (!String.Equals(name, "admin", StringComparison.OrdinalIgnoreCase)) + if (!string.Equals(name, "admin", StringComparison.OrdinalIgnoreCase)) { return Task.CompletedTask; } diff --git a/src/OrchardCore.Modules/OrchardCore.Seo/Drivers/SeoContentDriver.cs b/src/OrchardCore.Modules/OrchardCore.Seo/Drivers/SeoContentDriver.cs index 7197d857d47..9c1cb11e011 100644 --- a/src/OrchardCore.Modules/OrchardCore.Seo/Drivers/SeoContentDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Seo/Drivers/SeoContentDriver.cs @@ -70,12 +70,12 @@ public override async Task DisplayAsync(ContentItem contentItem, ["ContentItem"] = contentItem }; - if (!String.IsNullOrEmpty(aspect.PageTitle)) + if (!string.IsNullOrEmpty(aspect.PageTitle)) { _pageTitleBuilder.SetFixedTitle(new HtmlString(_htmlEncoder.Encode(await _shortcodeService.ProcessAsync(aspect.PageTitle, shortCodeContext)))); } - if (!String.IsNullOrEmpty(aspect.MetaDescription)) + if (!string.IsNullOrEmpty(aspect.MetaDescription)) { _resourceManager.RegisterMeta(new MetaEntry { @@ -84,7 +84,7 @@ public override async Task DisplayAsync(ContentItem contentItem, }); } - if (!String.IsNullOrEmpty(aspect.MetaKeywords)) + if (!string.IsNullOrEmpty(aspect.MetaKeywords)) { _resourceManager.RegisterMeta(new MetaEntry { @@ -93,7 +93,7 @@ public override async Task DisplayAsync(ContentItem contentItem, }); } - if (!String.IsNullOrEmpty(aspect.Canonical)) + if (!string.IsNullOrEmpty(aspect.Canonical)) { _resourceManager.RegisterLink(new LinkEntry { @@ -102,7 +102,7 @@ public override async Task DisplayAsync(ContentItem contentItem, }); } - if (!String.IsNullOrEmpty(aspect.MetaRobots)) + if (!string.IsNullOrEmpty(aspect.MetaRobots)) { _resourceManager.RegisterMeta(new MetaEntry { @@ -123,7 +123,7 @@ public override async Task DisplayAsync(ContentItem contentItem, } // OpenGraph. - if (!String.IsNullOrEmpty(aspect.OpenGraphType)) + if (!string.IsNullOrEmpty(aspect.OpenGraphType)) { _resourceManager.RegisterMeta(new MetaEntry { @@ -132,7 +132,7 @@ public override async Task DisplayAsync(ContentItem contentItem, }); } - if (!String.IsNullOrEmpty(aspect.OpenGraphTitle)) + if (!string.IsNullOrEmpty(aspect.OpenGraphTitle)) { _resourceManager.RegisterMeta(new MetaEntry { @@ -141,7 +141,7 @@ public override async Task DisplayAsync(ContentItem contentItem, }); } - if (!String.IsNullOrEmpty(aspect.OpenGraphDescription)) + if (!string.IsNullOrEmpty(aspect.OpenGraphDescription)) { _resourceManager.RegisterMeta(new MetaEntry { @@ -150,7 +150,7 @@ public override async Task DisplayAsync(ContentItem contentItem, }); } - if (!String.IsNullOrEmpty(aspect.OpenGraphImage)) + if (!string.IsNullOrEmpty(aspect.OpenGraphImage)) { _resourceManager.RegisterMeta(new MetaEntry { @@ -159,7 +159,7 @@ public override async Task DisplayAsync(ContentItem contentItem, }); } - if (!String.IsNullOrEmpty(aspect.OpenGraphImageAlt)) + if (!string.IsNullOrEmpty(aspect.OpenGraphImageAlt)) { _resourceManager.RegisterMeta(new MetaEntry { @@ -168,7 +168,7 @@ public override async Task DisplayAsync(ContentItem contentItem, }); } - if (!String.IsNullOrEmpty(aspect.OpenGraphUrl)) + if (!string.IsNullOrEmpty(aspect.OpenGraphUrl)) { _resourceManager.RegisterMeta(new MetaEntry { @@ -177,7 +177,7 @@ public override async Task DisplayAsync(ContentItem contentItem, }); } - if (!String.IsNullOrEmpty(aspect.OpenGraphSiteName)) + if (!string.IsNullOrEmpty(aspect.OpenGraphSiteName)) { _resourceManager.RegisterMeta(new MetaEntry { @@ -186,7 +186,7 @@ public override async Task DisplayAsync(ContentItem contentItem, }); } - if (!String.IsNullOrEmpty(aspect.OpenGraphAppId)) + if (!string.IsNullOrEmpty(aspect.OpenGraphAppId)) { _resourceManager.RegisterMeta(new MetaEntry { @@ -195,7 +195,7 @@ public override async Task DisplayAsync(ContentItem contentItem, }); } - if (!String.IsNullOrEmpty(aspect.OpenGraphLocale)) + if (!string.IsNullOrEmpty(aspect.OpenGraphLocale)) { _resourceManager.RegisterMeta(new MetaEntry { @@ -205,7 +205,7 @@ public override async Task DisplayAsync(ContentItem contentItem, } // Twitter. - if (!String.IsNullOrEmpty(aspect.TwitterCard)) + if (!string.IsNullOrEmpty(aspect.TwitterCard)) { _resourceManager.RegisterMeta(new MetaEntry { @@ -214,7 +214,7 @@ public override async Task DisplayAsync(ContentItem contentItem, }); } - if (!String.IsNullOrEmpty(aspect.TwitterSite)) + if (!string.IsNullOrEmpty(aspect.TwitterSite)) { _resourceManager.RegisterMeta(new MetaEntry { @@ -223,7 +223,7 @@ public override async Task DisplayAsync(ContentItem contentItem, }); } - if (!String.IsNullOrEmpty(aspect.TwitterTitle)) + if (!string.IsNullOrEmpty(aspect.TwitterTitle)) { _resourceManager.RegisterMeta(new MetaEntry { @@ -232,7 +232,7 @@ public override async Task DisplayAsync(ContentItem contentItem, }); } - if (!String.IsNullOrEmpty(aspect.TwitterDescription)) + if (!string.IsNullOrEmpty(aspect.TwitterDescription)) { _resourceManager.RegisterMeta(new MetaEntry { @@ -241,7 +241,7 @@ public override async Task DisplayAsync(ContentItem contentItem, }); } - if (!String.IsNullOrEmpty(aspect.TwitterImage)) + if (!string.IsNullOrEmpty(aspect.TwitterImage)) { _resourceManager.RegisterMeta(new MetaEntry { @@ -250,7 +250,7 @@ public override async Task DisplayAsync(ContentItem contentItem, }); } - if (!String.IsNullOrEmpty(aspect.TwitterImageAlt)) + if (!string.IsNullOrEmpty(aspect.TwitterImageAlt)) { _resourceManager.RegisterMeta(new MetaEntry { @@ -259,7 +259,7 @@ public override async Task DisplayAsync(ContentItem contentItem, }); } - if (!String.IsNullOrEmpty(aspect.TwitterCreator)) + if (!string.IsNullOrEmpty(aspect.TwitterCreator)) { _resourceManager.RegisterMeta(new MetaEntry { @@ -268,7 +268,7 @@ public override async Task DisplayAsync(ContentItem contentItem, }); } - if (!String.IsNullOrEmpty(aspect.TwitterUrl)) + if (!string.IsNullOrEmpty(aspect.TwitterUrl)) { _resourceManager.RegisterMeta(new MetaEntry { @@ -277,7 +277,7 @@ public override async Task DisplayAsync(ContentItem contentItem, }); } - if (!String.IsNullOrEmpty(aspect.GoogleSchema)) + if (!string.IsNullOrEmpty(aspect.GoogleSchema)) { var json = await _shortcodeService.ProcessAsync(aspect.GoogleSchema, shortCodeContext); diff --git a/src/OrchardCore.Modules/OrchardCore.Seo/Drivers/SeoMetaPartDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.Seo/Drivers/SeoMetaPartDisplayDriver.cs index ee9469a9fb5..72c64398c64 100644 --- a/src/OrchardCore.Modules/OrchardCore.Seo/Drivers/SeoMetaPartDisplayDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Seo/Drivers/SeoMetaPartDisplayDriver.cs @@ -100,7 +100,7 @@ public override async Task UpdateAsync(SeoMetaPart part, IUpdate part.Canonical = partViewModel.Canonical; part.MetaRobots = partViewModel.MetaRobots; - part.CustomMetaTags = String.IsNullOrWhiteSpace(partViewModel.CustomMetaTags) + part.CustomMetaTags = string.IsNullOrWhiteSpace(partViewModel.CustomMetaTags) ? Array.Empty() : JsonConvert.DeserializeObject(partViewModel.CustomMetaTags); @@ -137,7 +137,7 @@ public override async Task UpdateAsync(SeoMetaPart part, IUpdate if (await updater.TryUpdateModelAsync(googleSchemaModel, Prefix)) { part.GoogleSchema = googleSchemaModel.GoogleSchema; - if (!String.IsNullOrWhiteSpace(googleSchemaModel.GoogleSchema) && !googleSchemaModel.GoogleSchema.IsJson()) + if (!string.IsNullOrWhiteSpace(googleSchemaModel.GoogleSchema) && !googleSchemaModel.GoogleSchema.IsJson()) { updater.ModelState.AddModelError(Prefix, S["The google schema is written in an incorrect format."]); } diff --git a/src/OrchardCore.Modules/OrchardCore.Seo/GraphQL/MetaEntryQueryObjectType.cs b/src/OrchardCore.Modules/OrchardCore.Seo/GraphQL/MetaEntryQueryObjectType.cs index 5dcbe1bbdbe..d472b4db559 100644 --- a/src/OrchardCore.Modules/OrchardCore.Seo/GraphQL/MetaEntryQueryObjectType.cs +++ b/src/OrchardCore.Modules/OrchardCore.Seo/GraphQL/MetaEntryQueryObjectType.cs @@ -1,4 +1,4 @@ -using System.IO; +using System.IO; using GraphQL.Types; using Microsoft.AspNetCore.Razor.TagHelpers; using Microsoft.Extensions.Localization; diff --git a/src/OrchardCore.Modules/OrchardCore.Seo/GraphQL/SeoMetaQueryObjectType.cs b/src/OrchardCore.Modules/OrchardCore.Seo/GraphQL/SeoMetaQueryObjectType.cs index 93d8e11d98f..573ce38c17e 100644 --- a/src/OrchardCore.Modules/OrchardCore.Seo/GraphQL/SeoMetaQueryObjectType.cs +++ b/src/OrchardCore.Modules/OrchardCore.Seo/GraphQL/SeoMetaQueryObjectType.cs @@ -1,4 +1,4 @@ -using GraphQL.Types; +using GraphQL.Types; using Microsoft.Extensions.Localization; using OrchardCore.Media.Fields; using OrchardCore.ResourceManagement; @@ -23,7 +23,7 @@ public SeoMetaQueryObjectType(IStringLocalizer S) .Description("The meta keywords of the content item"); Field(x => x.Canonical, true) .Description("The canonical link of the content item"); - Field( x => x.MetaRobots, true) + Field(x => x.MetaRobots, true) .Description("The content item specific meta robots definition"); Field>() @@ -38,29 +38,29 @@ public SeoMetaQueryObjectType(IStringLocalizer S) .Name("openGraphImage") .Resolve(ctx => ctx.Source.OpenGraphImage); - Field( x => x.OpenGraphType, true) + Field(x => x.OpenGraphType, true) .Description("The seo meta opengraph type"); - Field( x => x.OpenGraphTitle, true) + Field(x => x.OpenGraphTitle, true) .Description("The seo meta opengraph title"); - Field( x => x.OpenGraphDescription, true) + Field(x => x.OpenGraphDescription, true) .Description("The seo meta opengraph description"); Field>() .Name("twitterImage") .Resolve(ctx => ctx.Source.TwitterImage); - Field( x => x.TwitterTitle, true) + Field(x => x.TwitterTitle, true) .Description("The seo meta twitter title"); - Field( x => x.TwitterDescription, true) + Field(x => x.TwitterDescription, true) .Description("The seo meta twitter description"); - Field( x => x.TwitterCard, true) + Field(x => x.TwitterCard, true) .Description("The seo meta twitter card"); - Field( x => x.TwitterCreator, true) + Field(x => x.TwitterCreator, true) .Description("The seo meta twitter creator"); - Field( x => x.TwitterSite, true) + Field(x => x.TwitterSite, true) .Description("The seo meta twitter site"); - Field( x => x.GoogleSchema, true) + Field(x => x.GoogleSchema, true) .Description("The seo meta google schema"); } diff --git a/src/OrchardCore.Modules/OrchardCore.Seo/GraphQL/Startup.cs b/src/OrchardCore.Modules/OrchardCore.Seo/GraphQL/Startup.cs index 62ab8e0b220..46022df0065 100644 --- a/src/OrchardCore.Modules/OrchardCore.Seo/GraphQL/Startup.cs +++ b/src/OrchardCore.Modules/OrchardCore.Seo/GraphQL/Startup.cs @@ -1,4 +1,4 @@ -using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.DependencyInjection; using OrchardCore.Apis; using OrchardCore.Modules; using OrchardCore.ResourceManagement; diff --git a/src/OrchardCore.Modules/OrchardCore.Seo/Handlers/SeoMetaPartHandler.cs b/src/OrchardCore.Modules/OrchardCore.Seo/Handlers/SeoMetaPartHandler.cs index 18f25e44c7c..2854c4aa8e9 100644 --- a/src/OrchardCore.Modules/OrchardCore.Seo/Handlers/SeoMetaPartHandler.cs +++ b/src/OrchardCore.Modules/OrchardCore.Seo/Handlers/SeoMetaPartHandler.cs @@ -1,4 +1,3 @@ -using System; using System.Threading.Tasks; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; @@ -49,24 +48,22 @@ public override Task GetContentItemAspectAsync(ContentItemAspectContext context, { aspect.Render = part.Render; - if (!String.IsNullOrEmpty(part.PageTitle)) + if (!string.IsNullOrEmpty(part.PageTitle)) { aspect.PageTitle = part.PageTitle; } - if (!String.IsNullOrEmpty(part.MetaDescription)) + if (!string.IsNullOrEmpty(part.MetaDescription)) { aspect.MetaDescription = part.MetaDescription; } - if (!String.IsNullOrEmpty(part.MetaKeywords)) + if (!string.IsNullOrEmpty(part.MetaKeywords)) { aspect.MetaKeywords = part.MetaKeywords; } - - - if (!String.IsNullOrEmpty(part.MetaRobots)) + if (!string.IsNullOrEmpty(part.MetaRobots)) { aspect.MetaRobots = part.MetaRobots; } @@ -81,7 +78,7 @@ public override Task GetContentItemAspectAsync(ContentItemAspectContext context, var urlHelper = _urlHelperFactory.GetUrlHelper(actionContext); - if (!String.IsNullOrEmpty(part.Canonical)) + if (!string.IsNullOrEmpty(part.Canonical)) { aspect.Canonical = part.Canonical; } @@ -111,7 +108,7 @@ public override Task GetContentItemAspectAsync(ContentItemAspectContext context, aspect.OpenGraphImageAlt = part.DefaultSocialImage.MediaTexts[0]; } - if (!String.IsNullOrEmpty(part.OpenGraphTitle)) + if (!string.IsNullOrEmpty(part.OpenGraphTitle)) { aspect.OpenGraphTitle = part.OpenGraphTitle; } @@ -120,7 +117,7 @@ public override Task GetContentItemAspectAsync(ContentItemAspectContext context, aspect.OpenGraphTitle = part.PageTitle; } - if (!String.IsNullOrEmpty(part.OpenGraphDescription)) + if (!string.IsNullOrEmpty(part.OpenGraphDescription)) { aspect.OpenGraphDescription = part.OpenGraphDescription; } @@ -149,7 +146,7 @@ public override Task GetContentItemAspectAsync(ContentItemAspectContext context, aspect.TwitterImageAlt = part.DefaultSocialImage.MediaTexts[0]; } - if (!String.IsNullOrEmpty(part.TwitterTitle)) + if (!string.IsNullOrEmpty(part.TwitterTitle)) { aspect.TwitterTitle = part.TwitterTitle; } @@ -158,7 +155,7 @@ public override Task GetContentItemAspectAsync(ContentItemAspectContext context, aspect.TwitterTitle = part.PageTitle; } - if (!String.IsNullOrEmpty(part.TwitterDescription)) + if (!string.IsNullOrEmpty(part.TwitterDescription)) { aspect.TwitterDescription = part.TwitterDescription; } @@ -167,17 +164,17 @@ public override Task GetContentItemAspectAsync(ContentItemAspectContext context, aspect.TwitterDescription = part.MetaDescription; } - if (!String.IsNullOrEmpty(part.TwitterCard)) + if (!string.IsNullOrEmpty(part.TwitterCard)) { aspect.TwitterCard = part.TwitterCard; } - if (!String.IsNullOrEmpty(part.TwitterCreator)) + if (!string.IsNullOrEmpty(part.TwitterCreator)) { aspect.TwitterCreator = part.TwitterCreator; } - if (!String.IsNullOrEmpty(part.TwitterSite)) + if (!string.IsNullOrEmpty(part.TwitterSite)) { aspect.TwitterSite = part.TwitterSite; } diff --git a/src/OrchardCore.Modules/OrchardCore.Seo/Handlers/SeoMetaSettingsHandler.cs b/src/OrchardCore.Modules/OrchardCore.Seo/Handlers/SeoMetaSettingsHandler.cs index fe8b3a08bd9..4398e26e9e5 100644 --- a/src/OrchardCore.Modules/OrchardCore.Seo/Handlers/SeoMetaSettingsHandler.cs +++ b/src/OrchardCore.Modules/OrchardCore.Seo/Handlers/SeoMetaSettingsHandler.cs @@ -66,13 +66,13 @@ public override Task GetContentItemAspectAsync(ContentItemAspectContext context) // Logic is this happens last after the part settings. // so if values are not set it is responsible for settings them. - string defaultImage = (metaSettings.Content.SocialMetaSettings?.DefaultSocialImage?.Paths as JArray)?.Count > 0 ? metaSettings.Content.SocialMetaSettings.DefaultSocialImage.Paths[0].ToString() : String.Empty; - string openGraphImage = (metaSettings.Content.SocialMetaSettings?.OpenGraphImage?.Paths as JArray)?.Count > 0 ? metaSettings.Content.SocialMetaSettings?.OpenGraphImage?.Paths[0]?.ToString() : String.Empty; - string twitterImage = (metaSettings.Content.SocialMetaSettings?.TwitterImage?.Paths as JArray)?.Count > 0 ? metaSettings.Content.SocialMetaSettings?.TwitterImage?.Paths[0]?.ToString() : String.Empty; + string defaultImage = (metaSettings.Content.SocialMetaSettings?.DefaultSocialImage?.Paths as JArray)?.Count > 0 ? metaSettings.Content.SocialMetaSettings.DefaultSocialImage.Paths[0].ToString() : string.Empty; + string openGraphImage = (metaSettings.Content.SocialMetaSettings?.OpenGraphImage?.Paths as JArray)?.Count > 0 ? metaSettings.Content.SocialMetaSettings?.OpenGraphImage?.Paths[0]?.ToString() : string.Empty; + string twitterImage = (metaSettings.Content.SocialMetaSettings?.TwitterImage?.Paths as JArray)?.Count > 0 ? metaSettings.Content.SocialMetaSettings?.TwitterImage?.Paths[0]?.ToString() : string.Empty; - string defaultAltText = (metaSettings.Content.SocialMetaSettings?.DefaultSocialImage?.MediaTexts as JArray)?.Count > 0 ? metaSettings.Content.SocialMetaSettings.DefaultSocialImage.MediaTexts[0].ToString() : String.Empty; - string openGraphAltText = (metaSettings.Content.SocialMetaSettings?.OpenGraphImage?.MediaTexts as JArray)?.Count > 0 ? metaSettings.Content.SocialMetaSettings?.OpenGraphImage?.MediaTexts[0]?.ToString() : String.Empty; - string twitterAltText = (metaSettings.Content.SocialMetaSettings?.TwitterImage?.MediaTexts as JArray)?.Count > 0 ? metaSettings.Content.SocialMetaSettings?.TwitterImage?.MediaTexts[0]?.ToString() : String.Empty; + string defaultAltText = (metaSettings.Content.SocialMetaSettings?.DefaultSocialImage?.MediaTexts as JArray)?.Count > 0 ? metaSettings.Content.SocialMetaSettings.DefaultSocialImage.MediaTexts[0].ToString() : string.Empty; + string openGraphAltText = (metaSettings.Content.SocialMetaSettings?.OpenGraphImage?.MediaTexts as JArray)?.Count > 0 ? metaSettings.Content.SocialMetaSettings?.OpenGraphImage?.MediaTexts[0]?.ToString() : string.Empty; + string twitterAltText = (metaSettings.Content.SocialMetaSettings?.TwitterImage?.MediaTexts as JArray)?.Count > 0 ? metaSettings.Content.SocialMetaSettings?.TwitterImage?.MediaTexts[0]?.ToString() : string.Empty; string twitterCard = metaSettings.Content.SocialMetaSettings?.TwitterCard?.Text?.ToString(); string twitterCreator = metaSettings.Content.SocialMetaSettings?.TwitterCreator?.Text?.ToString(); @@ -82,7 +82,7 @@ public override Task GetContentItemAspectAsync(ContentItemAspectContext context) // Meta - if (String.IsNullOrEmpty(aspect.MetaDescription)) + if (string.IsNullOrEmpty(aspect.MetaDescription)) { aspect.MetaDescription = metaSettings.Content.SocialMetaSettings?.DefaultMetaDescription?.Text?.ToString(); } @@ -91,40 +91,40 @@ public override Task GetContentItemAspectAsync(ContentItemAspectContext context) aspect.OpenGraphUrl = aspect.Canonical ??= absoluteUrl; - if (String.IsNullOrEmpty(aspect.OpenGraphType)) + if (string.IsNullOrEmpty(aspect.OpenGraphType)) { aspect.OpenGraphType = metaSettings.Content.SocialMetaSettings?.OpenGraphType?.Text?.ToString(); } - if (String.IsNullOrEmpty(aspect.OpenGraphTitle)) + if (string.IsNullOrEmpty(aspect.OpenGraphTitle)) { aspect.OpenGraphTitle = context.ContentItem.DisplayText; } - if (String.IsNullOrEmpty(aspect.OpenGraphDescription)) + if (string.IsNullOrEmpty(aspect.OpenGraphDescription)) { aspect.OpenGraphDescription = metaSettings.Content.SocialMetaSettings?.DefaultOpenGraphDescription?.Text?.ToString(); } - if (String.IsNullOrEmpty(aspect.OpenGraphSiteName)) + if (string.IsNullOrEmpty(aspect.OpenGraphSiteName)) { aspect.OpenGraphSiteName = metaSettings.Content.SocialMetaSettings?.OpenGraphSiteName?.Text.ToString(); - if (String.IsNullOrEmpty(aspect.OpenGraphSiteName)) + if (string.IsNullOrEmpty(aspect.OpenGraphSiteName)) { aspect.OpenGraphSiteName = siteSettings.SiteName; } } - if (String.IsNullOrEmpty(aspect.OpenGraphAppId)) + if (string.IsNullOrEmpty(aspect.OpenGraphAppId)) { aspect.OpenGraphAppId = metaSettings.Content.SocialMetaSettings?.OpenGraphAppId?.Text.ToString(); } - if (String.IsNullOrEmpty(aspect.OpenGraphImage)) + if (string.IsNullOrEmpty(aspect.OpenGraphImage)) { - if (String.IsNullOrEmpty(openGraphImage)) + if (string.IsNullOrEmpty(openGraphImage)) { - if (!String.IsNullOrEmpty(defaultImage)) + if (!string.IsNullOrEmpty(defaultImage)) { aspect.OpenGraphImage = urlHelper.ToAbsoluteUrl(_mediaFileStore.MapPathToPublicUrl(defaultImage)); } @@ -135,9 +135,9 @@ public override Task GetContentItemAspectAsync(ContentItemAspectContext context) } } - if (String.IsNullOrEmpty(aspect.OpenGraphImageAlt)) + if (string.IsNullOrEmpty(aspect.OpenGraphImageAlt)) { - if (String.IsNullOrEmpty(openGraphAltText)) + if (string.IsNullOrEmpty(openGraphAltText)) { aspect.OpenGraphImageAlt = defaultAltText; } @@ -150,36 +150,36 @@ public override Task GetContentItemAspectAsync(ContentItemAspectContext context) // Twitter aspect.TwitterUrl = aspect.Canonical ??= absoluteUrl; - if (String.IsNullOrEmpty(aspect.TwitterTitle)) + if (string.IsNullOrEmpty(aspect.TwitterTitle)) { aspect.TwitterTitle = context.ContentItem.DisplayText; } - if (String.IsNullOrEmpty(aspect.TwitterDescription)) + if (string.IsNullOrEmpty(aspect.TwitterDescription)) { aspect.TwitterDescription = metaSettings.Content.SocialMetaSettings?.DefaultTwitterDescription?.Text?.ToString(); } - if (String.IsNullOrEmpty(aspect.TwitterCard)) + if (string.IsNullOrEmpty(aspect.TwitterCard)) { aspect.TwitterCard = twitterCard; } - if (String.IsNullOrEmpty(aspect.TwitterSite)) + if (string.IsNullOrEmpty(aspect.TwitterSite)) { aspect.TwitterSite = twitterSite; } - if (String.IsNullOrEmpty(aspect.TwitterCreator)) + if (string.IsNullOrEmpty(aspect.TwitterCreator)) { aspect.TwitterCreator = twitterCreator; } - if (String.IsNullOrEmpty(aspect.TwitterImage)) + if (string.IsNullOrEmpty(aspect.TwitterImage)) { - if (String.IsNullOrEmpty(twitterImage)) + if (string.IsNullOrEmpty(twitterImage)) { - if (!String.IsNullOrEmpty(defaultImage)) + if (!string.IsNullOrEmpty(defaultImage)) { aspect.TwitterImage = urlHelper.ToAbsoluteUrl(_mediaFileStore.MapPathToPublicUrl(defaultImage)); } @@ -190,9 +190,9 @@ public override Task GetContentItemAspectAsync(ContentItemAspectContext context) } } - if (String.IsNullOrEmpty(aspect.TwitterImageAlt)) + if (string.IsNullOrEmpty(aspect.TwitterImageAlt)) { - if (String.IsNullOrEmpty(twitterAltText)) + if (string.IsNullOrEmpty(twitterAltText)) { aspect.TwitterImageAlt = defaultAltText; } @@ -202,7 +202,7 @@ public override Task GetContentItemAspectAsync(ContentItemAspectContext context) } } - if (String.IsNullOrEmpty(aspect.GoogleSchema)) + if (string.IsNullOrEmpty(aspect.GoogleSchema)) { aspect.GoogleSchema = googleSchema; } diff --git a/src/OrchardCore.Modules/OrchardCore.Seo/Indexes/SeoMetaPartContentIndexHandler.cs b/src/OrchardCore.Modules/OrchardCore.Seo/Indexes/SeoMetaPartContentIndexHandler.cs index 668a5f74096..4045cb57f14 100644 --- a/src/OrchardCore.Modules/OrchardCore.Seo/Indexes/SeoMetaPartContentIndexHandler.cs +++ b/src/OrchardCore.Modules/OrchardCore.Seo/Indexes/SeoMetaPartContentIndexHandler.cs @@ -1,4 +1,4 @@ -using System.Threading.Tasks; +using System.Threading.Tasks; using OrchardCore.ContentManagement; using OrchardCore.Indexing; using OrchardCore.Seo.Models; diff --git a/src/OrchardCore.Modules/OrchardCore.Seo/Services/RobotsMiddleware.cs b/src/OrchardCore.Modules/OrchardCore.Seo/Services/RobotsMiddleware.cs index d0d3df08d03..74dee85be88 100644 --- a/src/OrchardCore.Modules/OrchardCore.Seo/Services/RobotsMiddleware.cs +++ b/src/OrchardCore.Modules/OrchardCore.Seo/Services/RobotsMiddleware.cs @@ -46,7 +46,7 @@ public async Task Invoke(HttpContext httpContext) { var item = (await provider.GetContentAsync())?.Trim(); - if (String.IsNullOrEmpty(item)) + if (string.IsNullOrEmpty(item)) { continue; } diff --git a/src/OrchardCore.Modules/OrchardCore.Seo/Services/SiteSettingsRobotsProvider.cs b/src/OrchardCore.Modules/OrchardCore.Seo/Services/SiteSettingsRobotsProvider.cs index 17d7822a7fa..bd69f96129a 100644 --- a/src/OrchardCore.Modules/OrchardCore.Seo/Services/SiteSettingsRobotsProvider.cs +++ b/src/OrchardCore.Modules/OrchardCore.Seo/Services/SiteSettingsRobotsProvider.cs @@ -37,7 +37,7 @@ public async Task GetContentAsync() content.AppendLine($"Disallow: /{_adminOptions.AdminUrlPrefix}"); } - if (!String.IsNullOrEmpty(settings.AdditionalRules)) + if (!string.IsNullOrEmpty(settings.AdditionalRules)) { content.AppendLine(settings.AdditionalRules.Trim()); } diff --git a/src/OrchardCore.Modules/OrchardCore.Settings/AdminMenu.cs b/src/OrchardCore.Modules/OrchardCore.Settings/AdminMenu.cs index 5ec7babac0f..301e0a0e6f8 100644 --- a/src/OrchardCore.Modules/OrchardCore.Settings/AdminMenu.cs +++ b/src/OrchardCore.Modules/OrchardCore.Settings/AdminMenu.cs @@ -17,7 +17,7 @@ public AdminMenu(IStringLocalizer localizer) public Task BuildNavigationAsync(string name, NavigationBuilder builder) { - if (!String.Equals(name, "admin", StringComparison.OrdinalIgnoreCase)) + if (!string.Equals(name, "admin", StringComparison.OrdinalIgnoreCase)) { return Task.CompletedTask; } diff --git a/src/OrchardCore.Modules/OrchardCore.Settings/Drivers/DefaultSiteSettingsDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.Settings/Drivers/DefaultSiteSettingsDisplayDriver.cs index 7fe6f7ffc46..654755eb8e9 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."]); @@ -85,7 +85,7 @@ public override async Task UpdateAsync(ISite site, UpdateEditorC } } - if (!String.IsNullOrEmpty(site.BaseUrl) && !Uri.TryCreate(site.BaseUrl, UriKind.Absolute, out _)) + if (!string.IsNullOrEmpty(site.BaseUrl) && !Uri.TryCreate(site.BaseUrl, UriKind.Absolute, out _)) { context.Updater.ModelState.AddModelError(Prefix, nameof(model.BaseUrl), S["The Base url must be a fully qualified URL."]); } diff --git a/src/OrchardCore.Modules/OrchardCore.Settings/Properties/AssemblyInfo.cs b/src/OrchardCore.Modules/OrchardCore.Settings/Properties/AssemblyInfo.cs index f4e7f226a4f..7576df909da 100644 --- a/src/OrchardCore.Modules/OrchardCore.Settings/Properties/AssemblyInfo.cs +++ b/src/OrchardCore.Modules/OrchardCore.Settings/Properties/AssemblyInfo.cs @@ -1,4 +1,4 @@ -using System.Reflection; +using System.Reflection; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following diff --git a/src/OrchardCore.Modules/OrchardCore.Settings/Recipes/SettingsStep.cs b/src/OrchardCore.Modules/OrchardCore.Settings/Recipes/SettingsStep.cs index 955555810d6..0d00b2bafc6 100644 --- a/src/OrchardCore.Modules/OrchardCore.Settings/Recipes/SettingsStep.cs +++ b/src/OrchardCore.Modules/OrchardCore.Settings/Recipes/SettingsStep.cs @@ -21,7 +21,7 @@ public SettingsStep(ISiteService siteService) public async Task ExecuteAsync(RecipeExecutionContext context) { - if (!String.Equals(context.Name, "Settings", StringComparison.OrdinalIgnoreCase)) + if (!string.Equals(context.Name, "Settings", StringComparison.OrdinalIgnoreCase)) { return; } diff --git a/src/OrchardCore.Modules/OrchardCore.Settings/Services/RecipeEnvironmentSiteNameProvider.cs b/src/OrchardCore.Modules/OrchardCore.Settings/Services/RecipeEnvironmentSiteNameProvider.cs index e905d5bf582..42f41fcd401 100644 --- a/src/OrchardCore.Modules/OrchardCore.Settings/Services/RecipeEnvironmentSiteNameProvider.cs +++ b/src/OrchardCore.Modules/OrchardCore.Settings/Services/RecipeEnvironmentSiteNameProvider.cs @@ -19,7 +19,7 @@ public RecipeEnvironmentSiteNameProvider(ISiteService siteService) public async Task PopulateEnvironmentAsync(IDictionary environment) { var siteSettings = await _siteService.GetSiteSettingsAsync(); - if (!String.IsNullOrEmpty(siteSettings.SiteName)) + if (!string.IsNullOrEmpty(siteSettings.SiteName)) { environment[nameof(SiteSettings.SiteName)] = siteSettings.SiteName; } diff --git a/src/OrchardCore.Modules/OrchardCore.Settings/Services/SetupEventHandler.cs b/src/OrchardCore.Modules/OrchardCore.Settings/Services/SetupEventHandler.cs index 1cebcc7c02f..0c7f4cbe411 100644 --- a/src/OrchardCore.Modules/OrchardCore.Settings/Services/SetupEventHandler.cs +++ b/src/OrchardCore.Modules/OrchardCore.Settings/Services/SetupEventHandler.cs @@ -22,9 +22,9 @@ public async Task SetupAsync(SetupContext context) { // Updating site settings. var siteSettings = await _siteService.LoadSiteSettingsAsync(); - siteSettings.SiteName = context.Properties.TryGetValue(SetupConstants.SiteName, out var siteName) ? siteName?.ToString() : String.Empty; - siteSettings.SuperUser = context.Properties.TryGetValue(SetupConstants.AdminUserId, out var adminUserId) ? adminUserId?.ToString() : String.Empty; - siteSettings.TimeZoneId = context.Properties.TryGetValue(SetupConstants.SiteTimeZone, out var siteTimeZone) ? siteTimeZone?.ToString() : String.Empty; + siteSettings.SiteName = context.Properties.TryGetValue(SetupConstants.SiteName, out var siteName) ? siteName?.ToString() : string.Empty; + siteSettings.SuperUser = context.Properties.TryGetValue(SetupConstants.AdminUserId, out var adminUserId) ? adminUserId?.ToString() : string.Empty; + siteSettings.TimeZoneId = context.Properties.TryGetValue(SetupConstants.SiteTimeZone, out var siteTimeZone) ? siteTimeZone?.ToString() : string.Empty; await _siteService.UpdateSiteSettingsAsync(siteSettings); diff --git a/src/OrchardCore.Modules/OrchardCore.Settings/Services/SuperUserHandler.cs b/src/OrchardCore.Modules/OrchardCore.Settings/Services/SuperUserHandler.cs index 07e9050524e..ae37337a7a0 100644 --- a/src/OrchardCore.Modules/OrchardCore.Settings/Services/SuperUserHandler.cs +++ b/src/OrchardCore.Modules/OrchardCore.Settings/Services/SuperUserHandler.cs @@ -29,7 +29,7 @@ public async Task HandleAsync(AuthorizationHandlerContext context) var site = await _siteService.GetSiteSettingsAsync(); - if (String.Equals(userId, site.SuperUser, StringComparison.OrdinalIgnoreCase)) + if (string.Equals(userId, site.SuperUser, StringComparison.OrdinalIgnoreCase)) { SucceedAllRequirements(context); } diff --git a/src/OrchardCore.Modules/OrchardCore.Settings/ViewModels/AdminIndexViewModel.cs b/src/OrchardCore.Modules/OrchardCore.Settings/ViewModels/AdminIndexViewModel.cs index e4f68605f91..7f98ae32787 100644 --- a/src/OrchardCore.Modules/OrchardCore.Settings/ViewModels/AdminIndexViewModel.cs +++ b/src/OrchardCore.Modules/OrchardCore.Settings/ViewModels/AdminIndexViewModel.cs @@ -1,4 +1,4 @@ -namespace OrchardCore.Settings.ViewModels +namespace OrchardCore.Settings.ViewModels { public class AdminIndexViewModel { diff --git a/src/OrchardCore.Modules/OrchardCore.Setup/Controllers/SetupController.cs b/src/OrchardCore.Modules/OrchardCore.Setup/Controllers/SetupController.cs index d1f47006689..d96ec02a46a 100644 --- a/src/OrchardCore.Modules/OrchardCore.Setup/Controllers/SetupController.cs +++ b/src/OrchardCore.Modules/OrchardCore.Setup/Controllers/SetupController.cs @@ -74,13 +74,13 @@ public async Task Index(string token) CopyShellSettingsValues(model); - if (!String.IsNullOrEmpty(_shellSettings["TablePrefix"])) + if (!string.IsNullOrEmpty(_shellSettings["TablePrefix"])) { model.DatabaseConfigurationPreset = true; model.TablePrefix = _shellSettings["TablePrefix"]; } - if (!String.IsNullOrEmpty(_shellSettings["Schema"])) + if (!string.IsNullOrEmpty(_shellSettings["Schema"])) { model.DatabaseConfigurationPreset = true; model.Schema = _shellSettings["Schema"]; @@ -100,7 +100,7 @@ public async Task IndexPOST(SetupViewModel model) model.DatabaseProviders = _databaseProviders; model.Recipes = await _setupService.GetSetupRecipesAsync(); - if (String.IsNullOrEmpty(model.Password)) + if (string.IsNullOrEmpty(model.Password)) { ModelState.AddModelError(nameof(model.Password), S["The password is required."]); } @@ -111,7 +111,7 @@ public async Task IndexPOST(SetupViewModel model) } RecipeDescriptor selectedRecipe = null; - if (!String.IsNullOrEmpty(_shellSettings["RecipeName"])) + if (!string.IsNullOrEmpty(_shellSettings["RecipeName"])) { selectedRecipe = model.Recipes.FirstOrDefault(x => x.Name == _shellSettings["RecipeName"]); if (selectedRecipe == null) @@ -119,18 +119,18 @@ public async Task IndexPOST(SetupViewModel model) ModelState.AddModelError(nameof(model.RecipeName), S["Invalid recipe."]); } } - else if (String.IsNullOrEmpty(model.RecipeName) || (selectedRecipe = model.Recipes.FirstOrDefault(x => x.Name == model.RecipeName)) == null) + else if (string.IsNullOrEmpty(model.RecipeName) || (selectedRecipe = model.Recipes.FirstOrDefault(x => x.Name == model.RecipeName)) == null) { ModelState.AddModelError(nameof(model.RecipeName), S["Invalid recipe."]); } // Only add additional errors if attribute validation has passed. - if (!String.IsNullOrEmpty(model.Email) && !_emailAddressValidator.Validate(model.Email)) + if (!string.IsNullOrEmpty(model.Email) && !_emailAddressValidator.Validate(model.Email)) { ModelState.AddModelError(nameof(model.Email), S["The email is invalid."]); } - if (!String.IsNullOrEmpty(model.UserName) && model.UserName.Any(c => !_identityOptions.User.AllowedUserNameCharacters.Contains(c))) + if (!string.IsNullOrEmpty(model.UserName) && model.UserName.Any(c => !_identityOptions.User.AllowedUserNameCharacters.Contains(c))) { ModelState.AddModelError(nameof(model.UserName), S["User name '{0}' is invalid, can only contain letters or digits.", model.UserName]); } @@ -157,7 +157,7 @@ public async Task IndexPOST(SetupViewModel model) } }; - if (!String.IsNullOrEmpty(_shellSettings["ConnectionString"])) + if (!string.IsNullOrEmpty(_shellSettings["ConnectionString"])) { model.DatabaseConfigurationPreset = true; setupContext.Properties[SetupConstants.DatabaseProvider] = _shellSettings["DatabaseProvider"]; @@ -191,19 +191,19 @@ public async Task IndexPOST(SetupViewModel model) private void CopyShellSettingsValues(SetupViewModel model) { - if (!String.IsNullOrEmpty(_shellSettings["ConnectionString"])) + if (!string.IsNullOrEmpty(_shellSettings["ConnectionString"])) { model.DatabaseConfigurationPreset = true; model.ConnectionString = _shellSettings["ConnectionString"]; } - if (!String.IsNullOrEmpty(_shellSettings["RecipeName"])) + if (!string.IsNullOrEmpty(_shellSettings["RecipeName"])) { model.RecipeNamePreset = true; model.RecipeName = _shellSettings["RecipeName"]; } - if (!String.IsNullOrEmpty(_shellSettings["DatabaseProvider"])) + if (!string.IsNullOrEmpty(_shellSettings["DatabaseProvider"])) { model.DatabaseConfigurationPreset = true; model.DatabaseProvider = _shellSettings["DatabaseProvider"]; @@ -216,9 +216,9 @@ private void CopyShellSettingsValues(SetupViewModel model) private async Task ShouldProceedWithTokenAsync(string token) { - if (!String.IsNullOrWhiteSpace(_shellSettings["Secret"])) + if (!string.IsNullOrWhiteSpace(_shellSettings["Secret"])) { - if (String.IsNullOrEmpty(token) || !await IsTokenValid(token)) + if (string.IsNullOrEmpty(token) || !await IsTokenValid(token)) { _logger.LogWarning("An attempt to access '{TenantName}' without providing a secret was made", _shellSettings.Name); diff --git a/src/OrchardCore.Modules/OrchardCore.Setup/Startup.cs b/src/OrchardCore.Modules/OrchardCore.Setup/Startup.cs index 59219a31ffb..c90188f62bc 100644 --- a/src/OrchardCore.Modules/OrchardCore.Setup/Startup.cs +++ b/src/OrchardCore.Modules/OrchardCore.Setup/Startup.cs @@ -52,7 +52,7 @@ public override void Configure(IApplicationBuilder app, IEndpointRouteBuilder ro var ignoreSystemSettings = serviceProvider.GetService>().Value.IgnoreSystemSettings; var localizationOptionsUpdater = new LocalizationOptionsUpdater(localizationOptions, ignoreSystemSettings); - if (!String.IsNullOrEmpty(_defaultCulture)) + if (!string.IsNullOrEmpty(_defaultCulture)) { localizationOptionsUpdater.SetDefaultCulture(_defaultCulture); _supportedCultures = _supportedCultures.Union(new[] { _defaultCulture }).ToArray(); diff --git a/src/OrchardCore.Modules/OrchardCore.Shortcodes/AdminMenu.cs b/src/OrchardCore.Modules/OrchardCore.Shortcodes/AdminMenu.cs index 3ebb4bf052e..14d5e48d758 100644 --- a/src/OrchardCore.Modules/OrchardCore.Shortcodes/AdminMenu.cs +++ b/src/OrchardCore.Modules/OrchardCore.Shortcodes/AdminMenu.cs @@ -16,7 +16,7 @@ public AdminMenu(IStringLocalizer localizer) public Task BuildNavigationAsync(string name, NavigationBuilder builder) { - if (!String.Equals(name, "admin", StringComparison.OrdinalIgnoreCase)) + if (!string.Equals(name, "admin", StringComparison.OrdinalIgnoreCase)) { return Task.CompletedTask; } diff --git a/src/OrchardCore.Modules/OrchardCore.Shortcodes/Controllers/AdminController.cs b/src/OrchardCore.Modules/OrchardCore.Shortcodes/Controllers/AdminController.cs index 6c96d91304f..c20daa9935a 100644 --- a/src/OrchardCore.Modules/OrchardCore.Shortcodes/Controllers/AdminController.cs +++ b/src/OrchardCore.Modules/OrchardCore.Shortcodes/Controllers/AdminController.cs @@ -72,7 +72,7 @@ public async Task Index(ContentOptions options, PagerParameters p var shortcodeTemplates = shortcodeTemplatesDocument.ShortcodeTemplates.ToList(); - if (!String.IsNullOrWhiteSpace(options.Search)) + if (!string.IsNullOrWhiteSpace(options.Search)) { shortcodeTemplates = shortcodeTemplates.Where(x => x.Key.Contains(options.Search, StringComparison.OrdinalIgnoreCase)).ToList(); } @@ -128,7 +128,7 @@ public async Task CreatePost(ShortcodeTemplateViewModel model, st if (ModelState.IsValid) { - if (String.IsNullOrWhiteSpace(model.Name)) + if (string.IsNullOrWhiteSpace(model.Name)) { ModelState.AddModelError(nameof(ShortcodeTemplateViewModel.Name), S["The name is mandatory."]); } @@ -146,13 +146,13 @@ public async Task CreatePost(ShortcodeTemplateViewModel model, st } } - if (String.IsNullOrEmpty(model.Content)) + if (string.IsNullOrEmpty(model.Content)) { ModelState.AddModelError(nameof(ShortcodeTemplateViewModel.Content), S["The template content is mandatory."]); } else if (!_liquidTemplateManager.Validate(model.Content, out var errors)) { - ModelState.AddModelError(nameof(ShortcodeTemplateViewModel.Content), S["The template doesn't contain a valid Liquid expression. Details: {0}", String.Join(" ", errors)]); + ModelState.AddModelError(nameof(ShortcodeTemplateViewModel.Content), S["The template doesn't contain a valid Liquid expression. Details: {0}", string.Join(" ", errors)]); } } @@ -229,7 +229,7 @@ public async Task Edit(string sourceName, ShortcodeTemplateViewMo if (ModelState.IsValid) { - if (String.IsNullOrWhiteSpace(model.Name)) + if (string.IsNullOrWhiteSpace(model.Name)) { ModelState.AddModelError(nameof(ShortcodeTemplateViewModel.Name), S["The name is mandatory."]); } @@ -237,19 +237,19 @@ public async Task Edit(string sourceName, ShortcodeTemplateViewMo { ModelState.AddModelError(nameof(ShortcodeTemplateViewModel.Name), S["The name contains invalid characters."]); } - else if (!String.Equals(model.Name, sourceName, StringComparison.OrdinalIgnoreCase) + else if (!string.Equals(model.Name, sourceName, StringComparison.OrdinalIgnoreCase) && shortcodeTemplatesDocument.ShortcodeTemplates.ContainsKey(model.Name)) { ModelState.AddModelError(nameof(ShortcodeTemplateViewModel.Name), S["A template with the same name already exists."]); } - if (String.IsNullOrEmpty(model.Content)) + if (string.IsNullOrEmpty(model.Content)) { ModelState.AddModelError(nameof(ShortcodeTemplateViewModel.Content), S["The template content is mandatory."]); } else if (!_liquidTemplateManager.Validate(model.Content, out var errors)) { - ModelState.AddModelError(nameof(ShortcodeTemplateViewModel.Content), S["The template doesn't contain a valid Liquid expression. Details: {0}", String.Join(" ", errors)]); + ModelState.AddModelError(nameof(ShortcodeTemplateViewModel.Content), S["The template doesn't contain a valid Liquid expression. Details: {0}", string.Join(" ", errors)]); } } diff --git a/src/OrchardCore.Modules/OrchardCore.Shortcodes/Properties/AssemblyInfo.cs b/src/OrchardCore.Modules/OrchardCore.Shortcodes/Properties/AssemblyInfo.cs index 0bc36381619..b8e9281b53e 100644 --- a/src/OrchardCore.Modules/OrchardCore.Shortcodes/Properties/AssemblyInfo.cs +++ b/src/OrchardCore.Modules/OrchardCore.Shortcodes/Properties/AssemblyInfo.cs @@ -1,4 +1,4 @@ -using System.Reflection; +using System.Reflection; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following diff --git a/src/OrchardCore.Modules/OrchardCore.Shortcodes/Providers/LocaleShortcodeProvider.cs b/src/OrchardCore.Modules/OrchardCore.Shortcodes/Providers/LocaleShortcodeProvider.cs index 3689018bd0f..9ac31934e53 100644 --- a/src/OrchardCore.Modules/OrchardCore.Shortcodes/Providers/LocaleShortcodeProvider.cs +++ b/src/OrchardCore.Modules/OrchardCore.Shortcodes/Providers/LocaleShortcodeProvider.cs @@ -9,7 +9,7 @@ public class LocaleShortcodeProvider : IShortcodeProvider { public const string ShortCodeIdentifier = "locale"; - private static ValueTask Empty => new(String.Empty); + private static ValueTask Empty => new(string.Empty); private static ValueTask Null => new((string)null); public ValueTask EvaluateAsync(string identifier, Arguments arguments, string content, Context context) diff --git a/src/OrchardCore.Modules/OrchardCore.Shortcodes/Recipes/ShortcodeTemplateStep.cs b/src/OrchardCore.Modules/OrchardCore.Shortcodes/Recipes/ShortcodeTemplateStep.cs index 4cf25a7261d..1491770126a 100644 --- a/src/OrchardCore.Modules/OrchardCore.Shortcodes/Recipes/ShortcodeTemplateStep.cs +++ b/src/OrchardCore.Modules/OrchardCore.Shortcodes/Recipes/ShortcodeTemplateStep.cs @@ -22,7 +22,7 @@ public ShortcodeTemplateStep(ShortcodeTemplatesManager templatesManager) public async Task ExecuteAsync(RecipeExecutionContext context) { - if (!String.Equals(context.Name, "ShortcodeTemplates", StringComparison.OrdinalIgnoreCase)) + if (!string.Equals(context.Name, "ShortcodeTemplates", StringComparison.OrdinalIgnoreCase)) { return; } diff --git a/src/OrchardCore.Modules/OrchardCore.Sitemaps/AdminMenu.cs b/src/OrchardCore.Modules/OrchardCore.Sitemaps/AdminMenu.cs index d357c02180b..63440975bff 100644 --- a/src/OrchardCore.Modules/OrchardCore.Sitemaps/AdminMenu.cs +++ b/src/OrchardCore.Modules/OrchardCore.Sitemaps/AdminMenu.cs @@ -16,7 +16,7 @@ public AdminMenu(IStringLocalizer localizer) public Task BuildNavigationAsync(string name, NavigationBuilder builder) { - if (!String.Equals(name, "admin", StringComparison.OrdinalIgnoreCase)) + if (!string.Equals(name, "admin", StringComparison.OrdinalIgnoreCase)) { return Task.CompletedTask; } diff --git a/src/OrchardCore.Modules/OrchardCore.Sitemaps/Builders/CustomPathSitemapSourceBuilder.cs b/src/OrchardCore.Modules/OrchardCore.Sitemaps/Builders/CustomPathSitemapSourceBuilder.cs index 97eaae9aa4f..39c219e9f3a 100644 --- a/src/OrchardCore.Modules/OrchardCore.Sitemaps/Builders/CustomPathSitemapSourceBuilder.cs +++ b/src/OrchardCore.Modules/OrchardCore.Sitemaps/Builders/CustomPathSitemapSourceBuilder.cs @@ -35,7 +35,7 @@ private static Task BuildUrlsetMetadataAsync(CustomPathSitemapSource sourc private static bool BuildUrl(SitemapBuilderContext context, CustomPathSitemapSource source, XElement url) { - if (String.IsNullOrEmpty(source.Path)) + if (string.IsNullOrEmpty(source.Path)) return false; // Add ~/ to the path, because the it is inserted without leading /. diff --git a/src/OrchardCore.Modules/OrchardCore.Sitemaps/Cache/DefaultSitemapCacheProvider.cs b/src/OrchardCore.Modules/OrchardCore.Sitemaps/Cache/DefaultSitemapCacheProvider.cs index e5cfc4d7b57..e26321dfd61 100644 --- a/src/OrchardCore.Modules/OrchardCore.Sitemaps/Cache/DefaultSitemapCacheProvider.cs +++ b/src/OrchardCore.Modules/OrchardCore.Sitemaps/Cache/DefaultSitemapCacheProvider.cs @@ -61,7 +61,7 @@ public async Task SetSitemapCacheAsync(Stream stream, string cacheFileName, Canc public Task CleanSitemapCacheAsync(IEnumerable validCacheFileNames) { - var folders = _fileProvider.GetDirectoryContents(String.Empty); + var folders = _fileProvider.GetDirectoryContents(string.Empty); foreach (var fileInfo in folders) { if (fileInfo.IsDirectory) @@ -112,7 +112,7 @@ public Task ClearSitemapCacheAsync(string cacheFileName) public Task PurgeAllAsync() { var hasErrors = false; - var folders = _fileProvider.GetDirectoryContents(String.Empty); + var folders = _fileProvider.GetDirectoryContents(string.Empty); foreach (var fileInfo in folders) { if (fileInfo.IsDirectory) @@ -165,7 +165,7 @@ public Task PurgeAsync(string cacheFileName) public Task> ListAsync() { var results = new List(); - var folders = _fileProvider.GetDirectoryContents(String.Empty); + var folders = _fileProvider.GetDirectoryContents(string.Empty); foreach (var fileInfo in folders) { if (fileInfo.IsDirectory) diff --git a/src/OrchardCore.Modules/OrchardCore.Sitemaps/Controllers/AdminController.cs b/src/OrchardCore.Modules/OrchardCore.Sitemaps/Controllers/AdminController.cs index 86e47186ed3..d27d1488688 100644 --- a/src/OrchardCore.Modules/OrchardCore.Sitemaps/Controllers/AdminController.cs +++ b/src/OrchardCore.Modules/OrchardCore.Sitemaps/Controllers/AdminController.cs @@ -77,7 +77,7 @@ public async Task List(ContentOptions options, PagerParameters pa var sitemaps = (await _sitemapManager.GetSitemapsAsync()) .OfType(); - if (!String.IsNullOrWhiteSpace(options.Search)) + if (!string.IsNullOrWhiteSpace(options.Search)) { sitemaps = sitemaps.Where(x => x.Name.Contains(options.Search, StringComparison.OrdinalIgnoreCase)); } @@ -184,7 +184,7 @@ public async Task Create(CreateSitemapViewModel model) if (ModelState.IsValid) { - if (String.IsNullOrEmpty(model.Path)) + if (string.IsNullOrEmpty(model.Path)) { model.Path = _sitemapService.GetSitemapSlug(model.Name); } @@ -253,7 +253,7 @@ public async Task Edit(EditSitemapViewModel model) if (ModelState.IsValid) { - if (String.IsNullOrEmpty(model.Path)) + if (string.IsNullOrEmpty(model.Path)) { model.Path = _sitemapService.GetSitemapSlug(model.Name); } diff --git a/src/OrchardCore.Modules/OrchardCore.Sitemaps/Controllers/SitemapIndexController.cs b/src/OrchardCore.Modules/OrchardCore.Sitemaps/Controllers/SitemapIndexController.cs index f2edfbae2af..d561aaf5606 100644 --- a/src/OrchardCore.Modules/OrchardCore.Sitemaps/Controllers/SitemapIndexController.cs +++ b/src/OrchardCore.Modules/OrchardCore.Sitemaps/Controllers/SitemapIndexController.cs @@ -71,7 +71,7 @@ public async Task List(ContentOptions options, PagerParameters pa var sitemaps = (await _sitemapManager.GetSitemapsAsync()) .OfType(); - if (!String.IsNullOrWhiteSpace(options.Search)) + if (!string.IsNullOrWhiteSpace(options.Search)) { sitemaps = sitemaps.Where(x => x.Name.Contains(options.Search, StringComparison.OrdinalIgnoreCase)); } diff --git a/src/OrchardCore.Modules/OrchardCore.Sitemaps/Controllers/SourceController.cs b/src/OrchardCore.Modules/OrchardCore.Sitemaps/Controllers/SourceController.cs index bc4f8e0befa..32b4b9c3ae8 100644 --- a/src/OrchardCore.Modules/OrchardCore.Sitemaps/Controllers/SourceController.cs +++ b/src/OrchardCore.Modules/OrchardCore.Sitemaps/Controllers/SourceController.cs @@ -142,7 +142,7 @@ public async Task Edit(string sitemapId, string sourceId) return NotFound(); } - var source = sitemap.SitemapSources.FirstOrDefault(x => String.Equals(x.Id, sourceId, StringComparison.OrdinalIgnoreCase)); + var source = sitemap.SitemapSources.FirstOrDefault(x => string.Equals(x.Id, sourceId, StringComparison.OrdinalIgnoreCase)); if (source == null) { @@ -177,7 +177,7 @@ public async Task Edit(EditSourceViewModel model) return NotFound(); } - var source = sitemap.SitemapSources.FirstOrDefault(x => String.Equals(x.Id, model.SitemapSourceId, StringComparison.OrdinalIgnoreCase)); + var source = sitemap.SitemapSources.FirstOrDefault(x => string.Equals(x.Id, model.SitemapSourceId, StringComparison.OrdinalIgnoreCase)); if (source == null) { @@ -216,7 +216,7 @@ public async Task Delete(string sitemapId, string sourceId) return NotFound(); } - var source = sitemap.SitemapSources.FirstOrDefault(x => String.Equals(x.Id, sourceId, StringComparison.OrdinalIgnoreCase)); + var source = sitemap.SitemapSources.FirstOrDefault(x => string.Equals(x.Id, sourceId, StringComparison.OrdinalIgnoreCase)); if (source == null) { diff --git a/src/OrchardCore.Modules/OrchardCore.Sitemaps/Drivers/CustomPathSitemapSourceDriver.cs b/src/OrchardCore.Modules/OrchardCore.Sitemaps/Drivers/CustomPathSitemapSourceDriver.cs index 942ed8e3e14..76f493b2e5b 100644 --- a/src/OrchardCore.Modules/OrchardCore.Sitemaps/Drivers/CustomPathSitemapSourceDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Sitemaps/Drivers/CustomPathSitemapSourceDriver.cs @@ -57,7 +57,7 @@ public override async Task UpdateAsync(CustomPathSitemapSource s if (sitemap.Path?.IndexOfAny(CustomPathSitemapSource.InvalidCharactersForPath) > -1 || sitemap.Path?.IndexOf(' ') > -1 || sitemap.Path?.IndexOf("//") > -1) { - var invalidCharactersForMessage = String.Join(", ", CustomPathSitemapSource.InvalidCharactersForPath.Select(c => $"\"{c}\"")); + var invalidCharactersForMessage = string.Join(", ", CustomPathSitemapSource.InvalidCharactersForPath.Select(c => $"\"{c}\"")); context.Updater.ModelState.AddModelError(Prefix, sitemap.Path, S["Please do not use any of the following characters in your permalink: {0}. No spaces, or consecutive slashes, are allowed (please use dashes or underscores instead).", invalidCharactersForMessage]); } diff --git a/src/OrchardCore.Modules/OrchardCore.Sitemaps/Handlers/SitemapIndexTypeUpdateHandler.cs b/src/OrchardCore.Modules/OrchardCore.Sitemaps/Handlers/SitemapIndexTypeUpdateHandler.cs index 8c80b6576ef..06977ddb2c0 100644 --- a/src/OrchardCore.Modules/OrchardCore.Sitemaps/Handlers/SitemapIndexTypeUpdateHandler.cs +++ b/src/OrchardCore.Modules/OrchardCore.Sitemaps/Handlers/SitemapIndexTypeUpdateHandler.cs @@ -53,12 +53,12 @@ public async Task UpdateSitemapAsync(SitemapUpdateContext context) sitemap.Identifier = IdGenerator.GenerateId(); break; } - else if (source.LimitItems && String.Equals(source.LimitedContentType.ContentTypeName, contentTypeName)) + else if (source.LimitItems && string.Equals(source.LimitedContentType.ContentTypeName, contentTypeName)) { sitemap.Identifier = IdGenerator.GenerateId(); break; } - else if (source.ContentTypes.Any(ct => String.Equals(ct.ContentTypeName, contentTypeName))) + else if (source.ContentTypes.Any(ct => string.Equals(ct.ContentTypeName, contentTypeName))) { sitemap.Identifier = IdGenerator.GenerateId(); break; diff --git a/src/OrchardCore.Modules/OrchardCore.Sitemaps/Recipes/SitemapsStep.cs b/src/OrchardCore.Modules/OrchardCore.Sitemaps/Recipes/SitemapsStep.cs index 2246f3094ad..86774f544fa 100644 --- a/src/OrchardCore.Modules/OrchardCore.Sitemaps/Recipes/SitemapsStep.cs +++ b/src/OrchardCore.Modules/OrchardCore.Sitemaps/Recipes/SitemapsStep.cs @@ -29,7 +29,7 @@ public SitemapsStep(ISitemapManager sitemapManager) public async Task ExecuteAsync(RecipeExecutionContext context) { - if (!String.Equals(context.Name, "Sitemaps", StringComparison.OrdinalIgnoreCase)) + if (!string.Equals(context.Name, "Sitemaps", StringComparison.OrdinalIgnoreCase)) { return; } diff --git a/src/OrchardCore.Modules/OrchardCore.Sitemaps/Routing/SitemapRouteTransformer.cs b/src/OrchardCore.Modules/OrchardCore.Sitemaps/Routing/SitemapRouteTransformer.cs index 9c9847931f0..7c1abc468d4 100644 --- a/src/OrchardCore.Modules/OrchardCore.Sitemaps/Routing/SitemapRouteTransformer.cs +++ b/src/OrchardCore.Modules/OrchardCore.Sitemaps/Routing/SitemapRouteTransformer.cs @@ -23,7 +23,7 @@ public override async ValueTask TransformAsync(HttpContext // Use route value provided by SitemapTransformer template. var path = values["sitemap"] as string; - if (!String.IsNullOrEmpty(path)) + if (!string.IsNullOrEmpty(path)) { (var found, var sitemapId) = await _entries.TryGetSitemapIdByPathAsync(path); diff --git a/src/OrchardCore.Modules/OrchardCore.Sitemaps/Routing/SitemapValuesAddressScheme.cs b/src/OrchardCore.Modules/OrchardCore.Sitemaps/Routing/SitemapValuesAddressScheme.cs index f3a50e9cb9e..15e37947ed6 100644 --- a/src/OrchardCore.Modules/OrchardCore.Sitemaps/Routing/SitemapValuesAddressScheme.cs +++ b/src/OrchardCore.Modules/OrchardCore.Sitemaps/Routing/SitemapValuesAddressScheme.cs @@ -49,7 +49,7 @@ public IEnumerable FindEndpoints(RouteValuesAddress address) { foreach (var entry in address.ExplicitValues) { - if (String.Equals(entry.Key, _options.SitemapIdKey, StringComparison.OrdinalIgnoreCase)) + if (string.Equals(entry.Key, _options.SitemapIdKey, StringComparison.OrdinalIgnoreCase)) { continue; } @@ -80,7 +80,7 @@ private bool Match(RouteValueDictionary explicitValues) { foreach (var entry in _options.GlobalRouteValues) { - if (!String.Equals(explicitValues[entry.Key]?.ToString(), entry.Value?.ToString(), StringComparison.OrdinalIgnoreCase)) + if (!string.Equals(explicitValues[entry.Key]?.ToString(), entry.Value?.ToString(), StringComparison.OrdinalIgnoreCase)) { return false; } diff --git a/src/OrchardCore.Modules/OrchardCore.Sitemaps/Services/RazorPagesContentTypeProvider.cs b/src/OrchardCore.Modules/OrchardCore.Sitemaps/Services/RazorPagesContentTypeProvider.cs index 13f2012db8f..faab2a4abe5 100644 --- a/src/OrchardCore.Modules/OrchardCore.Sitemaps/Services/RazorPagesContentTypeProvider.cs +++ b/src/OrchardCore.Modules/OrchardCore.Sitemaps/Services/RazorPagesContentTypeProvider.cs @@ -30,7 +30,7 @@ public Task GetRouteAsync(SitemapBuilderContext context, ContentItem con var option = _options.ContentTypeOptions.FirstOrDefault(o => o.ContentType == contentItem.ContentType); if (option != null && option.RouteValues != null) { - var pageName = String.IsNullOrEmpty(option.PageName) ? option.ContentType : option.PageName; + var pageName = string.IsNullOrEmpty(option.PageName) ? option.ContentType : option.PageName; // When used from outside a razor page name must start with a / if (!pageName.StartsWith('/')) diff --git a/src/OrchardCore.Modules/OrchardCore.Sitemaps/Services/SitemapHelperService.cs b/src/OrchardCore.Modules/OrchardCore.Sitemaps/Services/SitemapHelperService.cs index f72fb0cb278..8aaa0df2b1f 100644 --- a/src/OrchardCore.Modules/OrchardCore.Sitemaps/Services/SitemapHelperService.cs +++ b/src/OrchardCore.Modules/OrchardCore.Sitemaps/Services/SitemapHelperService.cs @@ -42,7 +42,7 @@ public async Task ValidatePathAsync(string path, IUpdateModel updater, string si if (path.IndexOfAny(InvalidCharactersForPath) > -1 || path.IndexOf(' ') > -1) { - var invalidCharactersForMessage = String.Join(", ", InvalidCharactersForPath.Select(c => $"\"{c}\"")); + var invalidCharactersForMessage = string.Join(", ", InvalidCharactersForPath.Select(c => $"\"{c}\"")); updater.ModelState.AddModelError(Prefix, Path, S["Please do not use any of the following characters in your permalink: {0}. No spaces are allowed (please use dashes or underscores instead).", invalidCharactersForMessage]); } @@ -58,15 +58,15 @@ public async Task ValidatePathAsync(string path, IUpdateModel updater, string si } var routeExists = false; - if (String.IsNullOrEmpty(sitemapId)) + if (string.IsNullOrEmpty(sitemapId)) { routeExists = (await _sitemapManager.GetSitemapsAsync()) - .Any(p => String.Equals(p.Path, path.TrimStart('/'), StringComparison.OrdinalIgnoreCase)); + .Any(p => string.Equals(p.Path, path.TrimStart('/'), StringComparison.OrdinalIgnoreCase)); } else { routeExists = (await _sitemapManager.GetSitemapsAsync()) - .Any(p => p.SitemapId != sitemapId && String.Equals(p.Path, path.TrimStart('/'), StringComparison.OrdinalIgnoreCase)); + .Any(p => p.SitemapId != sitemapId && string.Equals(p.Path, path.TrimStart('/'), StringComparison.OrdinalIgnoreCase)); } if (routeExists) diff --git a/src/OrchardCore.Modules/OrchardCore.Sitemaps/Services/SitemapsRobotsProvider.cs b/src/OrchardCore.Modules/OrchardCore.Sitemaps/Services/SitemapsRobotsProvider.cs index 21f4714464e..729a2311267 100644 --- a/src/OrchardCore.Modules/OrchardCore.Sitemaps/Services/SitemapsRobotsProvider.cs +++ b/src/OrchardCore.Modules/OrchardCore.Sitemaps/Services/SitemapsRobotsProvider.cs @@ -27,7 +27,7 @@ public async Task GetContentAsync() { var site = await _siteService.GetSiteSettingsAsync(); - if (String.IsNullOrEmpty(site.BaseUrl)) + if (string.IsNullOrEmpty(site.BaseUrl)) { // Can't create sitemap links if there is not set base-url. diff --git a/src/OrchardCore.Modules/OrchardCore.Sms/AdminMenu.cs b/src/OrchardCore.Modules/OrchardCore.Sms/AdminMenu.cs index f703445af89..de7455879a6 100644 --- a/src/OrchardCore.Modules/OrchardCore.Sms/AdminMenu.cs +++ b/src/OrchardCore.Modules/OrchardCore.Sms/AdminMenu.cs @@ -16,7 +16,7 @@ public AdminMenu(IStringLocalizer stringLocalizer) public Task BuildNavigationAsync(string name, NavigationBuilder builder) { - if (!String.Equals(name, "admin", StringComparison.OrdinalIgnoreCase)) + if (!string.Equals(name, "admin", StringComparison.OrdinalIgnoreCase)) { return Task.CompletedTask; } diff --git a/src/OrchardCore.Modules/OrchardCore.Sms/Drivers/SmsTaskDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.Sms/Drivers/SmsTaskDisplayDriver.cs index 2d20eb4f6f1..d54d9b9992d 100644 --- a/src/OrchardCore.Modules/OrchardCore.Sms/Drivers/SmsTaskDisplayDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Sms/Drivers/SmsTaskDisplayDriver.cs @@ -41,7 +41,7 @@ public async override Task UpdateAsync(SmsTask activity, IUpdate if (await updater.TryUpdateModelAsync(viewModel, Prefix)) { - if (String.IsNullOrWhiteSpace(viewModel.PhoneNumber)) + if (string.IsNullOrWhiteSpace(viewModel.PhoneNumber)) { updater.ModelState.AddModelError(Prefix, nameof(viewModel.PhoneNumber), S["Phone number requires a value."]); } @@ -50,13 +50,13 @@ public async override Task UpdateAsync(SmsTask activity, IUpdate updater.ModelState.AddModelError(Prefix, nameof(viewModel.PhoneNumber), S["Invalid phone number used."]); } - if (String.IsNullOrWhiteSpace(viewModel.Body)) + if (string.IsNullOrWhiteSpace(viewModel.Body)) { updater.ModelState.AddModelError(Prefix, nameof(viewModel.Body), S["Message Body requires a value."]); } else if (!_liquidTemplateManager.Validate(viewModel.Body, out var bodyErrors)) { - updater.ModelState.AddModelError(Prefix, nameof(viewModel.Body), String.Join(' ', bodyErrors)); + updater.ModelState.AddModelError(Prefix, nameof(viewModel.Body), string.Join(' ', bodyErrors)); } activity.PhoneNumber = new WorkflowExpression(viewModel.PhoneNumber); diff --git a/src/OrchardCore.Modules/OrchardCore.Sms/Drivers/TwilioSettingsDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.Sms/Drivers/TwilioSettingsDisplayDriver.cs index 3dc6cfed411..4fc0dff2d15 100644 --- a/src/OrchardCore.Modules/OrchardCore.Sms/Drivers/TwilioSettingsDisplayDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Sms/Drivers/TwilioSettingsDisplayDriver.cs @@ -51,7 +51,7 @@ public override async Task EditAsync(TwilioSettings settings, Bu { model.PhoneNumber = settings.PhoneNumber; model.AccountSID = settings.AccountSID; - model.HasAuthToken = !String.IsNullOrEmpty(settings.AuthToken); + model.HasAuthToken = !string.IsNullOrEmpty(settings.AuthToken); }).Location("Content:5") .OnGroup(SmsSettings.GroupId); } @@ -70,7 +70,7 @@ public override async Task UpdateAsync(TwilioSettings settings, if (await context.Updater.TryUpdateModelAsync(model, Prefix) && model.DefaultProvider == TwilioSmsProvider.TechnicalName) { - if (String.IsNullOrWhiteSpace(model.PhoneNumber)) + if (string.IsNullOrWhiteSpace(model.PhoneNumber)) { context.Updater.ModelState.AddModelError(Prefix, nameof(model.PhoneNumber), S["Phone number requires a value."]); } @@ -79,12 +79,12 @@ public override async Task UpdateAsync(TwilioSettings settings, context.Updater.ModelState.AddModelError(Prefix, nameof(model.PhoneNumber), S["Please provide a valid phone number."]); } - if (String.IsNullOrWhiteSpace(model.AccountSID)) + if (string.IsNullOrWhiteSpace(model.AccountSID)) { context.Updater.ModelState.AddModelError(Prefix, nameof(model.AccountSID), S["Account SID requires a value."]); } - if (settings.AuthToken == null && String.IsNullOrWhiteSpace(model.AuthToken)) + if (settings.AuthToken == null && string.IsNullOrWhiteSpace(model.AuthToken)) { context.Updater.ModelState.AddModelError(Prefix, nameof(model.AuthToken), S["Auth Token required a value."]); } @@ -92,7 +92,7 @@ public override async Task UpdateAsync(TwilioSettings settings, settings.PhoneNumber = model.PhoneNumber; settings.AccountSID = model.AccountSID; - if (!String.IsNullOrWhiteSpace(model.AuthToken)) + if (!string.IsNullOrWhiteSpace(model.AuthToken)) { var protector = _dataProtectionProvider.CreateProtector(TwilioSmsProvider.ProtectorName); diff --git a/src/OrchardCore.Modules/OrchardCore.Sms/ViewModels/SmsSettingsBaseViewModel.cs b/src/OrchardCore.Modules/OrchardCore.Sms/ViewModels/SmsSettingsBaseViewModel.cs index c3a0e43368e..f29b6c6d5a3 100644 --- a/src/OrchardCore.Modules/OrchardCore.Sms/ViewModels/SmsSettingsBaseViewModel.cs +++ b/src/OrchardCore.Modules/OrchardCore.Sms/ViewModels/SmsSettingsBaseViewModel.cs @@ -1,4 +1,4 @@ -namespace OrchardCore.Sms.ViewModels; +namespace OrchardCore.Sms.ViewModels; public class SmsSettingsBaseViewModel { diff --git a/src/OrchardCore.Modules/OrchardCore.Spatial/Drivers/GeoPointFieldDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.Spatial/Drivers/GeoPointFieldDisplayDriver.cs index dbb9c89ef76..cbdf28fb36d 100644 --- a/src/OrchardCore.Modules/OrchardCore.Spatial/Drivers/GeoPointFieldDisplayDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Spatial/Drivers/GeoPointFieldDisplayDriver.cs @@ -61,7 +61,7 @@ public override async Task UpdateAsync(GeoPointField field, IUpd var settings = context.PartFieldDefinition.GetSettings(); - if (String.IsNullOrWhiteSpace(viewModel.Latitude)) + if (string.IsNullOrWhiteSpace(viewModel.Latitude)) { if (settings.Required) { @@ -72,7 +72,7 @@ public override async Task UpdateAsync(GeoPointField field, IUpd field.Latitude = null; } } - else if (!Decimal.TryParse(viewModel.Latitude, NumberStyles.Any, CultureInfo.InvariantCulture, out latitude)) + else if (!decimal.TryParse(viewModel.Latitude, NumberStyles.Any, CultureInfo.InvariantCulture, out latitude)) { updater.ModelState.AddModelError(Prefix, nameof(viewModel.Latitude), S["{0} is an invalid number.", context.PartFieldDefinition.DisplayName()]); } @@ -81,7 +81,7 @@ public override async Task UpdateAsync(GeoPointField field, IUpd field.Latitude = latitude; } - if (String.IsNullOrWhiteSpace(viewModel.Longitude)) + if (string.IsNullOrWhiteSpace(viewModel.Longitude)) { if (settings.Required) { @@ -92,7 +92,7 @@ public override async Task UpdateAsync(GeoPointField field, IUpd field.Longitude = null; } } - else if (!Decimal.TryParse(viewModel.Longitude, NumberStyles.Any, CultureInfo.InvariantCulture, out longitude)) + else if (!decimal.TryParse(viewModel.Longitude, NumberStyles.Any, CultureInfo.InvariantCulture, out longitude)) { updater.ModelState.AddModelError(Prefix, nameof(viewModel.Longitude), S["{0} is an invalid number.", context.PartFieldDefinition.DisplayName()]); } diff --git a/src/OrchardCore.Modules/OrchardCore.Taxonomies/AdminMenu.cs b/src/OrchardCore.Modules/OrchardCore.Taxonomies/AdminMenu.cs index 792b846a551..1e8fe028b50 100644 --- a/src/OrchardCore.Modules/OrchardCore.Taxonomies/AdminMenu.cs +++ b/src/OrchardCore.Modules/OrchardCore.Taxonomies/AdminMenu.cs @@ -17,7 +17,7 @@ public AdminMenu(IStringLocalizer localizer) public Task BuildNavigationAsync(string name, NavigationBuilder builder) { - if (!String.Equals(name, "admin", StringComparison.OrdinalIgnoreCase)) + if (!string.Equals(name, "admin", StringComparison.OrdinalIgnoreCase)) { return Task.CompletedTask; } diff --git a/src/OrchardCore.Modules/OrchardCore.Taxonomies/Controllers/AdminController.cs b/src/OrchardCore.Modules/OrchardCore.Taxonomies/Controllers/AdminController.cs index 8ffb44be0ad..99ae1c61272 100644 --- a/src/OrchardCore.Modules/OrchardCore.Taxonomies/Controllers/AdminController.cs +++ b/src/OrchardCore.Modules/OrchardCore.Taxonomies/Controllers/AdminController.cs @@ -49,7 +49,7 @@ public AdminController( public async Task Create(string id, string taxonomyContentItemId, string taxonomyItemId) { - if (String.IsNullOrWhiteSpace(id)) + if (string.IsNullOrWhiteSpace(id)) { return NotFound(); } @@ -80,7 +80,7 @@ public async Task Create(string id, string taxonomyContentItemId, [ActionName("Create")] public async Task CreatePost(string id, string taxonomyContentItemId, string taxonomyItemId) { - if (String.IsNullOrWhiteSpace(id)) + if (string.IsNullOrWhiteSpace(id)) { return NotFound(); } @@ -160,7 +160,7 @@ public async Task CreatePost(string id, string taxonomyContentIte public async Task Edit(string taxonomyContentItemId, string taxonomyItemId) { - if (String.IsNullOrWhiteSpace(taxonomyContentItemId) || String.IsNullOrWhiteSpace(taxonomyItemId)) + if (string.IsNullOrWhiteSpace(taxonomyContentItemId) || string.IsNullOrWhiteSpace(taxonomyItemId)) { return NotFound(); } @@ -202,7 +202,7 @@ public async Task Edit(string taxonomyContentItemId, string taxon [ActionName("Edit")] public async Task EditPost(string taxonomyContentItemId, string taxonomyItemId) { - if (String.IsNullOrWhiteSpace(taxonomyContentItemId) || String.IsNullOrWhiteSpace(taxonomyItemId)) + if (string.IsNullOrWhiteSpace(taxonomyContentItemId) || string.IsNullOrWhiteSpace(taxonomyItemId)) { return NotFound(); } @@ -276,7 +276,7 @@ public async Task EditPost(string taxonomyContentItemId, string t [HttpPost] public async Task Delete(string taxonomyContentItemId, string taxonomyItemId) { - if (String.IsNullOrWhiteSpace(taxonomyContentItemId) || String.IsNullOrWhiteSpace(taxonomyItemId)) + if (string.IsNullOrWhiteSpace(taxonomyContentItemId) || string.IsNullOrWhiteSpace(taxonomyItemId)) { return NotFound(); } diff --git a/src/OrchardCore.Modules/OrchardCore.Taxonomies/Drivers/TaxonomyContentsAdminListDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.Taxonomies/Drivers/TaxonomyContentsAdminListDisplayDriver.cs index 7fc432a2bf5..ae6d07f2b43 100644 --- a/src/OrchardCore.Modules/OrchardCore.Taxonomies/Drivers/TaxonomyContentsAdminListDisplayDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Taxonomies/Drivers/TaxonomyContentsAdminListDisplayDriver.cs @@ -52,7 +52,7 @@ public override async Task EditAsync(ContentOptionsViewModel mod } var taxonomyContentItemIds = settings.TaxonomyContentItemIds; - if (!String.IsNullOrEmpty(model.SelectedContentType)) + if (!string.IsNullOrEmpty(model.SelectedContentType)) { var contentTypeDefinition = _contentDefinitionManager.GetTypeDefinition(model.SelectedContentType); var fieldDefinitions = contentTypeDefinition @@ -122,7 +122,7 @@ public override async Task UpdateAsync(ContentOptionsViewModel m var viewModel = new TaxonomyContentsAdminFilterViewModel(); if (await updater.TryUpdateModelAsync(viewModel, "Taxonomy" + contentItemId)) { - if (!String.IsNullOrEmpty(viewModel.SelectedContentItemId)) + if (!string.IsNullOrEmpty(viewModel.SelectedContentItemId)) { model.RouteValues.TryAdd("Taxonomy" + contentItemId + ".SelectedContentItemId", viewModel.SelectedContentItemId); } diff --git a/src/OrchardCore.Modules/OrchardCore.Taxonomies/Drivers/TaxonomyFieldDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.Taxonomies/Drivers/TaxonomyFieldDisplayDriver.cs index 44db207895d..6228ea50af5 100644 --- a/src/OrchardCore.Modules/OrchardCore.Taxonomies/Drivers/TaxonomyFieldDisplayDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Taxonomies/Drivers/TaxonomyFieldDisplayDriver.cs @@ -74,7 +74,7 @@ public override async Task UpdateAsync(TaxonomyField field, IUpd field.TaxonomyContentItemId = settings.TaxonomyContentItemId; field.TermContentItemIds = model.TermEntries.Where(x => x.Selected).Select(x => x.ContentItemId).ToArray(); - if (settings.Unique && !String.IsNullOrEmpty(model.UniqueValue)) + if (settings.Unique && !string.IsNullOrEmpty(model.UniqueValue)) { field.TermContentItemIds = new[] { model.UniqueValue }; } diff --git a/src/OrchardCore.Modules/OrchardCore.Taxonomies/Drivers/TaxonomyPartDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.Taxonomies/Drivers/TaxonomyPartDisplayDriver.cs index 4c1826b2f4e..88974b14623 100644 --- a/src/OrchardCore.Modules/OrchardCore.Taxonomies/Drivers/TaxonomyPartDisplayDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Taxonomies/Drivers/TaxonomyPartDisplayDriver.cs @@ -42,7 +42,7 @@ public override async Task UpdateAsync(TaxonomyPart part, IUpdat if (await updater.TryUpdateModelAsync(model, Prefix, t => t.Hierarchy, t => t.TermContentType)) { - if (!String.IsNullOrWhiteSpace(model.Hierarchy)) + if (!string.IsNullOrWhiteSpace(model.Hierarchy)) { var originalTaxonomyItems = part.ContentItem.As(); diff --git a/src/OrchardCore.Modules/OrchardCore.Taxonomies/Drivers/TermPartContentDriver.cs b/src/OrchardCore.Modules/OrchardCore.Taxonomies/Drivers/TermPartContentDriver.cs index 221b479ca52..82c0f02e403 100644 --- a/src/OrchardCore.Modules/OrchardCore.Taxonomies/Drivers/TermPartContentDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Taxonomies/Drivers/TermPartContentDriver.cs @@ -57,7 +57,7 @@ private async Task> QueryTermItemsAsync(TermPart termPa { if (pager.Before != null) { - var beforeValue = new DateTime(Int64.Parse(pager.Before)); + var beforeValue = new DateTime(long.Parse(pager.Before)); var query = _session.Query() .With(x => x.TermContentItemId == termPart.ContentItem.ContentItemId) .With(CreateContentIndexFilter(beforeValue, null)) @@ -87,7 +87,7 @@ private async Task> QueryTermItemsAsync(TermPart termPa } else if (pager.After != null) { - var afterValue = new DateTime(Int64.Parse(pager.After)); + var afterValue = new DateTime(long.Parse(pager.After)); var query = _session.Query() .With(x => x.TermContentItemId == termPart.ContentItem.ContentItemId) .With(CreateContentIndexFilter(null, afterValue)) diff --git a/src/OrchardCore.Modules/OrchardCore.Taxonomies/Services/TaxonomyContentsAdminListFilter.cs b/src/OrchardCore.Modules/OrchardCore.Taxonomies/Services/TaxonomyContentsAdminListFilter.cs index 26bc652b07d..029f9c4932f 100644 --- a/src/OrchardCore.Modules/OrchardCore.Taxonomies/Services/TaxonomyContentsAdminListFilter.cs +++ b/src/OrchardCore.Modules/OrchardCore.Taxonomies/Services/TaxonomyContentsAdminListFilter.cs @@ -34,7 +34,7 @@ public async Task FilterAsync(ContentOptionsViewModel model, IQuery if (await updater.TryUpdateModelAsync(viewModel, "Taxonomy" + contentItemId)) { // Show all items categorized by the taxonomy - if (!String.IsNullOrEmpty(viewModel.SelectedContentItemId)) + if (!string.IsNullOrEmpty(viewModel.SelectedContentItemId)) { if (viewModel.SelectedContentItemId.StartsWith("Taxonomy:", StringComparison.OrdinalIgnoreCase)) { diff --git a/src/OrchardCore.Modules/OrchardCore.Taxonomies/Settings/TaxonomyContentsAdminListSettingsDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.Taxonomies/Settings/TaxonomyContentsAdminListSettingsDisplayDriver.cs index 3ee4aea683e..34a69553ef9 100644 --- a/src/OrchardCore.Modules/OrchardCore.Taxonomies/Settings/TaxonomyContentsAdminListSettingsDisplayDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Taxonomies/Settings/TaxonomyContentsAdminListSettingsDisplayDriver.cs @@ -46,7 +46,7 @@ public override async Task EditAsync(TaxonomyContentsAdminListSe { DisplayText = x.DisplayText, ContentItemId = x.ContentItemId, - IsChecked = settings.TaxonomyContentItemIds.Any(id => String.Equals(x.ContentItemId, id, StringComparison.OrdinalIgnoreCase)) + IsChecked = settings.TaxonomyContentItemIds.Any(id => string.Equals(x.ContentItemId, id, StringComparison.OrdinalIgnoreCase)) }).ToArray(); return Initialize("TaxonomyContentsAdminListSettings_Edit", model => diff --git a/src/OrchardCore.Modules/OrchardCore.Taxonomies/Startup.cs b/src/OrchardCore.Modules/OrchardCore.Taxonomies/Startup.cs index e00d418c89b..392517faa5b 100644 --- a/src/OrchardCore.Modules/OrchardCore.Taxonomies/Startup.cs +++ b/src/OrchardCore.Modules/OrchardCore.Taxonomies/Startup.cs @@ -71,7 +71,7 @@ public override void ConfigureServices(IServiceCollection services) // Taxonomy Field services.AddContentField() - .UseDisplayDriver(d => !String.Equals(d, "Tags", StringComparison.OrdinalIgnoreCase)) + .UseDisplayDriver(d => !string.Equals(d, "Tags", StringComparison.OrdinalIgnoreCase)) .AddHandler(); services.AddScoped(); @@ -79,7 +79,7 @@ public override void ConfigureServices(IServiceCollection services) // Taxonomy Tags Display Mode and Editor. services.AddContentField() - .UseDisplayDriver(d => String.Equals(d, "Tags", StringComparison.OrdinalIgnoreCase)); + .UseDisplayDriver(d => string.Equals(d, "Tags", StringComparison.OrdinalIgnoreCase)); services.AddScoped(); diff --git a/src/OrchardCore.Modules/OrchardCore.Taxonomies/TermShapes.cs b/src/OrchardCore.Modules/OrchardCore.Taxonomies/TermShapes.cs index fe3db285367..6e34edcb81c 100644 --- a/src/OrchardCore.Modules/OrchardCore.Taxonomies/TermShapes.cs +++ b/src/OrchardCore.Modules/OrchardCore.Taxonomies/TermShapes.cs @@ -43,7 +43,7 @@ public void Discover(ShapeTableBuilder builder) var termShape = context.Shape; var identifier = termShape.GetProperty("TaxonomyContentItemId") ?? termShape.GetProperty("Alias"); - if (String.IsNullOrEmpty(identifier)) + if (string.IsNullOrEmpty(identifier)) { return; } @@ -87,7 +87,7 @@ public void Discover(ShapeTableBuilder builder) var level = 0; List termItems = null; var termContentItemId = termShape.GetProperty("TermContentItemId"); - if (!String.IsNullOrEmpty(termContentItemId)) + if (!string.IsNullOrEmpty(termContentItemId)) { level = FindTerm(taxonomyContentItem.Content.TaxonomyPart.Terms as JArray, termContentItemId, level, out var termContentItem); @@ -113,7 +113,7 @@ public void Discover(ShapeTableBuilder builder) var differentiator = FormatName(termShape.GetProperty("TaxonomyName")); - if (!String.IsNullOrEmpty(differentiator)) + if (!string.IsNullOrEmpty(differentiator)) { // Term__[Differentiator] e.g. Term-Categories, Term-Tags. termShape.Metadata.Alternates.Add("Term__" + differentiator); @@ -201,7 +201,7 @@ public void Discover(ShapeTableBuilder builder) termItem.Metadata.Alternates.Add("TermItem__" + encodedContentType); termItem.Metadata.Alternates.Add("TermItem__" + encodedContentType + "__level__" + level); - if (!String.IsNullOrEmpty(differentiator)) + if (!string.IsNullOrEmpty(differentiator)) { // TermItem__[Differentiator] e.g. TermItem-Categories, TermItem-Travel. // TermItem__[Differentiator]__level__[level] e.g. TermItem-Categories-level-2. @@ -233,7 +233,7 @@ public void Discover(ShapeTableBuilder builder) termItem.Metadata.Alternates.Add("TermContentItem__" + encodedContentType); termItem.Metadata.Alternates.Add("TermContentItem__" + encodedContentType + "__level__" + level); - if (!String.IsNullOrEmpty(differentiator)) + if (!string.IsNullOrEmpty(differentiator)) { // TermContentItem__[Differentiator] e.g. TermContentItem-Categories. termItem.Metadata.Alternates.Add("TermContentItem__" + differentiator); @@ -282,7 +282,7 @@ private int FindTerm(JArray termsArray, string termContentItemId, int level, out /// private static string FormatName(string name) { - if (String.IsNullOrEmpty(name)) + if (string.IsNullOrEmpty(name)) { return null; } @@ -294,7 +294,7 @@ private static string FormatName(string name) { var c = name[i]; - if (c == '-' || Char.IsWhiteSpace(c)) + if (c == '-' || char.IsWhiteSpace(c)) { nextIsUpper = true; continue; diff --git a/src/OrchardCore.Modules/OrchardCore.Templates/AdminMenu.cs b/src/OrchardCore.Modules/OrchardCore.Templates/AdminMenu.cs index 262bf5c908f..0c50ab2508a 100644 --- a/src/OrchardCore.Modules/OrchardCore.Templates/AdminMenu.cs +++ b/src/OrchardCore.Modules/OrchardCore.Templates/AdminMenu.cs @@ -16,7 +16,7 @@ public AdminMenu(IStringLocalizer localizer) public Task BuildNavigationAsync(string name, NavigationBuilder builder) { - if (!String.Equals(name, "admin", StringComparison.OrdinalIgnoreCase)) + if (!string.Equals(name, "admin", StringComparison.OrdinalIgnoreCase)) { return Task.CompletedTask; } diff --git a/src/OrchardCore.Modules/OrchardCore.Templates/AdminTemplatesAdminMenu.cs b/src/OrchardCore.Modules/OrchardCore.Templates/AdminTemplatesAdminMenu.cs index 9cb6b09e997..50a745f1557 100644 --- a/src/OrchardCore.Modules/OrchardCore.Templates/AdminTemplatesAdminMenu.cs +++ b/src/OrchardCore.Modules/OrchardCore.Templates/AdminTemplatesAdminMenu.cs @@ -16,7 +16,7 @@ public AdminTemplatesAdminMenu(IStringLocalizer localiz public Task BuildNavigationAsync(string name, NavigationBuilder builder) { - if (!String.Equals(name, "admin", StringComparison.OrdinalIgnoreCase)) + if (!string.Equals(name, "admin", StringComparison.OrdinalIgnoreCase)) { return Task.CompletedTask; } diff --git a/src/OrchardCore.Modules/OrchardCore.Templates/Controllers/PreviewController.cs b/src/OrchardCore.Modules/OrchardCore.Templates/Controllers/PreviewController.cs index aa528e93fbc..6704c665dd4 100644 --- a/src/OrchardCore.Modules/OrchardCore.Templates/Controllers/PreviewController.cs +++ b/src/OrchardCore.Modules/OrchardCore.Templates/Controllers/PreviewController.cs @@ -59,7 +59,7 @@ public async Task Render() var name = Request.Form["Name"]; var content = Request.Form["Content"]; - if (!String.IsNullOrEmpty(name) && !String.IsNullOrEmpty(content)) + if (!string.IsNullOrEmpty(name) && !string.IsNullOrEmpty(content)) { HttpContext.Items["OrchardCore.PreviewTemplate"] = new TemplateViewModel { Name = name, Content = content }; } @@ -68,7 +68,7 @@ public async Task Render() string contentItemId; - if (String.IsNullOrEmpty(handle) || handle == _homeUrl) + if (string.IsNullOrEmpty(handle) || handle == _homeUrl) { var homeRoute = (await _siteService.GetSiteSettingsAsync()).HomeRoute; contentItemId = homeRoute["contentItemId"]?.ToString(); @@ -83,7 +83,7 @@ public async Task Render() contentItemId = await _contentHandleManager.GetContentItemIdAsync("slug:" + handle); } - if (String.IsNullOrEmpty(contentItemId)) + if (string.IsNullOrEmpty(contentItemId)) { return NotFound(); } diff --git a/src/OrchardCore.Modules/OrchardCore.Templates/Controllers/TemplateController.cs b/src/OrchardCore.Modules/OrchardCore.Templates/Controllers/TemplateController.cs index ebc1d504e16..6dc12f24088 100644 --- a/src/OrchardCore.Modules/OrchardCore.Templates/Controllers/TemplateController.cs +++ b/src/OrchardCore.Modules/OrchardCore.Templates/Controllers/TemplateController.cs @@ -80,7 +80,7 @@ public async Task Index(ContentOptions options, PagerParameters p var templates = templatesDocument.Templates.ToList(); - if (!String.IsNullOrWhiteSpace(options.Search)) + if (!string.IsNullOrWhiteSpace(options.Search)) { templates = templates.Where(x => x.Key.Contains(options.Search, StringComparison.OrdinalIgnoreCase)).ToList(); } @@ -149,11 +149,11 @@ public async Task CreatePost(TemplateViewModel model, string subm if (ModelState.IsValid) { - if (String.IsNullOrWhiteSpace(model.Name)) + if (string.IsNullOrWhiteSpace(model.Name)) { ModelState.AddModelError(nameof(TemplateViewModel.Name), S["The name is mandatory."]); } - else if (String.IsNullOrWhiteSpace(model.Content)) + else if (string.IsNullOrWhiteSpace(model.Content)) { ModelState.AddModelError(nameof(TemplateViewModel.Content), S["The content is mandatory."]); } @@ -252,7 +252,7 @@ public async Task Edit(string sourceName, TemplateViewModel model if (ModelState.IsValid) { - if (String.IsNullOrWhiteSpace(model.Name)) + if (string.IsNullOrWhiteSpace(model.Name)) { ModelState.AddModelError(nameof(TemplateViewModel.Name), S["The name is mandatory."]); } @@ -260,7 +260,7 @@ public async Task Edit(string sourceName, TemplateViewModel model { ModelState.AddModelError(nameof(TemplateViewModel.Name), S["A template with the same name already exists."]); } - else if (String.IsNullOrWhiteSpace(model.Content)) + else if (string.IsNullOrWhiteSpace(model.Content)) { ModelState.AddModelError(nameof(TemplateViewModel.Content), S["The content is mandatory."]); } @@ -377,7 +377,7 @@ public async Task ListPost(ContentOptions options, IEnumerable localizer, ShellSettings shellSetti public Task BuildNavigationAsync(string name, NavigationBuilder builder) { - if (!String.Equals(name, "admin", StringComparison.OrdinalIgnoreCase)) + if (!string.Equals(name, "admin", StringComparison.OrdinalIgnoreCase)) { return Task.CompletedTask; } diff --git a/src/OrchardCore.Modules/OrchardCore.Tenants/Controllers/AdminController.cs b/src/OrchardCore.Modules/OrchardCore.Tenants/Controllers/AdminController.cs index b3dee6776a3..1a87a18fde0 100644 --- a/src/OrchardCore.Modules/OrchardCore.Tenants/Controllers/AdminController.cs +++ b/src/OrchardCore.Modules/OrchardCore.Tenants/Controllers/AdminController.cs @@ -116,7 +116,7 @@ public async Task Index(TenantIndexOptions options, PagerParamete ShellSettings = settings, }; - if (settings.IsUninitialized() && !String.IsNullOrEmpty(settings["Secret"])) + if (settings.IsUninitialized() && !string.IsNullOrEmpty(settings["Secret"])) { entry.Token = dataProtector.Protect(settings["Secret"], _clock.UtcNow.Add(new TimeSpan(24, 0, 0))); } @@ -124,7 +124,7 @@ public async Task Index(TenantIndexOptions options, PagerParamete return entry; }).ToList(); - if (!String.IsNullOrWhiteSpace(options.Search)) + if (!string.IsNullOrWhiteSpace(options.Search)) { entries = entries.Where(t => t.Name.IndexOf(options.Search, StringComparison.OrdinalIgnoreCase) > -1 || (t.ShellSettings != null && @@ -132,7 +132,7 @@ public async Task Index(TenantIndexOptions options, PagerParamete (t.ShellSettings.RequestUrlPrefix != null && t.ShellSettings.RequestUrlPrefix.IndexOf(options.Search, StringComparison.OrdinalIgnoreCase) > -1)))).ToList(); } - if (!String.IsNullOrWhiteSpace(options.Category)) + if (!string.IsNullOrWhiteSpace(options.Category)) { entries = entries.Where(t => t.Category?.Equals(options.Category, StringComparison.OrdinalIgnoreCase) == true).ToList(); } @@ -175,14 +175,14 @@ public async Task Index(TenantIndexOptions options, PagerParamete // We populate the SelectLists model.Options.TenantsCategories = allSettings .GroupBy(t => t["Category"]) - .Where(t => !String.IsNullOrEmpty(t.Key)) - .Select(t => new SelectListItem(t.Key, t.Key, String.Equals(options.Category, t.Key, StringComparison.OrdinalIgnoreCase))) + .Where(t => !string.IsNullOrEmpty(t.Key)) + .Select(t => new SelectListItem(t.Key, t.Key, string.Equals(options.Category, t.Key, StringComparison.OrdinalIgnoreCase))) .ToList(); model.Options.TenantsCategories.Insert(0, new SelectListItem( S["All"], - String.Empty, - selected: String.IsNullOrEmpty(options.Category))); + string.Empty, + selected: string.IsNullOrEmpty(options.Category))); model.Options.TenantsStates = new List() { new SelectListItem() { Text = S["All states"], Value = nameof(TenantsState.All) }, @@ -319,8 +319,8 @@ public async Task Create() }; model.DatabaseConfigurationPreset = - !String.IsNullOrEmpty(model.ConnectionString) || - !String.IsNullOrEmpty(model.DatabaseProvider); + !string.IsNullOrEmpty(model.ConnectionString) || + !string.IsNullOrEmpty(model.DatabaseProvider); model.Recipes = recipes; @@ -364,7 +364,7 @@ public async Task Create(EditTenantViewModel model) shellSettings["DatabaseProvider"] = model.DatabaseProvider; shellSettings["Secret"] = Guid.NewGuid().ToString(); shellSettings["RecipeName"] = model.RecipeName; - shellSettings["FeatureProfile"] = String.Join(',', model.FeatureProfiles ?? Array.Empty()); + shellSettings["FeatureProfile"] = string.Join(',', model.FeatureProfiles ?? Array.Empty()); await _shellHost.UpdateShellSettingsAsync(shellSettings); @@ -460,7 +460,7 @@ public async Task Edit(EditTenantViewModel model) shellSettings["Category"] = model.Category; shellSettings.RequestUrlPrefix = model.RequestUrlPrefix; shellSettings.RequestUrlHost = model.RequestUrlHost; - shellSettings["FeatureProfile"] = String.Join(',', model.FeatureProfiles ?? Array.Empty()); + shellSettings["FeatureProfile"] = string.Join(',', model.FeatureProfiles ?? Array.Empty()); // The user can change the 'preset' database information only if the // tenant has not been initialized yet diff --git a/src/OrchardCore.Modules/OrchardCore.Tenants/Controllers/ApiController.cs b/src/OrchardCore.Modules/OrchardCore.Tenants/Controllers/ApiController.cs index 40194ce1770..1a75da8c984 100644 --- a/src/OrchardCore.Modules/OrchardCore.Tenants/Controllers/ApiController.cs +++ b/src/OrchardCore.Modules/OrchardCore.Tenants/Controllers/ApiController.cs @@ -121,7 +121,7 @@ public async Task Create(TenantApiModel model) shellSettings["DatabaseProvider"] = model.DatabaseProvider; shellSettings["Secret"] = Guid.NewGuid().ToString(); shellSettings["RecipeName"] = model.RecipeName; - shellSettings["FeatureProfile"] = String.Join(',', model.FeatureProfiles ?? Array.Empty()); + shellSettings["FeatureProfile"] = string.Join(',', model.FeatureProfiles ?? Array.Empty()); await _shellHost.UpdateShellSettingsAsync(shellSettings); @@ -172,7 +172,7 @@ public async Task Edit(TenantApiModel model) shellSettings["Category"] = model.Category; shellSettings.RequestUrlPrefix = model.RequestUrlPrefix; shellSettings.RequestUrlHost = model.RequestUrlHost; - shellSettings["FeatureProfile"] = String.Join(',', model.FeatureProfiles ?? Array.Empty()); + shellSettings["FeatureProfile"] = string.Join(',', model.FeatureProfiles ?? Array.Empty()); if (shellSettings.IsUninitialized()) { @@ -305,13 +305,13 @@ public async Task Setup(SetupApiViewModel model) return this.ChallengeOrForbid("Api"); } - if (!String.IsNullOrEmpty(model.UserName) && model.UserName.Any(c => !_identityOptions.User.AllowedUserNameCharacters.Contains(c))) + if (!string.IsNullOrEmpty(model.UserName) && model.UserName.Any(c => !_identityOptions.User.AllowedUserNameCharacters.Contains(c))) { ModelState.AddModelError(nameof(model.UserName), S["User name '{0}' is invalid, can only contain letters or digits.", model.UserName]); } // Only add additional error if attribute validation has passed. - if (!String.IsNullOrEmpty(model.Email) && !_emailAddressValidator.Validate(model.Email)) + if (!string.IsNullOrEmpty(model.Email) && !_emailAddressValidator.Validate(model.Email)) { ModelState.AddModelError(nameof(model.Email), S["The email is invalid."]); } @@ -338,12 +338,12 @@ public async Task Setup(SetupApiViewModel model) var databaseProvider = shellSettings["DatabaseProvider"]; - if (String.IsNullOrEmpty(databaseProvider)) + if (string.IsNullOrEmpty(databaseProvider)) { databaseProvider = model.DatabaseProvider; } - if (String.IsNullOrEmpty(databaseProvider)) + if (string.IsNullOrEmpty(databaseProvider)) { return BadRequest(S["The database provider is not defined."]); } @@ -356,40 +356,40 @@ public async Task Setup(SetupApiViewModel model) var tablePrefix = shellSettings["TablePrefix"]; - if (String.IsNullOrEmpty(tablePrefix)) + if (string.IsNullOrEmpty(tablePrefix)) { tablePrefix = model.TablePrefix; } var schema = shellSettings["Schema"]; - if (String.IsNullOrEmpty(schema)) + if (string.IsNullOrEmpty(schema)) { schema = model.Schema; } var connectionString = shellSettings["connectionString"]; - if (String.IsNullOrEmpty(connectionString)) + if (string.IsNullOrEmpty(connectionString)) { connectionString = model.ConnectionString; } - if (selectedProvider.HasConnectionString && String.IsNullOrEmpty(connectionString)) + if (selectedProvider.HasConnectionString && string.IsNullOrEmpty(connectionString)) { return BadRequest(S["The connection string is required for this database provider."]); } var recipeName = shellSettings["RecipeName"]; - if (String.IsNullOrEmpty(recipeName)) + if (string.IsNullOrEmpty(recipeName)) { recipeName = model.RecipeName; } RecipeDescriptor recipeDescriptor = null; - if (String.IsNullOrEmpty(recipeName)) + if (string.IsNullOrEmpty(recipeName)) { if (model.Recipe == null) { @@ -408,14 +408,14 @@ public async Task Setup(SetupApiViewModel model) recipeDescriptor = new RecipeDescriptor { FileProvider = fileProvider, - BasePath = String.Empty, + BasePath = string.Empty, RecipeFileInfo = fileProvider.GetFileInfo(Path.GetFileName(tempFilename)) }; } else { var setupRecipes = await _setupService.GetSetupRecipesAsync(); - recipeDescriptor = setupRecipes.FirstOrDefault(x => String.Equals(x.Name, recipeName, StringComparison.OrdinalIgnoreCase)); + recipeDescriptor = setupRecipes.FirstOrDefault(x => string.Equals(x.Name, recipeName, StringComparison.OrdinalIgnoreCase)); if (recipeDescriptor == null) { @@ -465,13 +465,13 @@ private string GetEncodedUrl(ShellSettings shellSettings, string token) var hostString = host != null ? new HostString(host) : Request.Host; var pathString = HttpContext.Features.Get()?.OriginalPathBase ?? PathString.Empty; - if (!String.IsNullOrEmpty(shellSettings.RequestUrlPrefix)) + if (!string.IsNullOrEmpty(shellSettings.RequestUrlPrefix)) { pathString = pathString.Add('/' + shellSettings.RequestUrlPrefix); } var queryString = QueryString.Empty; - if (!String.IsNullOrEmpty(token)) + if (!string.IsNullOrEmpty(token)) { queryString = QueryString.Create("token", token); } diff --git a/src/OrchardCore.Modules/OrchardCore.Tenants/Controllers/FeatureProfilesController.cs b/src/OrchardCore.Modules/OrchardCore.Tenants/Controllers/FeatureProfilesController.cs index 6fc1836d88d..15f9416144c 100644 --- a/src/OrchardCore.Modules/OrchardCore.Tenants/Controllers/FeatureProfilesController.cs +++ b/src/OrchardCore.Modules/OrchardCore.Tenants/Controllers/FeatureProfilesController.cs @@ -66,7 +66,7 @@ public async Task Index(ContentOptions options, PagerParameters p var featureProfiles = featureProfilesDocument.FeatureProfiles.ToList(); - if (!String.IsNullOrWhiteSpace(options.Search)) + if (!string.IsNullOrWhiteSpace(options.Search)) { featureProfiles = featureProfiles.Where(x => x.Key.Contains(options.Search, StringComparison.OrdinalIgnoreCase)).ToList(); } diff --git a/src/OrchardCore.Modules/OrchardCore.Tenants/FeatureProfilesAdminMenu.cs b/src/OrchardCore.Modules/OrchardCore.Tenants/FeatureProfilesAdminMenu.cs index 704bdb6facb..0ab6c1714c8 100644 --- a/src/OrchardCore.Modules/OrchardCore.Tenants/FeatureProfilesAdminMenu.cs +++ b/src/OrchardCore.Modules/OrchardCore.Tenants/FeatureProfilesAdminMenu.cs @@ -19,7 +19,7 @@ public FeatureProfilesAdminMenu(IStringLocalizer local public Task BuildNavigationAsync(string name, NavigationBuilder builder) { - if (!String.Equals(name, "admin", StringComparison.OrdinalIgnoreCase)) + if (!string.Equals(name, "admin", StringComparison.OrdinalIgnoreCase)) { return Task.CompletedTask; } diff --git a/src/OrchardCore.Modules/OrchardCore.Tenants/HttpContextExtensions.cs b/src/OrchardCore.Modules/OrchardCore.Tenants/HttpContextExtensions.cs index 9342f7e305f..f903f8ff7e6 100644 --- a/src/OrchardCore.Modules/OrchardCore.Tenants/HttpContextExtensions.cs +++ b/src/OrchardCore.Modules/OrchardCore.Tenants/HttpContextExtensions.cs @@ -23,13 +23,13 @@ public static string GetEncodedUrl(this HttpContext httpContext, ShellSettingsEn } var pathString = httpContext.Features.Get()?.OriginalPathBase ?? PathString.Empty; - if (!String.IsNullOrEmpty(shellSettings.RequestUrlPrefix)) + if (!string.IsNullOrEmpty(shellSettings.RequestUrlPrefix)) { pathString = pathString.Add('/' + shellSettings.RequestUrlPrefix); } var queryString = QueryString.Empty; - if (appendQuery && !String.IsNullOrEmpty(entry.Token)) + if (appendQuery && !string.IsNullOrEmpty(entry.Token)) { queryString = QueryString.Create("token", entry.Token); } diff --git a/src/OrchardCore.Modules/OrchardCore.Tenants/Properties/AssemblyInfo.cs b/src/OrchardCore.Modules/OrchardCore.Tenants/Properties/AssemblyInfo.cs index 0cf04885d91..0d420fd30ae 100644 --- a/src/OrchardCore.Modules/OrchardCore.Tenants/Properties/AssemblyInfo.cs +++ b/src/OrchardCore.Modules/OrchardCore.Tenants/Properties/AssemblyInfo.cs @@ -1,4 +1,4 @@ -using System.Reflection; +using System.Reflection; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following diff --git a/src/OrchardCore.Modules/OrchardCore.Tenants/Recipes/FeatureProfilesStep.cs b/src/OrchardCore.Modules/OrchardCore.Tenants/Recipes/FeatureProfilesStep.cs index f9b61c32fdd..21d0304b45b 100644 --- a/src/OrchardCore.Modules/OrchardCore.Tenants/Recipes/FeatureProfilesStep.cs +++ b/src/OrchardCore.Modules/OrchardCore.Tenants/Recipes/FeatureProfilesStep.cs @@ -22,7 +22,7 @@ public FeatureProfilesStep(FeatureProfilesManager featureProfilesManager) public async Task ExecuteAsync(RecipeExecutionContext context) { - if (!String.Equals(context.Name, "FeatureProfiles", StringComparison.OrdinalIgnoreCase)) + if (!string.Equals(context.Name, "FeatureProfiles", StringComparison.OrdinalIgnoreCase)) { return; } diff --git a/src/OrchardCore.Modules/OrchardCore.Tenants/Services/TenantValidator.cs b/src/OrchardCore.Modules/OrchardCore.Tenants/Services/TenantValidator.cs index 15b90a5f492..64247c03e56 100644 --- a/src/OrchardCore.Modules/OrchardCore.Tenants/Services/TenantValidator.cs +++ b/src/OrchardCore.Modules/OrchardCore.Tenants/Services/TenantValidator.cs @@ -38,7 +38,7 @@ public async Task> ValidateAsync(TenantModelBase model) { var errors = new List(); - if (String.IsNullOrWhiteSpace(model.Name)) + if (string.IsNullOrWhiteSpace(model.Name)) { errors.Add(new ModelError(nameof(model.Name), S["The tenant name is mandatory."])); } @@ -56,14 +56,14 @@ public async Task> ValidateAsync(TenantModelBase model) } } - if (!String.IsNullOrEmpty(model.Name) && !Regex.IsMatch(model.Name, @"^\w+$")) + if (!string.IsNullOrEmpty(model.Name) && !Regex.IsMatch(model.Name, @"^\w+$")) { errors.Add(new ModelError(nameof(model.Name), S["Invalid tenant name. Must contain characters only and no spaces."])); } _ = _shellHost.TryGetSettings(model.Name, out var existingShellSettings); - if (!String.IsNullOrWhiteSpace(model.RequestUrlPrefix) && model.RequestUrlPrefix.Contains('/')) + if (!string.IsNullOrWhiteSpace(model.RequestUrlPrefix) && model.RequestUrlPrefix.Contains('/')) { errors.Add(new ModelError(nameof(model.RequestUrlPrefix), S["The url prefix can not contain more than one segment."])); } @@ -133,7 +133,7 @@ private async Task ValidateConnectionAsync(DbConnectionValidatorContext validati if (validationContext.DatabaseProvider == DatabaseProviderValue.Sqlite) { errors.Add(new ModelError( - String.Empty, + string.Empty, S["The related database file is already in use."])); break; } diff --git a/src/OrchardCore.Modules/OrchardCore.Tenants/Workflows/Activities/CreateTenantTask.cs b/src/OrchardCore.Modules/OrchardCore.Tenants/Workflows/Activities/CreateTenantTask.cs index adfc8fb9615..d14fd80838c 100644 --- a/src/OrchardCore.Modules/OrchardCore.Tenants/Workflows/Activities/CreateTenantTask.cs +++ b/src/OrchardCore.Modules/OrchardCore.Tenants/Workflows/Activities/CreateTenantTask.cs @@ -97,7 +97,7 @@ public async override Task ExecuteAsync(WorkflowExecuti var tenantName = (await ExpressionEvaluator.EvaluateAsync(TenantName, workflowContext, null))?.Trim(); - if (String.IsNullOrEmpty(tenantName)) + if (string.IsNullOrEmpty(tenantName)) { return Outcomes("Failed"); } @@ -122,49 +122,49 @@ public async override Task ExecuteAsync(WorkflowExecuti shellSettings.Name = tenantName; - if (!String.IsNullOrEmpty(description)) + if (!string.IsNullOrEmpty(description)) { shellSettings["Description"] = description; } - if (!String.IsNullOrEmpty(requestUrlHost)) + if (!string.IsNullOrEmpty(requestUrlHost)) { shellSettings.RequestUrlHost = requestUrlHost; } - if (!String.IsNullOrEmpty(requestUrlPrefix)) + if (!string.IsNullOrEmpty(requestUrlPrefix)) { shellSettings.RequestUrlPrefix = requestUrlPrefix; } shellSettings.AsUninitialized(); - if (!String.IsNullOrEmpty(connectionString)) + if (!string.IsNullOrEmpty(connectionString)) { shellSettings["ConnectionString"] = connectionString; } - if (!String.IsNullOrEmpty(tablePrefix)) + if (!string.IsNullOrEmpty(tablePrefix)) { shellSettings["TablePrefix"] = tablePrefix; } - if (!String.IsNullOrEmpty(schema)) + if (!string.IsNullOrEmpty(schema)) { shellSettings["Schema"] = schema; } - if (!String.IsNullOrEmpty(databaseProvider)) + if (!string.IsNullOrEmpty(databaseProvider)) { shellSettings["DatabaseProvider"] = databaseProvider; } - if (!String.IsNullOrEmpty(recipeName)) + if (!string.IsNullOrEmpty(recipeName)) { shellSettings["RecipeName"] = recipeName; } - if (!String.IsNullOrEmpty(featureProfile)) + if (!string.IsNullOrEmpty(featureProfile)) { shellSettings["FeatureProfile"] = featureProfile; } diff --git a/src/OrchardCore.Modules/OrchardCore.Tenants/Workflows/Activities/DisableTenantTask.cs b/src/OrchardCore.Modules/OrchardCore.Tenants/Workflows/Activities/DisableTenantTask.cs index 6872d5216f6..33f47273034 100644 --- a/src/OrchardCore.Modules/OrchardCore.Tenants/Workflows/Activities/DisableTenantTask.cs +++ b/src/OrchardCore.Modules/OrchardCore.Tenants/Workflows/Activities/DisableTenantTask.cs @@ -37,7 +37,7 @@ public override async Task ExecuteAsync(WorkflowExecuti var tenantName = (await ExpressionEvaluator.EvaluateAsync(TenantName, workflowContext, null))?.Trim(); - if (String.IsNullOrEmpty(tenantName)) + if (string.IsNullOrEmpty(tenantName)) { return Outcomes("Failed"); } diff --git a/src/OrchardCore.Modules/OrchardCore.Tenants/Workflows/Activities/EnableTenantTask.cs b/src/OrchardCore.Modules/OrchardCore.Tenants/Workflows/Activities/EnableTenantTask.cs index d80fa416fe6..083a06f2dcb 100644 --- a/src/OrchardCore.Modules/OrchardCore.Tenants/Workflows/Activities/EnableTenantTask.cs +++ b/src/OrchardCore.Modules/OrchardCore.Tenants/Workflows/Activities/EnableTenantTask.cs @@ -38,7 +38,7 @@ public override async Task ExecuteAsync(WorkflowExecuti var tenantName = (await ExpressionEvaluator.EvaluateAsync(TenantName, workflowContext, null))?.Trim(); - if (String.IsNullOrEmpty(tenantName)) + if (string.IsNullOrEmpty(tenantName)) { return Outcomes("Failed"); } diff --git a/src/OrchardCore.Modules/OrchardCore.Tenants/Workflows/Activities/SetupTenantTask.cs b/src/OrchardCore.Modules/OrchardCore.Tenants/Workflows/Activities/SetupTenantTask.cs index 4c1f6b31fbb..50f5bcd13b4 100644 --- a/src/OrchardCore.Modules/OrchardCore.Tenants/Workflows/Activities/SetupTenantTask.cs +++ b/src/OrchardCore.Modules/OrchardCore.Tenants/Workflows/Activities/SetupTenantTask.cs @@ -122,7 +122,7 @@ public override async Task ExecuteAsync(WorkflowExecuti var tenantName = (await ExpressionEvaluator.EvaluateAsync(TenantName, workflowContext, null))?.Trim(); - if (String.IsNullOrWhiteSpace(tenantName)) + if (string.IsNullOrWhiteSpace(tenantName)) { return Outcomes("Failed"); } @@ -146,12 +146,12 @@ public override async Task ExecuteAsync(WorkflowExecuti var adminUsername = (await ExpressionEvaluator.EvaluateAsync(AdminUsername, workflowContext, null))?.Trim(); var adminEmail = (await ExpressionEvaluator.EvaluateAsync(AdminEmail, workflowContext, null))?.Trim(); - if (String.IsNullOrEmpty(adminUsername) || adminUsername.Any(c => !_identityOptions.User.AllowedUserNameCharacters.Contains(c))) + if (string.IsNullOrEmpty(adminUsername) || adminUsername.Any(c => !_identityOptions.User.AllowedUserNameCharacters.Contains(c))) { return Outcomes("Failed"); } - if (String.IsNullOrEmpty(adminEmail) || !_emailAddressValidator.Validate(adminEmail)) + if (string.IsNullOrEmpty(adminEmail) || !_emailAddressValidator.Validate(adminEmail)) { return Outcomes("Failed"); } @@ -164,27 +164,27 @@ public override async Task ExecuteAsync(WorkflowExecuti var databaseSchema = (await ExpressionEvaluator.EvaluateAsync(DatabaseSchema, workflowContext, null))?.Trim(); var recipeName = (await ExpressionEvaluator.EvaluateAsync(RecipeName, workflowContext, null))?.Trim(); - if (String.IsNullOrEmpty(databaseProvider)) + if (string.IsNullOrEmpty(databaseProvider)) { databaseProvider = shellSettings["DatabaseProvider"]; } - if (String.IsNullOrEmpty(databaseConnectionString)) + if (string.IsNullOrEmpty(databaseConnectionString)) { databaseConnectionString = shellSettings["ConnectionString"]; } - if (String.IsNullOrEmpty(databaseTablePrefix)) + if (string.IsNullOrEmpty(databaseTablePrefix)) { databaseTablePrefix = shellSettings["TablePrefix"]; } - if (String.IsNullOrWhiteSpace(databaseSchema)) + if (string.IsNullOrWhiteSpace(databaseSchema)) { databaseSchema = shellSettings["Schema"]; } - if (String.IsNullOrEmpty(recipeName)) + if (string.IsNullOrEmpty(recipeName)) { recipeName = shellSettings["RecipeName"]; } diff --git a/src/OrchardCore.Modules/OrchardCore.Themes/AdminMenu.cs b/src/OrchardCore.Modules/OrchardCore.Themes/AdminMenu.cs index b7886b8ea74..7d8804c7c70 100644 --- a/src/OrchardCore.Modules/OrchardCore.Themes/AdminMenu.cs +++ b/src/OrchardCore.Modules/OrchardCore.Themes/AdminMenu.cs @@ -16,7 +16,7 @@ public AdminMenu(IStringLocalizer localizer) public Task BuildNavigationAsync(string name, NavigationBuilder builder) { - if (!String.Equals(name, "admin", StringComparison.OrdinalIgnoreCase)) + if (!string.Equals(name, "admin", StringComparison.OrdinalIgnoreCase)) { return Task.CompletedTask; } diff --git a/src/OrchardCore.Modules/OrchardCore.Themes/Controllers/AdminController.cs b/src/OrchardCore.Modules/OrchardCore.Themes/Controllers/AdminController.cs index fd9a6ae1a08..976ddd57346 100644 --- a/src/OrchardCore.Modules/OrchardCore.Themes/Controllers/AdminController.cs +++ b/src/OrchardCore.Modules/OrchardCore.Themes/Controllers/AdminController.cs @@ -66,7 +66,7 @@ public async Task Index() } var tags = f.Extension.Manifest.Tags.ToArray(); - var isHidden = tags.Any(t => String.Equals(t, "hidden", StringComparison.OrdinalIgnoreCase)); + var isHidden = tags.Any(t => string.Equals(t, "hidden", StringComparison.OrdinalIgnoreCase)); if (isHidden) { return false; @@ -110,7 +110,7 @@ public async Task SetCurrentTheme(string id) return Forbid(); } - if (String.IsNullOrEmpty(id)) + if (string.IsNullOrEmpty(id)) { // Don't use any theme on the front-end } @@ -231,7 +231,7 @@ public async Task Enable(string id) private static bool IsAdminTheme(IManifestInfo manifest) { - return manifest.Tags.Any(x => String.Equals(x, ManifestConstants.AdminTag, StringComparison.OrdinalIgnoreCase)); + return manifest.Tags.Any(x => string.Equals(x, ManifestConstants.AdminTag, StringComparison.OrdinalIgnoreCase)); } } } diff --git a/src/OrchardCore.Modules/OrchardCore.Themes/Models/SelectThemesViewModel.cs b/src/OrchardCore.Modules/OrchardCore.Themes/Models/SelectThemesViewModel.cs index 479d2a743b1..4fdc4b585c2 100644 --- a/src/OrchardCore.Modules/OrchardCore.Themes/Models/SelectThemesViewModel.cs +++ b/src/OrchardCore.Modules/OrchardCore.Themes/Models/SelectThemesViewModel.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; namespace OrchardCore.Themes.Models { diff --git a/src/OrchardCore.Modules/OrchardCore.Themes/Recipes/ThemesStep.cs b/src/OrchardCore.Modules/OrchardCore.Themes/Recipes/ThemesStep.cs index 8232204c861..e5c871d70ad 100644 --- a/src/OrchardCore.Modules/OrchardCore.Themes/Recipes/ThemesStep.cs +++ b/src/OrchardCore.Modules/OrchardCore.Themes/Recipes/ThemesStep.cs @@ -25,19 +25,19 @@ public ThemesStep( public async Task ExecuteAsync(RecipeExecutionContext context) { - if (!String.Equals(context.Name, "Themes", StringComparison.OrdinalIgnoreCase)) + if (!string.Equals(context.Name, "Themes", StringComparison.OrdinalIgnoreCase)) { return; } var model = context.Step.ToObject(); - if (!String.IsNullOrEmpty(model.Site)) + if (!string.IsNullOrEmpty(model.Site)) { await _siteThemeService.SetSiteThemeAsync(model.Site); } - if (!String.IsNullOrEmpty(model.Admin)) + if (!string.IsNullOrEmpty(model.Admin)) { await _adminThemeService.SetAdminThemeAsync(model.Admin); } diff --git a/src/OrchardCore.Modules/OrchardCore.Themes/Services/DarkModeService.cs b/src/OrchardCore.Modules/OrchardCore.Themes/Services/DarkModeService.cs index 13c650a350c..c978099583b 100644 --- a/src/OrchardCore.Modules/OrchardCore.Themes/Services/DarkModeService.cs +++ b/src/OrchardCore.Modules/OrchardCore.Themes/Services/DarkModeService.cs @@ -36,7 +36,7 @@ public async Task IsDarkModeAsync() if (adminSettings.DisplayDarkMode) { - if (!String.IsNullOrWhiteSpace(_httpContextAccessor.HttpContext.Request.Cookies[cookieName])) + if (!string.IsNullOrWhiteSpace(_httpContextAccessor.HttpContext.Request.Cookies[cookieName])) { var adminPreferences = JsonDocument.Parse(_httpContextAccessor.HttpContext.Request.Cookies[cookieName]); diff --git a/src/OrchardCore.Modules/OrchardCore.Themes/Services/SiteThemeSelector.cs b/src/OrchardCore.Modules/OrchardCore.Themes/Services/SiteThemeSelector.cs index a132ee0dd5a..a13e2080207 100644 --- a/src/OrchardCore.Modules/OrchardCore.Themes/Services/SiteThemeSelector.cs +++ b/src/OrchardCore.Modules/OrchardCore.Themes/Services/SiteThemeSelector.cs @@ -21,7 +21,7 @@ public SiteThemeSelector(ISiteThemeService siteThemeService) public async Task GetThemeAsync() { string currentThemeName = await _siteThemeService.GetSiteThemeNameAsync(); - if (String.IsNullOrEmpty(currentThemeName)) + 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 85f257770c7..ae5c7ab413f 100644 --- a/src/OrchardCore.Modules/OrchardCore.Themes/Services/SiteThemeService.cs +++ b/src/OrchardCore.Modules/OrchardCore.Themes/Services/SiteThemeService.cs @@ -21,7 +21,7 @@ public SiteThemeService( public async Task GetSiteThemeAsync() { string currentThemeName = await GetSiteThemeNameAsync(); - if (String.IsNullOrEmpty(currentThemeName)) + if (string.IsNullOrEmpty(currentThemeName)) { return null; } diff --git a/src/OrchardCore.Modules/OrchardCore.Themes/Services/ThemeService.cs b/src/OrchardCore.Modules/OrchardCore.Themes/Services/ThemeService.cs index 59c5600830c..72a59eab844 100644 --- a/src/OrchardCore.Modules/OrchardCore.Themes/Services/ThemeService.cs +++ b/src/OrchardCore.Modules/OrchardCore.Themes/Services/ThemeService.cs @@ -45,7 +45,7 @@ public async Task DisableThemeFeaturesAsync(string themeName) break; themes.Enqueue(themeName); - themeName = !String.IsNullOrWhiteSpace(theme.Manifest.Name) + themeName = !string.IsNullOrWhiteSpace(theme.Manifest.Name) ? theme.Manifest.Name : null; } diff --git a/src/OrchardCore.Modules/OrchardCore.Themes/ViewModels/SelectThemesViewModel.cs b/src/OrchardCore.Modules/OrchardCore.Themes/ViewModels/SelectThemesViewModel.cs index b7a89835d9f..ec3579c0d16 100644 --- a/src/OrchardCore.Modules/OrchardCore.Themes/ViewModels/SelectThemesViewModel.cs +++ b/src/OrchardCore.Modules/OrchardCore.Themes/ViewModels/SelectThemesViewModel.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using OrchardCore.Themes.Models; namespace OrchardCore.Themes.ViewModels diff --git a/src/OrchardCore.Modules/OrchardCore.Title/Drivers/TitlePartDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.Title/Drivers/TitlePartDisplayDriver.cs index f76a993d5ba..e7a7307ac25 100644 --- a/src/OrchardCore.Modules/OrchardCore.Title/Drivers/TitlePartDisplayDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Title/Drivers/TitlePartDisplayDriver.cs @@ -24,7 +24,7 @@ public override IDisplayResult Display(TitlePart titlePart, BuildPartDisplayCont { var settings = context.TypePartDefinition.GetSettings(); - if (!settings.RenderTitle || String.IsNullOrWhiteSpace(titlePart.Title)) + if (!settings.RenderTitle || string.IsNullOrWhiteSpace(titlePart.Title)) { return null; } @@ -55,7 +55,7 @@ public override async Task UpdateAsync(TitlePart model, IUpdateM if (await updater.TryUpdateModelAsync(model, Prefix, t => t.Title)) { var settings = context.TypePartDefinition.GetSettings(); - if (settings.Options == TitlePartOptions.EditableRequired && String.IsNullOrWhiteSpace(model.Title)) + if (settings.Options == TitlePartOptions.EditableRequired && string.IsNullOrWhiteSpace(model.Title)) { updater.ModelState.AddModelError(Prefix, nameof(model.Title), S["A value is required for Title."]); } diff --git a/src/OrchardCore.Modules/OrchardCore.Title/Handlers/TitlePartHandler.cs b/src/OrchardCore.Modules/OrchardCore.Title/Handlers/TitlePartHandler.cs index 36abfb09f82..7246106cba7 100644 --- a/src/OrchardCore.Modules/OrchardCore.Title/Handlers/TitlePartHandler.cs +++ b/src/OrchardCore.Modules/OrchardCore.Title/Handlers/TitlePartHandler.cs @@ -45,7 +45,7 @@ protected override Task ValidatingAsync(ValidateContentPartContext context, Titl { var settings = context.ContentTypePartDefinition.GetSettings(); - if (settings.Options == TitlePartOptions.EditableRequired && String.IsNullOrEmpty(part.Title)) + if (settings.Options == TitlePartOptions.EditableRequired && string.IsNullOrEmpty(part.Title)) { context.Fail(S["A value is required for Title."], nameof(part.Title)); } @@ -67,7 +67,7 @@ private async Task SetTitleAsync(TitlePart part) // Do not compute the title if the user can modify it. if (settings.Options == TitlePartOptions.Editable || settings.Options == TitlePartOptions.EditableRequired) { - if (String.IsNullOrWhiteSpace(part.ContentItem.DisplayText)) + if (string.IsNullOrWhiteSpace(part.ContentItem.DisplayText)) { // UpdatedAsync event is called from non-UI request like API, we update the DisplayText if it is not already set. // When the displayText is not set, we set it to the value of title. @@ -77,7 +77,7 @@ private async Task SetTitleAsync(TitlePart part) return; } - if (!String.IsNullOrEmpty(settings.Pattern)) + if (!string.IsNullOrEmpty(settings.Pattern)) { var model = new TitlePartViewModel() { @@ -92,7 +92,7 @@ private async Task SetTitleAsync(TitlePart part) ["ContentItem"] = new ObjectValue(model.ContentItem) }); - title = title.Replace("\r", String.Empty).Replace("\n", String.Empty); + title = title.Replace("\r", string.Empty).Replace("\n", string.Empty); part.Title = title; part.ContentItem.DisplayText = title; @@ -103,7 +103,7 @@ private async Task SetTitleAsync(TitlePart part) private TitlePartSettings GetSettings(TitlePart part) { var contentTypeDefinition = _contentDefinitionManager.GetTypeDefinition(part.ContentItem.ContentType); - var contentTypePartDefinition = contentTypeDefinition.Parts.FirstOrDefault(x => String.Equals(x.PartDefinition.Name, nameof(TitlePart))); + var contentTypePartDefinition = contentTypeDefinition.Parts.FirstOrDefault(x => string.Equals(x.PartDefinition.Name, nameof(TitlePart))); return contentTypePartDefinition.GetSettings(); } diff --git a/src/OrchardCore.Modules/OrchardCore.Title/Migrations.cs b/src/OrchardCore.Modules/OrchardCore.Title/Migrations.cs index 8c1aa1ef200..9e2dd860d2d 100644 --- a/src/OrchardCore.Modules/OrchardCore.Title/Migrations.cs +++ b/src/OrchardCore.Modules/OrchardCore.Title/Migrations.cs @@ -60,7 +60,7 @@ public async Task UpdateFrom1() foreach (var contentItemVersion in contentItemVersions) { - if (String.IsNullOrEmpty(contentItemVersion.DisplayText) + if (string.IsNullOrEmpty(contentItemVersion.DisplayText) && UpdateTitle(contentItemVersion.Content)) { _session.Save(contentItemVersion); @@ -81,7 +81,7 @@ static bool UpdateTitle(JToken content) { var title = content["TitlePart"]?["Title"]?.Value(); - if (!String.IsNullOrWhiteSpace(title)) + if (!string.IsNullOrWhiteSpace(title)) { content["DisplayText"] = title; changed = true; diff --git a/src/OrchardCore.Modules/OrchardCore.Title/Properties/AssemblyInfo.cs b/src/OrchardCore.Modules/OrchardCore.Title/Properties/AssemblyInfo.cs index bdb8d68a9be..314d42e505d 100644 --- a/src/OrchardCore.Modules/OrchardCore.Title/Properties/AssemblyInfo.cs +++ b/src/OrchardCore.Modules/OrchardCore.Title/Properties/AssemblyInfo.cs @@ -1,4 +1,4 @@ -using System.Reflection; +using System.Reflection; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following diff --git a/src/OrchardCore.Modules/OrchardCore.Title/Settings/TitlePartSettingsDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.Title/Settings/TitlePartSettingsDisplayDriver.cs index 3df1fdc4d93..1623ca4246d 100644 --- a/src/OrchardCore.Modules/OrchardCore.Title/Settings/TitlePartSettingsDisplayDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Title/Settings/TitlePartSettingsDisplayDriver.cs @@ -44,9 +44,9 @@ await context.Updater.TryUpdateModelAsync(model, Prefix, m => m.Options, m => m.RenderTitle); - if (!String.IsNullOrEmpty(model.Pattern) && !_templateManager.Validate(model.Pattern, out var errors)) + if (!string.IsNullOrEmpty(model.Pattern) && !_templateManager.Validate(model.Pattern, out var errors)) { - context.Updater.ModelState.AddModelError(nameof(model.Pattern), S["Pattern doesn't contain a valid Liquid expression. Details: {0}", String.Join(" ", errors)]); + context.Updater.ModelState.AddModelError(nameof(model.Pattern), S["Pattern doesn't contain a valid Liquid expression. Details: {0}", string.Join(" ", errors)]); } else { diff --git a/src/OrchardCore.Modules/OrchardCore.Twitter/AdminMenuSignin.cs b/src/OrchardCore.Modules/OrchardCore.Twitter/AdminMenuSignin.cs index 72ef73dc731..2df4151f274 100644 --- a/src/OrchardCore.Modules/OrchardCore.Twitter/AdminMenuSignin.cs +++ b/src/OrchardCore.Modules/OrchardCore.Twitter/AdminMenuSignin.cs @@ -18,7 +18,7 @@ public AdminMenuSignin(IStringLocalizer localizer) public Task BuildNavigationAsync(string name, NavigationBuilder builder) { - if (String.Equals(name, "admin", StringComparison.OrdinalIgnoreCase)) + if (string.Equals(name, "admin", StringComparison.OrdinalIgnoreCase)) { builder.Add(S["Security"], security => security .Add(S["Authentication"], authentication => authentication @@ -45,7 +45,7 @@ public AdminMenu(IStringLocalizer localizer) public Task BuildNavigationAsync(string name, NavigationBuilder builder) { - if (String.Equals(name, "admin", StringComparison.OrdinalIgnoreCase)) + if (string.Equals(name, "admin", StringComparison.OrdinalIgnoreCase)) { builder.Add(S["Configuration"], configuration => configuration .Add(S["Settings"], settings => settings diff --git a/src/OrchardCore.Modules/OrchardCore.Twitter/Recipes/TwitterSettingsStep.cs b/src/OrchardCore.Modules/OrchardCore.Twitter/Recipes/TwitterSettingsStep.cs index a074bd4cd79..37fcecfb18b 100644 --- a/src/OrchardCore.Modules/OrchardCore.Twitter/Recipes/TwitterSettingsStep.cs +++ b/src/OrchardCore.Modules/OrchardCore.Twitter/Recipes/TwitterSettingsStep.cs @@ -21,7 +21,7 @@ public TwitterSettingsStep(ITwitterSettingsService twitterService) public async Task ExecuteAsync(RecipeExecutionContext context) { - if (!String.Equals(context.Name, nameof(TwitterSettings), StringComparison.OrdinalIgnoreCase)) + if (!string.Equals(context.Name, nameof(TwitterSettings), StringComparison.OrdinalIgnoreCase)) { return; } diff --git a/src/OrchardCore.Modules/OrchardCore.Twitter/Services/TwitterClientMessageHandler.cs b/src/OrchardCore.Modules/OrchardCore.Twitter/Services/TwitterClientMessageHandler.cs index 2c3903067cf..ff7af14ca8f 100644 --- a/src/OrchardCore.Modules/OrchardCore.Twitter/Services/TwitterClientMessageHandler.cs +++ b/src/OrchardCore.Modules/OrchardCore.Twitter/Services/TwitterClientMessageHandler.cs @@ -46,12 +46,12 @@ public async Task ConfigureOAuthAsync(HttpRequestMessage request) var protrector = _dataProtectionProvider.CreateProtector(TwitterConstants.Features.Twitter); var queryString = request.RequestUri.Query; - if (!String.IsNullOrWhiteSpace(_twitterSettings.ConsumerSecret)) + if (!string.IsNullOrWhiteSpace(_twitterSettings.ConsumerSecret)) { _twitterSettings.ConsumerSecret = protrector.Unprotect(_twitterSettings.ConsumerSecret); } - if (!String.IsNullOrWhiteSpace(_twitterSettings.AccessTokenSecret)) + if (!string.IsNullOrWhiteSpace(_twitterSettings.AccessTokenSecret)) { _twitterSettings.AccessTokenSecret = protrector.Unprotect(_twitterSettings.AccessTokenSecret); } @@ -69,7 +69,7 @@ public async Task ConfigureOAuthAsync(HttpRequestMessage request) { Uri.EscapeDataString("oauth_version"), Uri.EscapeDataString("1.0") }, }; - if (!String.IsNullOrEmpty(request.RequestUri.Query)) + if (!string.IsNullOrEmpty(request.RequestUri.Query)) { foreach (var item in request.RequestUri.Query.Split('&')) { @@ -82,7 +82,7 @@ public async Task ConfigureOAuthAsync(HttpRequestMessage request) var contentString = await request.Content.ReadAsStringAsync(); - if (!String.IsNullOrEmpty(contentString)) + if (!string.IsNullOrEmpty(contentString)) { foreach (var item in contentString.Split('&')) { @@ -94,11 +94,11 @@ public async Task ConfigureOAuthAsync(HttpRequestMessage request) } } - var baseString = String.Concat(request.Method.Method.ToUpperInvariant(), "&", + var baseString = string.Concat(request.Method.Method.ToUpperInvariant(), "&", Uri.EscapeDataString(request.RequestUri.AbsoluteUri.ToString()), "&", - Uri.EscapeDataString(String.Join("&", sortedParameters.Select(c => String.Format("{0}={1}", c.Key, c.Value))))); + Uri.EscapeDataString(string.Join("&", sortedParameters.Select(c => string.Format("{0}={1}", c.Key, c.Value))))); - var secret = String.Concat(_twitterSettings.ConsumerSecret, "&", _twitterSettings.AccessTokenSecret); + var secret = string.Concat(_twitterSettings.ConsumerSecret, "&", _twitterSettings.AccessTokenSecret); string signature; using (var hasher = new HMACSHA1(Encoding.ASCII.GetBytes(secret))) diff --git a/src/OrchardCore.Modules/OrchardCore.Twitter/Services/TwitterSettingsService.cs b/src/OrchardCore.Modules/OrchardCore.Twitter/Services/TwitterSettingsService.cs index b2778b72f90..b05c89b8268 100644 --- a/src/OrchardCore.Modules/OrchardCore.Twitter/Services/TwitterSettingsService.cs +++ b/src/OrchardCore.Modules/OrchardCore.Twitter/Services/TwitterSettingsService.cs @@ -60,22 +60,22 @@ public IEnumerable ValidateSettings(TwitterSettings settings) throw new ArgumentNullException(nameof(settings)); } - if (String.IsNullOrWhiteSpace(settings.ConsumerKey)) + if (string.IsNullOrWhiteSpace(settings.ConsumerKey)) { yield return new ValidationResult(S["ConsumerKey is required"], new string[] { nameof(settings.ConsumerKey) }); } - if (String.IsNullOrWhiteSpace(settings.ConsumerSecret)) + if (string.IsNullOrWhiteSpace(settings.ConsumerSecret)) { yield return new ValidationResult(S["ConsumerSecret is required"], new string[] { nameof(settings.ConsumerSecret) }); } - if (String.IsNullOrWhiteSpace(settings.AccessToken)) + if (string.IsNullOrWhiteSpace(settings.AccessToken)) { yield return new ValidationResult(S["Access Token is required"], new string[] { nameof(settings.AccessToken) }); } - if (String.IsNullOrWhiteSpace(settings.AccessTokenSecret)) + if (string.IsNullOrWhiteSpace(settings.AccessTokenSecret)) { yield return new ValidationResult(S["Access Token Secret is required"], new string[] { nameof(settings.AccessTokenSecret) }); } diff --git a/src/OrchardCore.Modules/OrchardCore.Twitter/Signin/Configuration/TwitterOptionsConfiguration.cs b/src/OrchardCore.Modules/OrchardCore.Twitter/Signin/Configuration/TwitterOptionsConfiguration.cs index e05170bde44..12521516568 100644 --- a/src/OrchardCore.Modules/OrchardCore.Twitter/Signin/Configuration/TwitterOptionsConfiguration.cs +++ b/src/OrchardCore.Modules/OrchardCore.Twitter/Signin/Configuration/TwitterOptionsConfiguration.cs @@ -68,7 +68,7 @@ public void Configure(AuthenticationOptions options) public void Configure(string name, TwitterOptions options) { - if (!String.Equals(name, TwitterDefaults.AuthenticationScheme)) + if (!string.Equals(name, TwitterDefaults.AuthenticationScheme)) { return; } diff --git a/src/OrchardCore.Modules/OrchardCore.Users/AdminMenu.cs b/src/OrchardCore.Modules/OrchardCore.Users/AdminMenu.cs index a8f29b79369..1a6444a097a 100644 --- a/src/OrchardCore.Modules/OrchardCore.Users/AdminMenu.cs +++ b/src/OrchardCore.Modules/OrchardCore.Users/AdminMenu.cs @@ -19,7 +19,7 @@ public AdminMenu(IStringLocalizer localizer) public Task BuildNavigationAsync(string name, NavigationBuilder builder) { - if (!String.Equals(name, "admin", StringComparison.OrdinalIgnoreCase)) + if (!string.Equals(name, "admin", StringComparison.OrdinalIgnoreCase)) { return Task.CompletedTask; } @@ -58,7 +58,7 @@ public ChangeEmailAdminMenu(IStringLocalizer localizer) public Task BuildNavigationAsync(string name, NavigationBuilder builder) { - if (!String.Equals(name, "admin", StringComparison.OrdinalIgnoreCase)) + if (!string.Equals(name, "admin", StringComparison.OrdinalIgnoreCase)) { return Task.CompletedTask; } @@ -88,7 +88,7 @@ public RegistrationAdminMenu(IStringLocalizer localizer) public Task BuildNavigationAsync(string name, NavigationBuilder builder) { - if (!String.Equals(name, "admin", StringComparison.OrdinalIgnoreCase)) + if (!string.Equals(name, "admin", StringComparison.OrdinalIgnoreCase)) { return Task.CompletedTask; } @@ -118,7 +118,7 @@ public ResetPasswordAdminMenu(IStringLocalizer localizer public Task BuildNavigationAsync(string name, NavigationBuilder builder) { - if (!String.Equals(name, "admin", StringComparison.OrdinalIgnoreCase)) + if (!string.Equals(name, "admin", StringComparison.OrdinalIgnoreCase)) { return Task.CompletedTask; } diff --git a/src/OrchardCore.Modules/OrchardCore.Users/AuditTrail/Handlers/UserEventHandler.cs b/src/OrchardCore.Modules/OrchardCore.Users/AuditTrail/Handlers/UserEventHandler.cs index f96ee35f635..eda8d4ab415 100644 --- a/src/OrchardCore.Modules/OrchardCore.Users/AuditTrail/Handlers/UserEventHandler.cs +++ b/src/OrchardCore.Modules/OrchardCore.Users/AuditTrail/Handlers/UserEventHandler.cs @@ -42,12 +42,12 @@ public Task LoggingInFailedAsync(string userName) ( name: UserAuditTrailEventConfiguration.LogInFailed, category: UserAuditTrailEventConfiguration.User, - correlationId: String.Empty, - userId: String.Empty, + correlationId: string.Empty, + userId: string.Empty, userName: userName, new AuditTrailUserEvent { - UserId = String.Empty, + UserId = string.Empty, UserName = userName } )); @@ -91,12 +91,12 @@ private async Task RecordAuditTrailEventAsync(string name, IUser user, string us var userId = await _userManager.GetUserIdAsync(user); - if (String.IsNullOrEmpty(userIdActual)) + if (string.IsNullOrEmpty(userIdActual)) { userIdActual = userId; } - if (String.IsNullOrEmpty(userNameActual)) + if (string.IsNullOrEmpty(userNameActual)) { userNameActual = userName; } diff --git a/src/OrchardCore.Modules/OrchardCore.Users/Controllers/AccountController.cs b/src/OrchardCore.Modules/OrchardCore.Users/Controllers/AccountController.cs index efd1b72b751..6db514be774 100644 --- a/src/OrchardCore.Modules/OrchardCore.Users/Controllers/AccountController.cs +++ b/src/OrchardCore.Modules/OrchardCore.Users/Controllers/AccountController.cs @@ -164,7 +164,7 @@ public async Task Login(LoginViewModel model, string returnUrl = var disableLocalLogin = (await _siteService.GetSiteSettingsAsync()).As().DisableLocalLogin; if (disableLocalLogin) { - ModelState.AddModelError(String.Empty, S["Local login is disabled."]); + ModelState.AddModelError(string.Empty, S["Local login is disabled."]); } else { @@ -204,7 +204,7 @@ public async Task Login(LoginViewModel model, string returnUrl = if (result.IsLockedOut) { - ModelState.AddModelError(String.Empty, S["The account is locked out"]); + ModelState.AddModelError(string.Empty, S["The account is locked out"]); await _accountEvents.InvokeAsync((e, user) => e.IsLockedOutAsync(user), user, _logger); return View(); @@ -214,7 +214,7 @@ public async Task Login(LoginViewModel model, string returnUrl = await _accountEvents.InvokeAsync((e, user) => e.LoggingInFailedAsync(user), user, _logger); } - ModelState.AddModelError(String.Empty, S["Invalid login attempt."]); + ModelState.AddModelError(string.Empty, S["Invalid login attempt."]); } // Login failed unknown user. @@ -332,7 +332,7 @@ public async Task ExternalLoginCallback(string returnUrl = null, if (remoteError != null) { _logger.LogError("Error from external provider: {Error}", remoteError); - ModelState.AddModelError(String.Empty, S["An error occurred in external provider."]); + ModelState.AddModelError(string.Empty, S["An error occurred in external provider."]); return RedirectToLogin(returnUrl); } @@ -341,7 +341,7 @@ public async Task ExternalLoginCallback(string returnUrl = null, if (info == null) { _logger.LogError("Could not get external login info."); - ModelState.AddModelError(String.Empty, S["An error occurred in external provider."]); + ModelState.AddModelError(string.Empty, S["An error occurred in external provider."]); return RedirectToLogin(returnUrl); } @@ -364,7 +364,7 @@ public async Task ExternalLoginCallback(string returnUrl = null, } else { - ModelState.AddModelError(String.Empty, S["Invalid login attempt."]); + ModelState.AddModelError(string.Empty, S["Invalid login attempt."]); } } } @@ -372,7 +372,7 @@ public async Task ExternalLoginCallback(string returnUrl = null, { var email = info.Principal.FindFirstValue(ClaimTypes.Email) ?? info.Principal.FindFirstValue("email"); - if (!String.IsNullOrWhiteSpace(email)) + if (!string.IsNullOrWhiteSpace(email)) { iUser = await _userManager.FindByEmailAsync(email); } @@ -405,7 +405,7 @@ public async Task ExternalLoginCallback(string returnUrl = null, { var message = S["Site does not allow user registration."]; _logger.LogWarning("Site does not allow user registration."); - ModelState.AddModelError(String.Empty, message); + ModelState.AddModelError(string.Empty, message); } else { @@ -478,7 +478,7 @@ public async Task ExternalLoginCallback(string returnUrl = null, return await LoggedInActionResultAsync(iUser, returnUrl, info); } - ModelState.AddModelError(String.Empty, S["Invalid login attempt."]); + ModelState.AddModelError(string.Empty, S["Invalid login attempt."]); return RedirectToLogin(returnUrl); } @@ -526,12 +526,12 @@ public async Task RegisterExternalLogin(RegisterExternalLoginView ModelState.Clear(); - if (model.NoEmail && String.IsNullOrWhiteSpace(model.Email)) + if (model.NoEmail && string.IsNullOrWhiteSpace(model.Email)) { model.Email = info.Principal.FindFirstValue(ClaimTypes.Email) ?? info.Principal.FindFirstValue("email"); } - if (model.NoUsername && String.IsNullOrWhiteSpace(model.UserName)) + if (model.NoUsername && string.IsNullOrWhiteSpace(model.UserName)) { model.UserName = await GenerateUsernameAsync(info); } @@ -555,7 +555,7 @@ public async Task RegisterExternalLogin(RegisterExternalLoginView if (iUser is null) { - ModelState.AddModelError(String.Empty, "Registration Failed."); + ModelState.AddModelError(string.Empty, "Registration Failed."); } else { @@ -638,7 +638,7 @@ public async Task LinkExternalLogin(LinkExternalLoginViewModel mo if (!signInResult.Succeeded) { user = null; - ModelState.AddModelError(String.Empty, S["Invalid login attempt."]); + ModelState.AddModelError(string.Empty, S["Invalid login attempt."]); } else { @@ -769,7 +769,7 @@ public async Task RemoveLogin(RemoveLoginViewModel model) private async Task GenerateUsernameAsync(ExternalLoginInfo info) { - var ret = String.Concat("u", IdGenerator.GenerateId()); + var ret = string.Concat("u", IdGenerator.GenerateId()); var externalClaims = info?.Principal.GetSerializableClaims(); var userNames = new Dictionary(); @@ -778,7 +778,7 @@ private async Task GenerateUsernameAsync(ExternalLoginInfo info) try { var userName = await item.GenerateUserName(info.LoginProvider, externalClaims.ToArray()); - if (!String.IsNullOrWhiteSpace(userName)) + if (!string.IsNullOrWhiteSpace(userName)) { // Set the return value to the username generated by the first IExternalLoginHandler. if (userNames.Count == 0) @@ -831,7 +831,7 @@ private void CopyTempDataErrorsToModelState() { foreach (var errorMessage in TempData.Where(x => x.Key.StartsWith("error")).Select(x => x.Value.ToString())) { - ModelState.AddModelError(String.Empty, errorMessage); + ModelState.AddModelError(string.Empty, errorMessage); } } @@ -839,7 +839,7 @@ private bool AddUserEnabledError(IUser user) { if (user is not User localUser || !localUser.IsEnabled) { - ModelState.AddModelError(String.Empty, S["The specified user is not allowed to sign in."]); + ModelState.AddModelError(string.Empty, S["The specified user is not allowed to sign in."]); return true; } @@ -855,7 +855,7 @@ private async Task AddConfirmEmailErrorAsync(IUser user) // Require that the users have a confirmed email before they can log on. if (!await _userManager.IsEmailConfirmedAsync(user)) { - ModelState.AddModelError(String.Empty, S["You must confirm your email."]); + ModelState.AddModelError(string.Empty, S["You must confirm your email."]); return true; } } @@ -867,7 +867,7 @@ private void AddIdentityErrors(IdentityResult result) { foreach (var error in result.Errors) { - ModelState.AddModelError(String.Empty, error.Description); + ModelState.AddModelError(string.Empty, error.Description); } } } diff --git a/src/OrchardCore.Modules/OrchardCore.Users/Controllers/AdminController.cs b/src/OrchardCore.Modules/OrchardCore.Users/Controllers/AdminController.cs index ee5771b6822..d3255e76c06 100644 --- a/src/OrchardCore.Modules/OrchardCore.Users/Controllers/AdminController.cs +++ b/src/OrchardCore.Modules/OrchardCore.Users/Controllers/AdminController.cs @@ -170,12 +170,12 @@ public async Task Index([ModelBinder(BinderType = typeof(UserFilte options.UserRoleFilters = new List() { - new SelectListItem() { Text = S["All roles"], Value = String.Empty, Selected = (options.SelectedRole == String.Empty) }, - new SelectListItem() { Text = S["Authenticated (no roles)"], Value = "Authenticated", Selected = String.Equals(options.SelectedRole, "Authenticated", StringComparison.OrdinalIgnoreCase) } + new SelectListItem() { Text = S["All roles"], Value = string.Empty, Selected = (options.SelectedRole == string.Empty) }, + new SelectListItem() { Text = S["Authenticated (no roles)"], Value = "Authenticated", Selected = string.Equals(options.SelectedRole, "Authenticated", StringComparison.OrdinalIgnoreCase) } }; // TODO Candidate for dynamic localization. - options.UserRoleFilters.AddRange(allRoles.Select(x => new SelectListItem { Text = x, Value = x, Selected = String.Equals(options.SelectedRole, x, StringComparison.OrdinalIgnoreCase) })); + options.UserRoleFilters.AddRange(allRoles.Select(x => new SelectListItem { Text = x, Value = x, Selected = string.Equals(options.SelectedRole, x, StringComparison.OrdinalIgnoreCase) })); // Populate options pager summary values. var startIndex = (pagerShape.Page - 1) * (pagerShape.PageSize) + 1; @@ -184,7 +184,7 @@ public async Task Index([ModelBinder(BinderType = typeof(UserFilte options.UsersCount = userEntries.Count; options.TotalItemCount = pagerShape.TotalItemCount; - var header = await _userOptionsDisplayManager.BuildEditorAsync(options, _updateModelAccessor.ModelUpdater, false, String.Empty, String.Empty); + var header = await _userOptionsDisplayManager.BuildEditorAsync(options, _updateModelAccessor.ModelUpdater, false, string.Empty, string.Empty); var shapeViewModel = await _shapeFactory.CreateAsync("UsersAdminList", viewModel => { @@ -202,13 +202,13 @@ public async Task Index([ModelBinder(BinderType = typeof(UserFilte public async Task IndexFilterPOST(UserIndexOptions options) { // When the user has typed something into the search input no further evaluation of the form post is required. - if (!String.Equals(options.SearchText, options.OriginalSearchText, StringComparison.OrdinalIgnoreCase)) + if (!string.Equals(options.SearchText, options.OriginalSearchText, StringComparison.OrdinalIgnoreCase)) { return RedirectToAction(nameof(Index), new RouteValueDictionary { { "q", options.SearchText } }); } // Evaluate the values provided in the form post and map them to the filter result and route values. - await _userOptionsDisplayManager.UpdateEditorAsync(options, _updateModelAccessor.ModelUpdater, false, String.Empty, String.Empty); + await _userOptionsDisplayManager.UpdateEditorAsync(options, _updateModelAccessor.ModelUpdater, false, string.Empty, string.Empty); // The route value must always be added after the editors have updated the models. options.RouteValues.TryAdd("q", options.FilterResult.ToString()); @@ -288,7 +288,7 @@ public async Task Create() return Forbid(); } - var shape = await _userDisplayManager.BuildEditorAsync(user, updater: _updateModelAccessor.ModelUpdater, isNew: true, String.Empty, String.Empty); + var shape = await _userDisplayManager.BuildEditorAsync(user, updater: _updateModelAccessor.ModelUpdater, isNew: true, string.Empty, string.Empty); return View(shape); } @@ -304,7 +304,7 @@ public async Task CreatePost([Bind(Prefix = "User.Password")] str return Forbid(); } - var shape = await _userDisplayManager.UpdateEditorAsync(user, updater: _updateModelAccessor.ModelUpdater, isNew: true, String.Empty, String.Empty); + var shape = await _userDisplayManager.UpdateEditorAsync(user, updater: _updateModelAccessor.ModelUpdater, isNew: true, string.Empty, string.Empty); if (!ModelState.IsValid) { @@ -327,7 +327,7 @@ public async Task Edit(string id, string returnUrl) { // When no id is provided we assume the user is trying to edit their own profile. var editingOwnUser = false; - if (String.IsNullOrEmpty(id)) + if (string.IsNullOrEmpty(id)) { id = User.FindFirstValue(ClaimTypes.NameIdentifier); if (!await _authorizationService.AuthorizeAsync(User, CommonPermissions.EditOwnUser)) @@ -347,7 +347,7 @@ public async Task Edit(string id, string returnUrl) return Forbid(); } - var shape = await _userDisplayManager.BuildEditorAsync(user, updater: _updateModelAccessor.ModelUpdater, isNew: false, String.Empty, String.Empty); + var shape = await _userDisplayManager.BuildEditorAsync(user, updater: _updateModelAccessor.ModelUpdater, isNew: false, string.Empty, string.Empty); ViewData["ReturnUrl"] = returnUrl; @@ -360,7 +360,7 @@ public async Task EditPost(string id, string returnUrl) { // When no id is provided we assume the user is trying to edit their own profile. var editingOwnUser = false; - if (String.IsNullOrEmpty(id)) + if (string.IsNullOrEmpty(id)) { editingOwnUser = true; id = User.FindFirstValue(ClaimTypes.NameIdentifier); @@ -380,7 +380,7 @@ public async Task EditPost(string id, string returnUrl) return Forbid(); } - var shape = await _userDisplayManager.UpdateEditorAsync(user, updater: _updateModelAccessor.ModelUpdater, isNew: false, String.Empty, String.Empty); + var shape = await _userDisplayManager.UpdateEditorAsync(user, updater: _updateModelAccessor.ModelUpdater, isNew: false, string.Empty, string.Empty); if (!ModelState.IsValid) { @@ -391,7 +391,7 @@ public async Task EditPost(string id, string returnUrl) foreach (var error in result.Errors) { - ModelState.AddModelError(String.Empty, error.Description); + ModelState.AddModelError(string.Empty, error.Description); } if (!ModelState.IsValid) @@ -408,7 +408,7 @@ public async Task EditPost(string id, string returnUrl) if (editingOwnUser) { - if (!String.IsNullOrEmpty(returnUrl)) + if (!string.IsNullOrEmpty(returnUrl)) { return this.LocalRedirect(returnUrl, true); } @@ -416,7 +416,7 @@ public async Task EditPost(string id, string returnUrl) return RedirectToAction(nameof(Edit)); } - if (!String.IsNullOrEmpty(returnUrl)) + if (!string.IsNullOrEmpty(returnUrl)) { return this.LocalRedirect(returnUrl, true); } diff --git a/src/OrchardCore.Modules/OrchardCore.Users/Controllers/AuthenticatorAppController.cs b/src/OrchardCore.Modules/OrchardCore.Users/Controllers/AuthenticatorAppController.cs index 588b7843676..6a5f737d432 100644 --- a/src/OrchardCore.Modules/OrchardCore.Users/Controllers/AuthenticatorAppController.cs +++ b/src/OrchardCore.Modules/OrchardCore.Users/Controllers/AuthenticatorAppController.cs @@ -147,7 +147,7 @@ private async Task LoadSharedKeyAndQrCodeUriAsync( // Load the authenticator key & QR code URI to display on the form. var unformattedKey = await UserManager.GetAuthenticatorKeyAsync(user); - if (String.IsNullOrEmpty(unformattedKey)) + if (string.IsNullOrEmpty(unformattedKey)) { await UserManager.ResetAuthenticatorKeyAsync(user); unformattedKey = await UserManager.GetAuthenticatorKeyAsync(user); @@ -186,9 +186,9 @@ private async Task GenerateQrCodeUriAsync(string displayName, string unf { var site = await SiteService.GetSiteSettingsAsync(); - var issuer = String.IsNullOrWhiteSpace(site.SiteName) ? _shellSettings.Name : site.SiteName.Trim(); + var issuer = string.IsNullOrWhiteSpace(site.SiteName) ? _shellSettings.Name : site.SiteName.Trim(); - return String.Format( + return string.Format( CultureInfo.InvariantCulture, AuthenticatorUriFormat, _urlEncoder.Encode(issuer), diff --git a/src/OrchardCore.Modules/OrchardCore.Users/Controllers/EmailAuthenticatorController.cs b/src/OrchardCore.Modules/OrchardCore.Users/Controllers/EmailAuthenticatorController.cs index 5b9dbf40c07..7295e12b886 100644 --- a/src/OrchardCore.Modules/OrchardCore.Users/Controllers/EmailAuthenticatorController.cs +++ b/src/OrchardCore.Modules/OrchardCore.Users/Controllers/EmailAuthenticatorController.cs @@ -190,7 +190,7 @@ public async Task SendCode() private Task GetSubjectAsync(EmailAuthenticatorLoginSettings settings, IUser user, string code) { - var message = String.IsNullOrWhiteSpace(settings.Subject) + var message = string.IsNullOrWhiteSpace(settings.Subject) ? EmailAuthenticatorLoginSettings.DefaultSubject : settings.Subject; @@ -199,7 +199,7 @@ private Task GetSubjectAsync(EmailAuthenticatorLoginSettings settings, I private Task GetBodyAsync(EmailAuthenticatorLoginSettings settings, IUser user, string code) { - var message = String.IsNullOrWhiteSpace(settings.Body) + var message = string.IsNullOrWhiteSpace(settings.Body) ? EmailAuthenticatorLoginSettings.DefaultBody : settings.Body; diff --git a/src/OrchardCore.Modules/OrchardCore.Users/Controllers/RegistrationController.cs b/src/OrchardCore.Modules/OrchardCore.Users/Controllers/RegistrationController.cs index 5cf4af2a16f..245f169ae12 100644 --- a/src/OrchardCore.Modules/OrchardCore.Users/Controllers/RegistrationController.cs +++ b/src/OrchardCore.Modules/OrchardCore.Users/Controllers/RegistrationController.cs @@ -70,7 +70,7 @@ public async Task Register(RegisterViewModel model, string return return NotFound(); } - if (String.IsNullOrEmpty(model.Email)) + if (string.IsNullOrEmpty(model.Email)) { ModelState.AddModelError("Email", S["Email is required."]); } diff --git a/src/OrchardCore.Modules/OrchardCore.Users/Controllers/SmsAuthenticatorController.cs b/src/OrchardCore.Modules/OrchardCore.Users/Controllers/SmsAuthenticatorController.cs index 7df2ab02c94..02b8b78e78a 100644 --- a/src/OrchardCore.Modules/OrchardCore.Users/Controllers/SmsAuthenticatorController.cs +++ b/src/OrchardCore.Modules/OrchardCore.Users/Controllers/SmsAuthenticatorController.cs @@ -85,7 +85,7 @@ public async Task Index() { PhoneNumber = currentPhoneNumber, AllowChangingPhoneNumber = settings.AllowChangingPhoneNumber - || String.IsNullOrEmpty(currentPhoneNumber) + || string.IsNullOrEmpty(currentPhoneNumber) || !_phoneFormatValidator.IsValid(currentPhoneNumber), }; @@ -106,7 +106,7 @@ public async Task IndexPost(RequestCodeSmsAuthenticatorViewModel var currentPhoneNumber = await UserManager.GetPhoneNumberAsync(user); var canSetNewPhone = settings.AllowChangingPhoneNumber - || String.IsNullOrEmpty(currentPhoneNumber) + || string.IsNullOrEmpty(currentPhoneNumber) || !_phoneFormatValidator.IsValid(currentPhoneNumber); model.AllowChangingPhoneNumber = canSetNewPhone; @@ -179,7 +179,7 @@ public async Task ValidateCode(EnableSmsAuthenticatorViewModel mo return UserNotFound(); } - if (String.IsNullOrWhiteSpace(model.PhoneNumber)) + if (string.IsNullOrWhiteSpace(model.PhoneNumber)) { await Notifier.ErrorAsync(H["Unable to find a phone number."]); @@ -240,7 +240,7 @@ public async Task SendCode() private Task GetBodyAsync(SmsAuthenticatorLoginSettings settings, IUser user, string code) { - var message = String.IsNullOrWhiteSpace(settings.Body) + var message = string.IsNullOrWhiteSpace(settings.Body) ? EmailAuthenticatorLoginSettings.DefaultBody : settings.Body; diff --git a/src/OrchardCore.Modules/OrchardCore.Users/Controllers/TwoFactorAuthenticationBaseController.cs b/src/OrchardCore.Modules/OrchardCore.Users/Controllers/TwoFactorAuthenticationBaseController.cs index 46936de9cbb..b0907fa6afd 100644 --- a/src/OrchardCore.Modules/OrchardCore.Users/Controllers/TwoFactorAuthenticationBaseController.cs +++ b/src/OrchardCore.Modules/OrchardCore.Users/Controllers/TwoFactorAuthenticationBaseController.cs @@ -169,7 +169,7 @@ protected IActionResult UserNotFound() => NotFound("Unable to load user."); protected static string StripToken(string code) - => code.Replace(" ", String.Empty).Replace("-", String.Empty); + => code.Replace(" ", string.Empty).Replace("-", string.Empty); protected static string GetRecoveryCodesCacheKey(string userId) => $"TwoFactorAuthenticationRecoveryCodes_{userId}"; diff --git a/src/OrchardCore.Modules/OrchardCore.Users/Controllers/TwoFactorAuthenticationController.cs b/src/OrchardCore.Modules/OrchardCore.Users/Controllers/TwoFactorAuthenticationController.cs index b6039de50c3..87ba7b5bd84 100644 --- a/src/OrchardCore.Modules/OrchardCore.Users/Controllers/TwoFactorAuthenticationController.cs +++ b/src/OrchardCore.Modules/OrchardCore.Users/Controllers/TwoFactorAuthenticationController.cs @@ -81,7 +81,7 @@ public async Task LoginWithTwoFactorAuthentication(bool rememberM var currentProvider = GetProvider(providers, user, provider, next); - if (String.IsNullOrEmpty(currentProvider)) + if (string.IsNullOrEmpty(currentProvider)) { await Notifier.ErrorAsync(H["Unable to find an active two-factor provider."]); @@ -116,7 +116,7 @@ public async Task LoginWithTwoFactorAuthenticationPost(LoginWithT var currentProvider = GetProvider(providers, user, model.CurrentProvider, false); - if (String.IsNullOrEmpty(currentProvider)) + if (string.IsNullOrEmpty(currentProvider)) { await Notifier.ErrorAsync(H["Unable to find an active two-factor provider."]); @@ -141,13 +141,13 @@ public async Task LoginWithTwoFactorAuthenticationPost(LoginWithT if (result.IsLockedOut) { _logger.LogWarning("User account locked out."); - ModelState.AddModelError(String.Empty, S["The account is locked out."]); + ModelState.AddModelError(string.Empty, S["The account is locked out."]); await _accountEvents.InvokeAsync((e, user) => e.IsLockedOutAsync(user), user, _logger); return RedirectToAccountLogin(); } - ModelState.AddModelError(String.Empty, S["Invalid verification code."]); + ModelState.AddModelError(string.Empty, S["Invalid verification code."]); // Login failed with a known user. await _accountEvents.InvokeAsync((e, user) => e.LoggingInFailedAsync(user), user, _logger); @@ -187,7 +187,7 @@ public async Task LoginWithRecoveryCode(LoginWithRecoveryCodeView return RedirectToAccountLogin(); } - var recoveryCode = model.RecoveryCode.Replace(" ", String.Empty); + var recoveryCode = model.RecoveryCode.Replace(" ", string.Empty); var result = await SignInManager.TwoFactorRecoveryCodeSignInAsync(recoveryCode); @@ -202,14 +202,14 @@ public async Task LoginWithRecoveryCode(LoginWithRecoveryCodeView { _logger.LogWarning("User account locked out."); - ModelState.AddModelError(String.Empty, S["The account is locked out"]); + ModelState.AddModelError(string.Empty, S["The account is locked out"]); await _accountEvents.InvokeAsync((e, user) => e.IsLockedOutAsync(user), user, _logger); return RedirectToAccountLogin(); } _logger.LogWarning("Invalid recovery code entered for user."); - ModelState.AddModelError(String.Empty, S["Invalid recovery code entered."]); + ModelState.AddModelError(string.Empty, S["Invalid recovery code entered."]); } return View(model); @@ -446,7 +446,7 @@ private async Task GetCachedRecoveryCodes(string userId) private static string GetProvider(IList providers, IUser user, string provider = null, bool next = false) { - var validProviderRequested = !String.IsNullOrEmpty(provider) && providers.Contains(provider); + var validProviderRequested = !string.IsNullOrEmpty(provider) && providers.Contains(provider); var defaultProvider = validProviderRequested ? provider : providers.FirstOrDefault(); if (!validProviderRequested && user is User u) @@ -454,7 +454,7 @@ private static string GetProvider(IList providers, IUser user, string pr // At this point, no or invalid provider was given. Check the user preference and load the default provider if available. var preferences = u.As(); - if (!String.IsNullOrEmpty(preferences.DefaultProvider) && providers.Contains(preferences.DefaultProvider)) + if (!string.IsNullOrEmpty(preferences.DefaultProvider) && providers.Contains(preferences.DefaultProvider)) { defaultProvider = preferences.DefaultProvider; } diff --git a/src/OrchardCore.Modules/OrchardCore.Users/CustomUserSettingsPermissions.cs b/src/OrchardCore.Modules/OrchardCore.Users/CustomUserSettingsPermissions.cs index 5d45e5c387d..f10ee3b88c5 100644 --- a/src/OrchardCore.Modules/OrchardCore.Users/CustomUserSettingsPermissions.cs +++ b/src/OrchardCore.Modules/OrchardCore.Users/CustomUserSettingsPermissions.cs @@ -29,8 +29,8 @@ public Task> GetPermissionsAsync() public static Permission CreatePermissionForType(ContentTypeDefinition type) => new( - String.Format(_manageOwnCustomUserSettings.Name, type.Name), - String.Format(_manageOwnCustomUserSettings.Description, type.DisplayName), + string.Format(_manageOwnCustomUserSettings.Name, type.Name), + string.Format(_manageOwnCustomUserSettings.Description, type.DisplayName), _manageOwnCustomUserSettings.ImpliedBy ); } diff --git a/src/OrchardCore.Modules/OrchardCore.Users/Drivers/AuthenticatorAppLoginSettingsDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.Users/Drivers/AuthenticatorAppLoginSettingsDisplayDriver.cs index 557e13f0788..124d73790bf 100644 --- a/src/OrchardCore.Modules/OrchardCore.Users/Drivers/AuthenticatorAppLoginSettingsDisplayDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Users/Drivers/AuthenticatorAppLoginSettingsDisplayDriver.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Http; diff --git a/src/OrchardCore.Modules/OrchardCore.Users/Drivers/EmailAuthenticatorLoginSettingsDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.Users/Drivers/EmailAuthenticatorLoginSettingsDisplayDriver.cs index a8d3134f963..4e7e366b831 100644 --- a/src/OrchardCore.Modules/OrchardCore.Users/Drivers/EmailAuthenticatorLoginSettingsDisplayDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Users/Drivers/EmailAuthenticatorLoginSettingsDisplayDriver.cs @@ -33,8 +33,8 @@ public override IDisplayResult Edit(EmailAuthenticatorLoginSettings settings) { return Initialize("EmailAuthenticatorLoginSettings_Edit", model => { - model.Subject = String.IsNullOrWhiteSpace(settings.Subject) ? EmailAuthenticatorLoginSettings.DefaultSubject : settings.Subject; - model.Body = String.IsNullOrWhiteSpace(settings.Body) ? EmailAuthenticatorLoginSettings.DefaultBody : settings.Body; + model.Subject = string.IsNullOrWhiteSpace(settings.Subject) ? EmailAuthenticatorLoginSettings.DefaultSubject : settings.Subject; + model.Body = string.IsNullOrWhiteSpace(settings.Body) ? EmailAuthenticatorLoginSettings.DefaultBody : settings.Body; }).Location("Content:10#Two-Factor Authentication") .RenderWhen(() => _authorizationService.AuthorizeAsync(_httpContextAccessor.HttpContext?.User, CommonPermissions.ManageUsers)) .OnGroup(LoginSettingsDisplayDriver.GroupId); @@ -52,12 +52,12 @@ public override async Task UpdateAsync(EmailAuthenticatorLoginSe if (!_liquidTemplateManager.Validate(settings.Subject, out var subjectErrors)) { - context.Updater.ModelState.AddModelError(Prefix, nameof(settings.Subject), String.Join(' ', subjectErrors)); + context.Updater.ModelState.AddModelError(Prefix, nameof(settings.Subject), string.Join(' ', subjectErrors)); } if (!_liquidTemplateManager.Validate(settings.Body, out var bodyErrors)) { - context.Updater.ModelState.AddModelError(Prefix, nameof(settings.Body), String.Join(' ', bodyErrors)); + context.Updater.ModelState.AddModelError(Prefix, nameof(settings.Body), string.Join(' ', bodyErrors)); } return Edit(settings); diff --git a/src/OrchardCore.Modules/OrchardCore.Users/Drivers/SmsAuthenticatorLoginSettingsDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.Users/Drivers/SmsAuthenticatorLoginSettingsDisplayDriver.cs index c2e0d99c8b5..e614b2acf23 100644 --- a/src/OrchardCore.Modules/OrchardCore.Users/Drivers/SmsAuthenticatorLoginSettingsDisplayDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Users/Drivers/SmsAuthenticatorLoginSettingsDisplayDriver.cs @@ -33,7 +33,7 @@ public override IDisplayResult Edit(SmsAuthenticatorLoginSettings settings) { return Initialize("SmsAuthenticatorLoginSettings_Edit", model => { - model.Body = String.IsNullOrWhiteSpace(settings.Body) + model.Body = string.IsNullOrWhiteSpace(settings.Body) ? EmailAuthenticatorLoginSettings.DefaultBody : settings.Body; }).Location("Content:15#Two-Factor Authentication") @@ -53,7 +53,7 @@ public override async Task UpdateAsync(SmsAuthenticatorLoginSett if (!_liquidTemplateManager.Validate(settings.Body, out var bodyErrors)) { - context.Updater.ModelState.AddModelError(Prefix, nameof(settings.Body), String.Join(' ', bodyErrors)); + context.Updater.ModelState.AddModelError(Prefix, nameof(settings.Body), string.Join(' ', bodyErrors)); } return Edit(settings); diff --git a/src/OrchardCore.Modules/OrchardCore.Users/Drivers/TwoFactorMethodDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.Users/Drivers/TwoFactorMethodDisplayDriver.cs index 8fc1d634e6b..439c21d5676 100644 --- a/src/OrchardCore.Modules/OrchardCore.Users/Drivers/TwoFactorMethodDisplayDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Users/Drivers/TwoFactorMethodDisplayDriver.cs @@ -10,7 +10,7 @@ public class TwoFactorMethodDisplayDriver : DisplayDriver { public override Task DisplayAsync(TwoFactorMethod model, BuildDisplayContext context) { - if (String.IsNullOrEmpty(model.Provider)) + if (string.IsNullOrEmpty(model.Provider)) { return Task.FromResult(null); } diff --git a/src/OrchardCore.Modules/OrchardCore.Users/Drivers/TwoFactorMethodLoginAuthenticationAppDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.Users/Drivers/TwoFactorMethodLoginAuthenticationAppDisplayDriver.cs index 3bbc9d7121d..ece8681ab8f 100644 --- a/src/OrchardCore.Modules/OrchardCore.Users/Drivers/TwoFactorMethodLoginAuthenticationAppDisplayDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Users/Drivers/TwoFactorMethodLoginAuthenticationAppDisplayDriver.cs @@ -1,4 +1,4 @@ -using Microsoft.AspNetCore.Identity; +using Microsoft.AspNetCore.Identity; using OrchardCore.DisplayManagement.Handlers; using OrchardCore.DisplayManagement.Views; using OrchardCore.Users.Models; diff --git a/src/OrchardCore.Modules/OrchardCore.Users/Drivers/UserDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.Users/Drivers/UserDisplayDriver.cs index ed32be74cd9..4ef2cdcf626 100644 --- a/src/OrchardCore.Modules/OrchardCore.Users/Drivers/UserDisplayDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Users/Drivers/UserDisplayDriver.cs @@ -94,7 +94,7 @@ public override async Task UpdateAsync(User user, UpdateEditorCo if (context.IsNew) { - if (String.IsNullOrWhiteSpace(model.Password)) + if (string.IsNullOrWhiteSpace(model.Password)) { context.Updater.ModelState.AddModelError(Prefix, nameof(model.Password), S["A password is required"]); } diff --git a/src/OrchardCore.Modules/OrchardCore.Users/Drivers/UserInformationDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.Users/Drivers/UserInformationDisplayDriver.cs index e41f41c6759..b39b84fa93a 100644 --- a/src/OrchardCore.Modules/OrchardCore.Users/Drivers/UserInformationDisplayDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Users/Drivers/UserInformationDisplayDriver.cs @@ -106,7 +106,7 @@ public override async Task UpdateAsync(User user, UpdateEditorCo if (await context.Updater.TryUpdateModelAsync(phoneNumberModel, Prefix)) { - if (!String.IsNullOrEmpty(phoneNumberModel.PhoneNumber) && !_phoneFormatValidator.IsValid(phoneNumberModel.PhoneNumber)) + if (!string.IsNullOrEmpty(phoneNumberModel.PhoneNumber) && !_phoneFormatValidator.IsValid(phoneNumberModel.PhoneNumber)) { context.Updater.ModelState.AddModelError(Prefix, nameof(phoneNumberModel.PhoneNumber), S["Please provide a valid phone number."]); } @@ -135,7 +135,7 @@ public override async Task UpdateAsync(User user, UpdateEditorCo if (settings.AllowChangingPhoneNumber && await context.Updater.TryUpdateModelAsync(phoneNumberModel, Prefix)) { - if (!String.IsNullOrEmpty(phoneNumberModel.PhoneNumber) && !_phoneFormatValidator.IsValid(phoneNumberModel.PhoneNumber)) + if (!string.IsNullOrEmpty(phoneNumberModel.PhoneNumber) && !_phoneFormatValidator.IsValid(phoneNumberModel.PhoneNumber)) { context.Updater.ModelState.AddModelError(Prefix, nameof(phoneNumberModel.PhoneNumber), S["Please provide a valid phone number."]); } diff --git a/src/OrchardCore.Modules/OrchardCore.Users/Drivers/UserRoleDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.Users/Drivers/UserRoleDisplayDriver.cs index 6db3725ca80..9ebac41d371 100644 --- a/src/OrchardCore.Modules/OrchardCore.Users/Drivers/UserRoleDisplayDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Users/Drivers/UserRoleDisplayDriver.cs @@ -142,7 +142,7 @@ public override async Task UpdateAsync(User user, UpdateEditorCo foreach (var role in rolesToRemove) { - if (String.Equals(role, AdministratorRole, StringComparison.OrdinalIgnoreCase)) + if (string.Equals(role, AdministratorRole, StringComparison.OrdinalIgnoreCase)) { var enabledUsersOfAdminRole = (await _userManager.GetUsersInRoleAsync(AdministratorRole)) .Cast() diff --git a/src/OrchardCore.Modules/OrchardCore.Users/Handlers/ScriptExternalLoginEventHandler.cs b/src/OrchardCore.Modules/OrchardCore.Users/Handlers/ScriptExternalLoginEventHandler.cs index aa94e7ca890..f79c5990ffd 100644 --- a/src/OrchardCore.Modules/OrchardCore.Users/Handlers/ScriptExternalLoginEventHandler.cs +++ b/src/OrchardCore.Modules/OrchardCore.Users/Handlers/ScriptExternalLoginEventHandler.cs @@ -40,7 +40,7 @@ public async Task GenerateUserName(string provider, IEnumerable GenerateUserName(string provider, IEnumerable ProcessAsync(FluidValue input, FilterArgument var permissionName = arguments["permission"].Or(arguments.At(0)).ToStringValue(); var resource = arguments["resource"].Or(arguments.At(1)).ToObjectValue(); - if (!String.IsNullOrEmpty(permissionName) && + if (!string.IsNullOrEmpty(permissionName) && await _authorizationService.AuthorizeAsync(user, new Permission(permissionName), resource)) { return BooleanValue.True; diff --git a/src/OrchardCore.Modules/OrchardCore.Users/Properties/AssemblyInfo.cs b/src/OrchardCore.Modules/OrchardCore.Users/Properties/AssemblyInfo.cs index 7906c602d77..8d0a5522152 100644 --- a/src/OrchardCore.Modules/OrchardCore.Users/Properties/AssemblyInfo.cs +++ b/src/OrchardCore.Modules/OrchardCore.Users/Properties/AssemblyInfo.cs @@ -1,4 +1,4 @@ -using System.Reflection; +using System.Reflection; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following diff --git a/src/OrchardCore.Modules/OrchardCore.Users/Services/DefaultUsersAdminListFilterProvider.cs b/src/OrchardCore.Modules/OrchardCore.Users/Services/DefaultUsersAdminListFilterProvider.cs index adf24af37ee..05f3ead7488 100644 --- a/src/OrchardCore.Modules/OrchardCore.Users/Services/DefaultUsersAdminListFilterProvider.cs +++ b/src/OrchardCore.Modules/OrchardCore.Users/Services/DefaultUsersAdminListFilterProvider.cs @@ -47,7 +47,7 @@ public void Build(QueryEngineBuilder builder) { UsersFilter.Enabled => (true, model.Filter.ToString()), UsersFilter.Disabled => (true, model.Filter.ToString()), - _ => (false, String.Empty) + _ => (false, string.Empty) }; }) ) @@ -87,7 +87,7 @@ public void Build(QueryEngineBuilder builder) return (true, model.Order.ToString()); } - return (false, String.Empty); + return (false, string.Empty); }) .AlwaysRun() ) @@ -102,7 +102,7 @@ public void Build(QueryEngineBuilder builder) return new ValueTask>(query); }) .MapTo((val, model) => model.SelectedRole = val) - .MapFrom((model) => (!String.IsNullOrEmpty(model.SelectedRole), model.SelectedRole)) + .MapFrom((model) => (!string.IsNullOrEmpty(model.SelectedRole), model.SelectedRole)) ) .WithDefaultTerm(UsersAdminListFilterOptions.DefaultTermName, builder => builder .ManyCondition( diff --git a/src/OrchardCore.Modules/OrchardCore.Users/Services/DefaultUsersAdminListQueryService.cs b/src/OrchardCore.Modules/OrchardCore.Users/Services/DefaultUsersAdminListQueryService.cs index a0164fa5a40..33a3f839463 100644 --- a/src/OrchardCore.Modules/OrchardCore.Users/Services/DefaultUsersAdminListQueryService.cs +++ b/src/OrchardCore.Modules/OrchardCore.Users/Services/DefaultUsersAdminListQueryService.cs @@ -41,7 +41,7 @@ public async Task> QueryAsync(UserIndexOptions options, IUpdateMode { var defaultTermNode = options.FilterResult.OfType().FirstOrDefault(); var defaultOperator = defaultTermNode?.Operation; - var defaultTermName = String.IsNullOrEmpty(_userAdminListFilterOptions.TermName) + var defaultTermName = string.IsNullOrEmpty(_userAdminListFilterOptions.TermName) ? UsersAdminListFilterOptions.DefaultTermName : _userAdminListFilterOptions.TermName; diff --git a/src/OrchardCore.Modules/OrchardCore.Users/Services/EmailClaimsProvider.cs b/src/OrchardCore.Modules/OrchardCore.Users/Services/EmailClaimsProvider.cs index 555d43aa85c..cf921112a1b 100644 --- a/src/OrchardCore.Modules/OrchardCore.Users/Services/EmailClaimsProvider.cs +++ b/src/OrchardCore.Modules/OrchardCore.Users/Services/EmailClaimsProvider.cs @@ -31,7 +31,7 @@ public async Task GenerateAsync(IUser user, ClaimsIdentity claims) // new 'IdentityOptions.ClaimsIdentity.EmailClaimType' or at least its default value which is 'ClaimTypes.Email'. var email = await _userManager.GetEmailAsync(user); - if (!String.IsNullOrEmpty(email)) + if (!string.IsNullOrEmpty(email)) { claims.AddClaim(new Claim("email", email)); diff --git a/src/OrchardCore.Modules/OrchardCore.Users/Services/RecipeEnvironmentSuperUserProvider.cs b/src/OrchardCore.Modules/OrchardCore.Users/Services/RecipeEnvironmentSuperUserProvider.cs index c1880d93e3f..f247b50a062 100644 --- a/src/OrchardCore.Modules/OrchardCore.Users/Services/RecipeEnvironmentSuperUserProvider.cs +++ b/src/OrchardCore.Modules/OrchardCore.Users/Services/RecipeEnvironmentSuperUserProvider.cs @@ -30,7 +30,7 @@ public RecipeEnvironmentSuperUserProvider( public async Task PopulateEnvironmentAsync(IDictionary environment) { var siteSettings = await _siteService.GetSiteSettingsAsync(); - if (!String.IsNullOrEmpty(siteSettings.SuperUser)) + if (!string.IsNullOrEmpty(siteSettings.SuperUser)) { try { diff --git a/src/OrchardCore.Modules/OrchardCore.Users/Services/SetupEventHandler.cs b/src/OrchardCore.Modules/OrchardCore.Users/Services/SetupEventHandler.cs index 0cfe6195580..b6272989a22 100644 --- a/src/OrchardCore.Modules/OrchardCore.Users/Services/SetupEventHandler.cs +++ b/src/OrchardCore.Modules/OrchardCore.Users/Services/SetupEventHandler.cs @@ -23,9 +23,9 @@ public Task SetupAsync(SetupContext context) { var user = new User { - UserName = context.Properties.TryGetValue(SetupConstants.AdminUsername, out var adminUserName) ? adminUserName?.ToString() : String.Empty, - UserId = context.Properties.TryGetValue(SetupConstants.AdminUserId, out var adminUserId) ? adminUserId?.ToString() : String.Empty, - Email = context.Properties.TryGetValue(SetupConstants.AdminEmail, out var adminEmail) ? adminEmail?.ToString() : String.Empty, + UserName = context.Properties.TryGetValue(SetupConstants.AdminUsername, out var adminUserName) ? adminUserName?.ToString() : string.Empty, + UserId = context.Properties.TryGetValue(SetupConstants.AdminUserId, out var adminUserId) ? adminUserId?.ToString() : string.Empty, + Email = context.Properties.TryGetValue(SetupConstants.AdminEmail, out var adminEmail) ? adminEmail?.ToString() : string.Empty, EmailConfirmed = true }; diff --git a/src/OrchardCore.Modules/OrchardCore.Users/Services/UsersThemeSelector.cs b/src/OrchardCore.Modules/OrchardCore.Users/Services/UsersThemeSelector.cs index 95511c1db94..bd4e9f75903 100644 --- a/src/OrchardCore.Modules/OrchardCore.Users/Services/UsersThemeSelector.cs +++ b/src/OrchardCore.Modules/OrchardCore.Users/Services/UsersThemeSelector.cs @@ -62,7 +62,7 @@ public async Task GetThemeAsync() var adminThemeName = await _adminThemeService.GetAdminThemeNameAsync(); - if (String.IsNullOrEmpty(adminThemeName)) + if (string.IsNullOrEmpty(adminThemeName)) { return null; } diff --git a/src/OrchardCore.Modules/OrchardCore.Users/TimeZone/Services/UserTimeZoneService.cs b/src/OrchardCore.Modules/OrchardCore.Users/TimeZone/Services/UserTimeZoneService.cs index 168f22914fe..21969a4f9f3 100644 --- a/src/OrchardCore.Modules/OrchardCore.Users/TimeZone/Services/UserTimeZoneService.cs +++ b/src/OrchardCore.Modules/OrchardCore.Users/TimeZone/Services/UserTimeZoneService.cs @@ -36,7 +36,7 @@ UserManager userManager public async Task GetUserTimeZoneAsync() { var currentTimeZoneId = await GetCurrentUserTimeZoneIdAsync(); - if (String.IsNullOrEmpty(currentTimeZoneId)) + if (string.IsNullOrEmpty(currentTimeZoneId)) { return null; } @@ -48,7 +48,7 @@ public Task UpdateUserTimeZoneAsync(User user) { var userName = user?.UserName; - if (!String.IsNullOrEmpty(userName)) + if (!string.IsNullOrEmpty(userName)) { return _distributedCache.RemoveAsync(GetCacheKey(userName)); } @@ -60,7 +60,7 @@ public async Task GetCurrentUserTimeZoneIdAsync() { var userName = _httpContextAccessor.HttpContext.User?.Identity?.Name; - if (String.IsNullOrEmpty(userName)) + if (string.IsNullOrEmpty(userName)) { return null; } @@ -68,12 +68,12 @@ public async Task GetCurrentUserTimeZoneIdAsync() var key = GetCacheKey(userName); var timeZoneId = await _distributedCache.GetStringAsync(key); - if (String.IsNullOrEmpty(timeZoneId)) + if (string.IsNullOrEmpty(timeZoneId)) { var user = await _userManager.FindByNameAsync(userName) as User; timeZoneId = user.As()?.TimeZoneId; - if (!String.IsNullOrEmpty(timeZoneId)) + if (!string.IsNullOrEmpty(timeZoneId)) { await _distributedCache.SetStringAsync(key, timeZoneId, new DistributedCacheEntryOptions { SlidingExpiration = _slidingExpiration }); } diff --git a/src/OrchardCore.Modules/OrchardCore.Users/UserMenuShapeTableProvider.cs b/src/OrchardCore.Modules/OrchardCore.Users/UserMenuShapeTableProvider.cs index 0bb2df0e3c8..aa8a5676c0a 100644 --- a/src/OrchardCore.Modules/OrchardCore.Users/UserMenuShapeTableProvider.cs +++ b/src/OrchardCore.Modules/OrchardCore.Users/UserMenuShapeTableProvider.cs @@ -18,7 +18,7 @@ public void Discover(ShapeTableBuilder builder) builder.Describe($"{ShapeTypePrefix}*") .OnDisplaying(context => { - if (String.IsNullOrEmpty(context.Shape.Metadata.DisplayType) || context.Shape.Metadata.DisplayType == "Detail") + if (string.IsNullOrEmpty(context.Shape.Metadata.DisplayType) || context.Shape.Metadata.DisplayType == "Detail") { return; } diff --git a/src/OrchardCore.Modules/OrchardCore.Users/ViewModels/EditUserEmailViewModel.cs b/src/OrchardCore.Modules/OrchardCore.Users/ViewModels/EditUserEmailViewModel.cs index ae1e83b6545..a23fd853b8d 100644 --- a/src/OrchardCore.Modules/OrchardCore.Users/ViewModels/EditUserEmailViewModel.cs +++ b/src/OrchardCore.Modules/OrchardCore.Users/ViewModels/EditUserEmailViewModel.cs @@ -1,4 +1,4 @@ -using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations; using Microsoft.AspNetCore.Mvc.ModelBinding; namespace OrchardCore.Users.ViewModels; diff --git a/src/OrchardCore.Modules/OrchardCore.Users/ViewModels/RequestCodeSmsAuthenticatorViewModel.cs b/src/OrchardCore.Modules/OrchardCore.Users/ViewModels/RequestCodeSmsAuthenticatorViewModel.cs index dacd9f2ef84..5931f81695d 100644 --- a/src/OrchardCore.Modules/OrchardCore.Users/ViewModels/RequestCodeSmsAuthenticatorViewModel.cs +++ b/src/OrchardCore.Modules/OrchardCore.Users/ViewModels/RequestCodeSmsAuthenticatorViewModel.cs @@ -1,4 +1,4 @@ -using Microsoft.AspNetCore.Mvc.ModelBinding; +using Microsoft.AspNetCore.Mvc.ModelBinding; namespace OrchardCore.Users.ViewModels; diff --git a/src/OrchardCore.Modules/OrchardCore.Users/Workflows/Activities/RegisterUserTask.cs b/src/OrchardCore.Modules/OrchardCore.Users/Workflows/Activities/RegisterUserTask.cs index 5a552a18d71..a0baa162ad4 100644 --- a/src/OrchardCore.Modules/OrchardCore.Users/Workflows/Activities/RegisterUserTask.cs +++ b/src/OrchardCore.Modules/OrchardCore.Users/Workflows/Activities/RegisterUserTask.cs @@ -98,14 +98,14 @@ public override async Task ExecuteAsync(WorkflowExecuti { form = _httpContextAccessor.HttpContext.Request.Form; email = form["Email"]; - isValid = !String.IsNullOrWhiteSpace(email); + isValid = !string.IsNullOrWhiteSpace(email); } var outcome = isValid ? "Valid" : "Invalid"; if (isValid) { var userName = form["UserName"]; - if (String.IsNullOrWhiteSpace(userName)) + if (string.IsNullOrWhiteSpace(userName)) { userName = email.Replace('@', '+'); } diff --git a/src/OrchardCore.Modules/OrchardCore.Users/Workflows/Activities/UserDeletedEvent.cs b/src/OrchardCore.Modules/OrchardCore.Users/Workflows/Activities/UserDeletedEvent.cs index c313a00abc5..0e7e45ea691 100644 --- a/src/OrchardCore.Modules/OrchardCore.Users/Workflows/Activities/UserDeletedEvent.cs +++ b/src/OrchardCore.Modules/OrchardCore.Users/Workflows/Activities/UserDeletedEvent.cs @@ -1,4 +1,4 @@ -using Microsoft.Extensions.Localization; +using Microsoft.Extensions.Localization; using OrchardCore.Users.Services; using OrchardCore.Workflows.Services; diff --git a/src/OrchardCore.Modules/OrchardCore.Users/Workflows/Drivers/RegisterUserTaskDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.Users/Workflows/Drivers/RegisterUserTaskDisplayDriver.cs index 485f6746494..c8122f1d794 100644 --- a/src/OrchardCore.Modules/OrchardCore.Users/Workflows/Drivers/RegisterUserTaskDisplayDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Users/Workflows/Drivers/RegisterUserTaskDisplayDriver.cs @@ -1,4 +1,3 @@ -using System; using System.Threading.Tasks; using Microsoft.Extensions.Localization; using OrchardCore.DisplayManagement.ModelBinding; @@ -40,12 +39,12 @@ public async override Task UpdateAsync(RegisterUserTask model, I if (model.SendConfirmationEmail) { - if (String.IsNullOrWhiteSpace(viewModel.ConfirmationEmailSubject)) + if (string.IsNullOrWhiteSpace(viewModel.ConfirmationEmailSubject)) { updater.ModelState.AddModelError(Prefix, nameof(viewModel.ConfirmationEmailSubject), S["A value is required for {0}.", nameof(viewModel.ConfirmationEmailSubject)]); } - if (String.IsNullOrWhiteSpace(viewModel.ConfirmationEmailTemplate)) + if (string.IsNullOrWhiteSpace(viewModel.ConfirmationEmailTemplate)) { updater.ModelState.AddModelError(Prefix, nameof(viewModel.ConfirmationEmailTemplate), S["A value is required for {0}.", nameof(viewModel.ConfirmationEmailTemplate)]); } diff --git a/src/OrchardCore.Modules/OrchardCore.Users/Workflows/ViewModels/UserDeletedEventViewModel.cs b/src/OrchardCore.Modules/OrchardCore.Users/Workflows/ViewModels/UserDeletedEventViewModel.cs index e695b805a0f..423cba9a38b 100644 --- a/src/OrchardCore.Modules/OrchardCore.Users/Workflows/ViewModels/UserDeletedEventViewModel.cs +++ b/src/OrchardCore.Modules/OrchardCore.Users/Workflows/ViewModels/UserDeletedEventViewModel.cs @@ -1,4 +1,4 @@ -using OrchardCore.Users.Workflows.Activities; +using OrchardCore.Users.Workflows.Activities; namespace OrchardCore.Users.Workflows.ViewModels { diff --git a/src/OrchardCore.Modules/OrchardCore.Widgets/ContentCardShapes.cs b/src/OrchardCore.Modules/OrchardCore.Widgets/ContentCardShapes.cs index 23f61e3cf79..699fef9163b 100644 --- a/src/OrchardCore.Modules/OrchardCore.Widgets/ContentCardShapes.cs +++ b/src/OrchardCore.Modules/OrchardCore.Widgets/ContentCardShapes.cs @@ -100,7 +100,7 @@ public void Discover(ShapeTableBuilder builder) //e.g. ContentCard_Frame__FlowPart__Paragraph, ContentCard_Frame__BagPart__Form, ContentCard_Frame__FlowPart__Input contentCardFrame.Metadata.Alternates.Add($"{ContentCardFrame}__{collectionType}__{contentType}"); - if (!String.IsNullOrWhiteSpace(parentContentType)) + if (!string.IsNullOrWhiteSpace(parentContentType)) { //Define frame card shape for children per parent content type for given collection //ContentCard_Frame__[ParentContentType]__[CollectionType] @@ -117,7 +117,7 @@ public void Discover(ShapeTableBuilder builder) //e.g. ContentCard_Frame__Page__FlowPart__Container, ContentCard_Frame__LandingPage__BagPart__Service, ContentCard_Frame__Form__FlowPart__Label contentCardFrame.Metadata.Alternates.Add($"{ContentCardFrame}__{parentContentType}__{collectionType}__{contentType}"); - if (!String.IsNullOrWhiteSpace(namedPart) && !namedPart.Equals(collectionType)) + if (!string.IsNullOrWhiteSpace(namedPart) && !namedPart.Equals(collectionType)) { //Define frame card shape for child with specific partname and parent content type //ContentCard_Frame__[ParentContentType]__[PartName] diff --git a/src/OrchardCore.Modules/OrchardCore.Widgets/Controllers/AdminController.cs b/src/OrchardCore.Modules/OrchardCore.Widgets/Controllers/AdminController.cs index b6ba940bff6..ee4446fd372 100644 --- a/src/OrchardCore.Modules/OrchardCore.Widgets/Controllers/AdminController.cs +++ b/src/OrchardCore.Modules/OrchardCore.Widgets/Controllers/AdminController.cs @@ -31,7 +31,7 @@ public AdminController( public async Task BuildEditor(string id, string prefix, string prefixesName, string contentTypesName, string contentItemsName, string zonesName, string zone, string targetId, string parentContentType, string partName) { - if (String.IsNullOrWhiteSpace(id)) + if (string.IsNullOrWhiteSpace(id)) { return NotFound(); } diff --git a/src/OrchardCore.Modules/OrchardCore.Widgets/Drivers/WidgetsListPartDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.Widgets/Drivers/WidgetsListPartDisplayDriver.cs index 767d81df6cf..049bfb301d9 100644 --- a/src/OrchardCore.Modules/OrchardCore.Widgets/Drivers/WidgetsListPartDisplayDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Widgets/Drivers/WidgetsListPartDisplayDriver.cs @@ -104,7 +104,7 @@ public override async Task UpdateAsync(WidgetsListPart part, Upd var contentItem = await _contentManager.NewAsync(contentType); if (part.Widgets.TryGetValue(zone, out var widgets)) { - var existingContentItem = widgets.FirstOrDefault(x => String.Equals(x.ContentItemId, model.ContentItems[i], StringComparison.OrdinalIgnoreCase)); + var existingContentItem = widgets.FirstOrDefault(x => string.Equals(x.ContentItemId, model.ContentItems[i], StringComparison.OrdinalIgnoreCase)); // When the content item already exists merge its elements to preverse nested content item ids. // All of the data for these merged items is then replaced by the model values on update, while a nested content item id is maintained. diff --git a/src/OrchardCore.Modules/OrchardCore.Widgets/Models/WidgetMetadata.cs b/src/OrchardCore.Modules/OrchardCore.Widgets/Models/WidgetMetadata.cs index 8abc48a0a15..50c59c1ed1e 100644 --- a/src/OrchardCore.Modules/OrchardCore.Widgets/Models/WidgetMetadata.cs +++ b/src/OrchardCore.Modules/OrchardCore.Widgets/Models/WidgetMetadata.cs @@ -1,4 +1,4 @@ -using OrchardCore.ContentManagement; +using OrchardCore.ContentManagement; namespace OrchardCore.Widgets.Models { diff --git a/src/OrchardCore.Modules/OrchardCore.Widgets/Settings/WidgetsListPartSettings.cs b/src/OrchardCore.Modules/OrchardCore.Widgets/Settings/WidgetsListPartSettings.cs index a954bf9cde6..32b534405fe 100644 --- a/src/OrchardCore.Modules/OrchardCore.Widgets/Settings/WidgetsListPartSettings.cs +++ b/src/OrchardCore.Modules/OrchardCore.Widgets/Settings/WidgetsListPartSettings.cs @@ -1,4 +1,4 @@ -using System; +using System; namespace OrchardCore.Widgets.Settings { diff --git a/src/OrchardCore.Modules/OrchardCore.Widgets/Settings/WidgetsListPartSettingsDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.Widgets/Settings/WidgetsListPartSettingsDisplayDriver.cs index a2e59b7f9b7..837364120b5 100644 --- a/src/OrchardCore.Modules/OrchardCore.Widgets/Settings/WidgetsListPartSettingsDisplayDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Widgets/Settings/WidgetsListPartSettingsDisplayDriver.cs @@ -16,7 +16,7 @@ public override IDisplayResult Edit(ContentTypePartDefinition contentTypePartDef { var settings = contentTypePartDefinition.GetSettings(); - model.Zones = String.Join(", ", settings.Zones); + model.Zones = string.Join(", ", settings.Zones); model.WidgetsListPartSettings = settings; }).Location("Content"); } diff --git a/src/OrchardCore.Modules/OrchardCore.Widgets/Settings/WidgetsListPartSettingsViewModel.cs b/src/OrchardCore.Modules/OrchardCore.Widgets/Settings/WidgetsListPartSettingsViewModel.cs index 084f23a4186..3962d5203d1 100644 --- a/src/OrchardCore.Modules/OrchardCore.Widgets/Settings/WidgetsListPartSettingsViewModel.cs +++ b/src/OrchardCore.Modules/OrchardCore.Widgets/Settings/WidgetsListPartSettingsViewModel.cs @@ -1,4 +1,4 @@ -namespace OrchardCore.Widgets.Settings +namespace OrchardCore.Widgets.Settings { public class WidgetsListPartSettingsViewModel { diff --git a/src/OrchardCore.Modules/OrchardCore.Widgets/ViewModels/BuildEditorViewModel.cs b/src/OrchardCore.Modules/OrchardCore.Widgets/ViewModels/BuildEditorViewModel.cs index c397d22a544..991bd10f037 100644 --- a/src/OrchardCore.Modules/OrchardCore.Widgets/ViewModels/BuildEditorViewModel.cs +++ b/src/OrchardCore.Modules/OrchardCore.Widgets/ViewModels/BuildEditorViewModel.cs @@ -1,4 +1,4 @@ -namespace OrchardCore.Widgets.ViewModels +namespace OrchardCore.Widgets.ViewModels { public class BuildEditorViewModel { diff --git a/src/OrchardCore.Modules/OrchardCore.Workflows/Activities/ForLoopTask.cs b/src/OrchardCore.Modules/OrchardCore.Workflows/Activities/ForLoopTask.cs index 0185670e6d0..f5758313ee7 100644 --- a/src/OrchardCore.Modules/OrchardCore.Workflows/Activities/ForLoopTask.cs +++ b/src/OrchardCore.Modules/OrchardCore.Workflows/Activities/ForLoopTask.cs @@ -77,17 +77,17 @@ public override IEnumerable GetPossibleOutcomes(WorkflowExecutionContex public override async Task ExecuteAsync(WorkflowExecutionContext workflowContext, ActivityContext activityContext) { - if (!Double.TryParse(From.Expression, out var from)) + if (!double.TryParse(From.Expression, out var from)) { from = await _scriptEvaluator.EvaluateAsync(From, workflowContext); } - if (!Double.TryParse(To.Expression, out var to)) + if (!double.TryParse(To.Expression, out var to)) { to = await _scriptEvaluator.EvaluateAsync(To, workflowContext); } - if (!Double.TryParse(Step.Expression, out var step)) + if (!double.TryParse(Step.Expression, out var step)) { step = await _scriptEvaluator.EvaluateAsync(Step, workflowContext); } diff --git a/src/OrchardCore.Modules/OrchardCore.Workflows/AdminMenu.cs b/src/OrchardCore.Modules/OrchardCore.Workflows/AdminMenu.cs index 1355106e112..ee6da25ddc6 100644 --- a/src/OrchardCore.Modules/OrchardCore.Workflows/AdminMenu.cs +++ b/src/OrchardCore.Modules/OrchardCore.Workflows/AdminMenu.cs @@ -16,7 +16,7 @@ public AdminMenu(IStringLocalizer localizer) public Task BuildNavigationAsync(string name, NavigationBuilder builder) { - if (!String.Equals(name, "admin", StringComparison.OrdinalIgnoreCase)) + if (!string.Equals(name, "admin", StringComparison.OrdinalIgnoreCase)) { return Task.CompletedTask; } diff --git a/src/OrchardCore.Modules/OrchardCore.Workflows/Controllers/WorkflowTypeController.cs b/src/OrchardCore.Modules/OrchardCore.Workflows/Controllers/WorkflowTypeController.cs index ebc438675b5..42f011057c0 100644 --- a/src/OrchardCore.Modules/OrchardCore.Workflows/Controllers/WorkflowTypeController.cs +++ b/src/OrchardCore.Modules/OrchardCore.Workflows/Controllers/WorkflowTypeController.cs @@ -103,7 +103,7 @@ public async Task Index(WorkflowTypeIndexOptions options, PagerPa break; } - if (!String.IsNullOrWhiteSpace(options.Search)) + if (!string.IsNullOrWhiteSpace(options.Search)) { query = query.Where(x => x.Name.Contains(options.Search)); } @@ -367,7 +367,7 @@ public async Task Edit(long id, string localId) return Forbid(); } - var newLocalId = String.IsNullOrWhiteSpace(localId) ? Guid.NewGuid().ToString() : localId; + var newLocalId = string.IsNullOrWhiteSpace(localId) ? Guid.NewGuid().ToString() : localId; var availableActivities = _activityLibrary.ListActivities(); var workflowType = await _session.GetAsync(id); @@ -433,7 +433,7 @@ public async Task Edit(long id, string localId) ActivityDesignShapes = activityDesignShapes, ActivityCategories = _activityLibrary.ListCategories().ToList(), LocalId = newLocalId, - LoadLocalState = !String.IsNullOrWhiteSpace(localId), + LoadLocalState = !string.IsNullOrWhiteSpace(localId), WorkflowCount = workflowCount, }; diff --git a/src/OrchardCore.Modules/OrchardCore.Workflows/Expressions/LiquidWorkflowExpressionEvaluator.cs b/src/OrchardCore.Modules/OrchardCore.Workflows/Expressions/LiquidWorkflowExpressionEvaluator.cs index 2856577e2b2..6835ff60502 100644 --- a/src/OrchardCore.Modules/OrchardCore.Workflows/Expressions/LiquidWorkflowExpressionEvaluator.cs +++ b/src/OrchardCore.Modules/OrchardCore.Workflows/Expressions/LiquidWorkflowExpressionEvaluator.cs @@ -47,7 +47,7 @@ public async Task EvaluateAsync(WorkflowExpression expression, Workflow new Dictionary() { ["Workflow"] = new ObjectValue(workflowContext) } ); - return String.IsNullOrWhiteSpace(result) ? default : (T)Convert.ChangeType(result, typeof(T)); + return string.IsNullOrWhiteSpace(result) ? default : (T)Convert.ChangeType(result, typeof(T)); } public static Task ToFluidValue(IDictionary dictionary, string key, TemplateContext context) diff --git a/src/OrchardCore.Modules/OrchardCore.Workflows/Http/Activities/HttpRequestEvent.cs b/src/OrchardCore.Modules/OrchardCore.Workflows/Http/Activities/HttpRequestEvent.cs index a842413be28..b4cb7166328 100644 --- a/src/OrchardCore.Modules/OrchardCore.Workflows/Http/Activities/HttpRequestEvent.cs +++ b/src/OrchardCore.Modules/OrchardCore.Workflows/Http/Activities/HttpRequestEvent.cs @@ -56,7 +56,7 @@ public override bool CanExecute(WorkflowExecutionContext workflowContext, Activi { var httpContext = _httpContextAccessor.HttpContext; var httpRequest = httpContext.Request; - var isMatch = String.Equals(HttpMethod, httpRequest.Method, StringComparison.OrdinalIgnoreCase); + var isMatch = string.Equals(HttpMethod, httpRequest.Method, StringComparison.OrdinalIgnoreCase); return isMatch; } diff --git a/src/OrchardCore.Modules/OrchardCore.Workflows/Http/Activities/HttpRequestFilterEvent.cs b/src/OrchardCore.Modules/OrchardCore.Workflows/Http/Activities/HttpRequestFilterEvent.cs index 4cc52616fa4..ad94c60a612 100644 --- a/src/OrchardCore.Modules/OrchardCore.Workflows/Http/Activities/HttpRequestFilterEvent.cs +++ b/src/OrchardCore.Modules/OrchardCore.Workflows/Http/Activities/HttpRequestFilterEvent.cs @@ -62,7 +62,7 @@ public override bool CanExecute(WorkflowExecutionContext workflowContext, Activi { var httpContext = _httpContextAccessor.HttpContext; var httpRequest = httpContext.Request; - var isHttpMethodMatch = String.Equals(HttpMethod, httpRequest.Method, StringComparison.OrdinalIgnoreCase); + var isHttpMethodMatch = string.Equals(HttpMethod, httpRequest.Method, StringComparison.OrdinalIgnoreCase); if (!isHttpMethodMatch) { @@ -103,7 +103,7 @@ private static bool RouteMatches(RouteValueDictionary a, RouteValueDictionary b) return a.All(x => { var valueA = x.Value?.ToString(); - return b.ContainsKey(x.Key) && String.Equals(valueA, b[x.Key]?.ToString(), StringComparison.OrdinalIgnoreCase); + return b.ContainsKey(x.Key) && string.Equals(valueA, b[x.Key]?.ToString(), StringComparison.OrdinalIgnoreCase); }); } } diff --git a/src/OrchardCore.Modules/OrchardCore.Workflows/Http/Activities/HttpRequestTask.cs b/src/OrchardCore.Modules/OrchardCore.Workflows/Http/Activities/HttpRequestTask.cs index 92cf2d46042..7d32c58c09f 100644 --- a/src/OrchardCore.Modules/OrchardCore.Workflows/Http/Activities/HttpRequestTask.cs +++ b/src/OrchardCore.Modules/OrchardCore.Workflows/Http/Activities/HttpRequestTask.cs @@ -143,10 +143,10 @@ public string HttpResponseCodes public override IEnumerable GetPossibleOutcomes(WorkflowExecutionContext workflowContext, ActivityContext activityContext) { - var outcomes = !String.IsNullOrWhiteSpace(HttpResponseCodes) + var outcomes = !string.IsNullOrWhiteSpace(HttpResponseCodes) ? HttpResponseCodes.Split(',', StringSplitOptions.RemoveEmptyEntries).Select(x => { - var status = Int32.Parse(x.Trim()); + var status = int.Parse(x.Trim()); var description = _httpStatusCodeDictionary.TryGetValue(status, out var text) ? $"{status} {text}" @@ -199,7 +199,7 @@ public override async Task ExecuteAsync(WorkflowExecuti private static IEnumerable> ParseHeaders(string text) { - if (String.IsNullOrWhiteSpace(text)) + if (string.IsNullOrWhiteSpace(text)) return Enumerable.Empty>(); return @@ -213,7 +213,7 @@ private static IEnumerable ParseResponseCodes(string text) { return from code in text.Split(',', StringSplitOptions.RemoveEmptyEntries) - select Int32.Parse(code); + select int.Parse(code); } } } diff --git a/src/OrchardCore.Modules/OrchardCore.Workflows/Http/Activities/HttpResponseTask.cs b/src/OrchardCore.Modules/OrchardCore.Workflows/Http/Activities/HttpResponseTask.cs index 34ed0256239..f824d29fc83 100644 --- a/src/OrchardCore.Modules/OrchardCore.Workflows/Http/Activities/HttpResponseTask.cs +++ b/src/OrchardCore.Modules/OrchardCore.Workflows/Http/Activities/HttpResponseTask.cs @@ -83,12 +83,12 @@ public override async Task ExecuteAsync(WorkflowExecuti response.Headers.Append(header.Key, header.Value); } - if (!String.IsNullOrWhiteSpace(contentType)) + if (!string.IsNullOrWhiteSpace(contentType)) { response.ContentType = contentType; } - if (!String.IsNullOrWhiteSpace(content)) + if (!string.IsNullOrWhiteSpace(content)) { await response.WriteAsync(content); } @@ -99,7 +99,7 @@ public override async Task ExecuteAsync(WorkflowExecuti private static IEnumerable> ParseHeaders(string text) { - if (String.IsNullOrWhiteSpace(text)) + if (string.IsNullOrWhiteSpace(text)) return Enumerable.Empty>(); return diff --git a/src/OrchardCore.Modules/OrchardCore.Workflows/Http/Activities/SignalEvent.cs b/src/OrchardCore.Modules/OrchardCore.Workflows/Http/Activities/SignalEvent.cs index 167cdff8cca..deab1f2696b 100644 --- a/src/OrchardCore.Modules/OrchardCore.Workflows/Http/Activities/SignalEvent.cs +++ b/src/OrchardCore.Modules/OrchardCore.Workflows/Http/Activities/SignalEvent.cs @@ -35,7 +35,7 @@ public WorkflowExpression SignalName public override async Task CanExecuteAsync(WorkflowExecutionContext workflowContext, ActivityContext activityContext) { var signalName = await _expressionEvaluator.EvaluateAsync(SignalName, workflowContext, null); - return String.Equals(workflowContext.Input.GetValue("Signal"), signalName, StringComparison.OrdinalIgnoreCase); + return string.Equals(workflowContext.Input.GetValue("Signal"), signalName, StringComparison.OrdinalIgnoreCase); } public override IEnumerable GetPossibleOutcomes(WorkflowExecutionContext workflowContext, ActivityContext activityContext) diff --git a/src/OrchardCore.Modules/OrchardCore.Workflows/Http/Controllers/HttpWorkflowController.cs b/src/OrchardCore.Modules/OrchardCore.Workflows/Http/Controllers/HttpWorkflowController.cs index f167b5248da..d6075c0dde8 100644 --- a/src/OrchardCore.Modules/OrchardCore.Workflows/Http/Controllers/HttpWorkflowController.cs +++ b/src/OrchardCore.Modules/OrchardCore.Workflows/Http/Controllers/HttpWorkflowController.cs @@ -227,7 +227,7 @@ public async Task Trigger(string token) var input = new Dictionary { { "Signal", payload.SignalName } }; // If a specific workflow was provided, then resume that workflow. - if (!String.IsNullOrWhiteSpace(payload.WorkflowId)) + if (!string.IsNullOrWhiteSpace(payload.WorkflowId)) { var workflow = await _workflowStore.GetAsync(payload.WorkflowId); var signalActivities = workflow?.BlockingActivities.Where(x => x.Name == SignalEvent.EventName).ToList(); diff --git a/src/OrchardCore.Modules/OrchardCore.Workflows/Http/Drivers/HttpRequestFilterEventDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.Workflows/Http/Drivers/HttpRequestFilterEventDisplayDriver.cs index c372b56cff6..9cbc60b43cc 100644 --- a/src/OrchardCore.Modules/OrchardCore.Workflows/Http/Drivers/HttpRequestFilterEventDisplayDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Workflows/Http/Drivers/HttpRequestFilterEventDisplayDriver.cs @@ -25,7 +25,7 @@ protected override void UpdateActivity(HttpRequestFilterEventViewModel model, Ht private static string NullIfEmpty(string s) { - return String.IsNullOrWhiteSpace(s) ? null : s.Trim(); + return string.IsNullOrWhiteSpace(s) ? null : s.Trim(); } } } diff --git a/src/OrchardCore.Modules/OrchardCore.Workflows/Http/Filters/WorkflowActionFilter.cs b/src/OrchardCore.Modules/OrchardCore.Workflows/Http/Filters/WorkflowActionFilter.cs index 76e8e2660bc..9da4c5d610d 100644 --- a/src/OrchardCore.Modules/OrchardCore.Workflows/Http/Filters/WorkflowActionFilter.cs +++ b/src/OrchardCore.Modules/OrchardCore.Workflows/Http/Filters/WorkflowActionFilter.cs @@ -86,7 +86,7 @@ public async Task OnActionExecutionAsync(ActionExecutingContext context, ActionE foreach (var entry in workflowEntries) { if (workflows.TryGetValue(entry.WorkflowId, out var workflow) && - (String.IsNullOrWhiteSpace(correlationId) || + (string.IsNullOrWhiteSpace(correlationId) || workflow.CorrelationId == correlationId)) { // If atomic, try to acquire a lock per workflow instance. @@ -100,7 +100,7 @@ public async Task OnActionExecutionAsync(ActionExecutingContext context, ActionE // If atomic, check if the workflow still exists and is still correlated. var haltedWorkflow = workflow.IsAtomic ? await _workflowStore.GetAsync(workflow.Id) : workflow; - if (haltedWorkflow == null || (!String.IsNullOrWhiteSpace(correlationId) && haltedWorkflow.CorrelationId != correlationId)) + if (haltedWorkflow == null || (!string.IsNullOrWhiteSpace(correlationId) && haltedWorkflow.CorrelationId != correlationId)) { continue; } diff --git a/src/OrchardCore.Modules/OrchardCore.Workflows/Http/Liquid/SignalUrlFilter.cs b/src/OrchardCore.Modules/OrchardCore.Workflows/Http/Liquid/SignalUrlFilter.cs index d3d67c55030..9d44159b13f 100644 --- a/src/OrchardCore.Modules/OrchardCore.Workflows/Http/Liquid/SignalUrlFilter.cs +++ b/src/OrchardCore.Modules/OrchardCore.Workflows/Http/Liquid/SignalUrlFilter.cs @@ -35,7 +35,7 @@ public ValueTask ProcessAsync(FluidValue input, FilterArguments argu var workflowContext = (WorkflowExecutionContext)workflowContextValue.ToObjectValue(); var signalName = input.ToStringValue(); - var payload = String.IsNullOrWhiteSpace(workflowContext.CorrelationId) + var payload = string.IsNullOrWhiteSpace(workflowContext.CorrelationId) ? SignalPayload.ForWorkflow(signalName, workflowContext.WorkflowId) : SignalPayload.ForCorrelation(signalName, workflowContext.CorrelationId); diff --git a/src/OrchardCore.Modules/OrchardCore.Workflows/Http/Scripting/SignalMethodProvider.cs b/src/OrchardCore.Modules/OrchardCore.Workflows/Http/Scripting/SignalMethodProvider.cs index f047b75821a..4c4312c5046 100644 --- a/src/OrchardCore.Modules/OrchardCore.Workflows/Http/Scripting/SignalMethodProvider.cs +++ b/src/OrchardCore.Modules/OrchardCore.Workflows/Http/Scripting/SignalMethodProvider.cs @@ -22,7 +22,7 @@ public SignalMethodProvider(WorkflowExecutionContext workflowContext, ISecurityT Name = "signalUrl", Method = serviceProvider => (Func)((signal) => { - var payload = !String.IsNullOrWhiteSpace(workflowContext.CorrelationId) ? SignalPayload.ForCorrelation(signal, workflowContext.CorrelationId) : SignalPayload.ForWorkflow(signal, workflowContext.WorkflowId); + var payload = !string.IsNullOrWhiteSpace(workflowContext.CorrelationId) ? SignalPayload.ForCorrelation(signal, workflowContext.CorrelationId) : SignalPayload.ForWorkflow(signal, workflowContext.WorkflowId); var token = securityTokenService.CreateToken(payload, TimeSpan.FromDays(7)); var httpContextAccessor = serviceProvider.GetRequiredService(); var linkGenerator = serviceProvider.GetRequiredService(); diff --git a/src/OrchardCore.Modules/OrchardCore.Workflows/Http/Services/WorkflowRouteEntriesOfT.cs b/src/OrchardCore.Modules/OrchardCore.Workflows/Http/Services/WorkflowRouteEntriesOfT.cs index 1c759ddafa1..212a970ca3f 100644 --- a/src/OrchardCore.Modules/OrchardCore.Workflows/Http/Services/WorkflowRouteEntriesOfT.cs +++ b/src/OrchardCore.Modules/OrchardCore.Workflows/Http/Services/WorkflowRouteEntriesOfT.cs @@ -50,9 +50,9 @@ protected virtual IEnumerable GetWorkflowRoutesEntries(Work return document.Entries.Values.SelectMany(x => x).Where(x => x.HttpMethod == httpMethod && - (x.ControllerName == controllerName || String.IsNullOrWhiteSpace(x.ControllerName)) && - (x.ActionName == actionName || String.IsNullOrWhiteSpace(x.ActionName)) && - (x.AreaName == areaName || String.IsNullOrWhiteSpace(x.AreaName))) + (x.ControllerName == controllerName || string.IsNullOrWhiteSpace(x.ControllerName)) && + (x.ActionName == actionName || string.IsNullOrWhiteSpace(x.ActionName)) && + (x.AreaName == areaName || string.IsNullOrWhiteSpace(x.AreaName))) .ToArray(); } diff --git a/src/OrchardCore.Modules/OrchardCore.Workflows/Recipes/WorkflowTypeStep.cs b/src/OrchardCore.Modules/OrchardCore.Workflows/Recipes/WorkflowTypeStep.cs index 435cf8d1bcb..1ceb3241044 100644 --- a/src/OrchardCore.Modules/OrchardCore.Workflows/Recipes/WorkflowTypeStep.cs +++ b/src/OrchardCore.Modules/OrchardCore.Workflows/Recipes/WorkflowTypeStep.cs @@ -20,7 +20,7 @@ public WorkflowTypeStep(IWorkflowTypeStore workflowTypeStore) public async Task ExecuteAsync(RecipeExecutionContext context) { - if (!String.Equals(context.Name, "WorkflowType", StringComparison.OrdinalIgnoreCase)) + if (!string.Equals(context.Name, "WorkflowType", StringComparison.OrdinalIgnoreCase)) { return; } diff --git a/src/OrchardCore.Modules/OrchardCore.Workflows/Scripting/JavaScriptWorkflowScriptEvaluator.cs b/src/OrchardCore.Modules/OrchardCore.Workflows/Scripting/JavaScriptWorkflowScriptEvaluator.cs index 0c264bb9b75..34006b58e5f 100644 --- a/src/OrchardCore.Modules/OrchardCore.Workflows/Scripting/JavaScriptWorkflowScriptEvaluator.cs +++ b/src/OrchardCore.Modules/OrchardCore.Workflows/Scripting/JavaScriptWorkflowScriptEvaluator.cs @@ -29,7 +29,7 @@ ILogger logger public async Task EvaluateAsync(WorkflowExpression expression, WorkflowExecutionContext workflowContext, params IGlobalMethodProvider[] scopedMethodProviders) { - if (String.IsNullOrWhiteSpace(expression.Expression)) + if (string.IsNullOrWhiteSpace(expression.Expression)) { return default; } diff --git a/src/OrchardCore.Modules/OrchardCore.XmlRpc/MethodCallModelBinder.cs b/src/OrchardCore.Modules/OrchardCore.XmlRpc/MethodCallModelBinder.cs index 437dbbb8e0a..142f7cc2f09 100644 --- a/src/OrchardCore.Modules/OrchardCore.XmlRpc/MethodCallModelBinder.cs +++ b/src/OrchardCore.Modules/OrchardCore.XmlRpc/MethodCallModelBinder.cs @@ -22,7 +22,7 @@ public async Task BindModelAsync(ModelBindingContext bindingContext) if (bindingContext.ModelType == typeof(XRpcMethodCall)) { var mapper = bindingContext.HttpContext.RequestServices.GetRequiredService(); - var bodyTextContent = String.Empty; + 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)) diff --git a/src/OrchardCore.Modules/OrchardCore.XmlRpc/Services/XmlRpcReader.cs b/src/OrchardCore.Modules/OrchardCore.XmlRpc/Services/XmlRpcReader.cs index 37ed8fbac86..56a8001ecf7 100644 --- a/src/OrchardCore.Modules/OrchardCore.XmlRpc/Services/XmlRpcReader.cs +++ b/src/OrchardCore.Modules/OrchardCore.XmlRpc/Services/XmlRpcReader.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Globalization; using System.Linq; diff --git a/src/OrchardCore.Themes/TheTheme/PlaceHolder.cs b/src/OrchardCore.Themes/TheTheme/PlaceHolder.cs index 8e9b74fd1a0..836af387897 100644 --- a/src/OrchardCore.Themes/TheTheme/PlaceHolder.cs +++ b/src/OrchardCore.Themes/TheTheme/PlaceHolder.cs @@ -1,7 +1,7 @@ -namespace TheTheme +namespace TheTheme { // Just a class so that an assembly gets created public class Placeholder { } -} \ No newline at end of file +} diff --git a/src/OrchardCore/OrchardCore.Abstractions/BackgroundTasks/BackgroundTaskAttribute.cs b/src/OrchardCore/OrchardCore.Abstractions/BackgroundTasks/BackgroundTaskAttribute.cs index 2351f75d692..2d5ad62b5ec 100644 --- a/src/OrchardCore/OrchardCore.Abstractions/BackgroundTasks/BackgroundTaskAttribute.cs +++ b/src/OrchardCore/OrchardCore.Abstractions/BackgroundTasks/BackgroundTaskAttribute.cs @@ -23,7 +23,7 @@ public class BackgroundTaskAttribute : Attribute /// /// The description of this background task. /// - public string Description { get; set; } = String.Empty; + public string Description { get; set; } = string.Empty; /// /// The timeout in milliseconds to acquire a lock before executing the task atomically. diff --git a/src/OrchardCore/OrchardCore.Abstractions/BackgroundTasks/BackgroundTaskExtensions.cs b/src/OrchardCore/OrchardCore.Abstractions/BackgroundTasks/BackgroundTaskExtensions.cs index ff140f891f8..76a08babbdf 100644 --- a/src/OrchardCore/OrchardCore.Abstractions/BackgroundTasks/BackgroundTaskExtensions.cs +++ b/src/OrchardCore/OrchardCore.Abstractions/BackgroundTasks/BackgroundTaskExtensions.cs @@ -17,7 +17,7 @@ public static BackgroundTaskSettings GetDefaultSettings(this IBackgroundTask tas return new BackgroundTaskSettings { Name = technicalName, - Title = !String.IsNullOrWhiteSpace(attribute.Title) ? attribute.Title : technicalName, + Title = !string.IsNullOrWhiteSpace(attribute.Title) ? attribute.Title : technicalName, Enable = attribute.Enable, Schedule = attribute.Schedule, Description = attribute.Description, diff --git a/src/OrchardCore/OrchardCore.Abstractions/BackgroundTasks/BackgroundTaskSettings.cs b/src/OrchardCore/OrchardCore.Abstractions/BackgroundTasks/BackgroundTaskSettings.cs index 021ed032665..68fd7ba4946 100644 --- a/src/OrchardCore/OrchardCore.Abstractions/BackgroundTasks/BackgroundTaskSettings.cs +++ b/src/OrchardCore/OrchardCore.Abstractions/BackgroundTasks/BackgroundTaskSettings.cs @@ -7,7 +7,7 @@ public class BackgroundTaskSettings /// /// The name of this background task. /// - public string Name { get; set; } = String.Empty; + public string Name { get; set; } = string.Empty; /// /// The display name of this background task. @@ -27,7 +27,7 @@ public class BackgroundTaskSettings /// /// The description of this background task. /// - public string Description { get; set; } = String.Empty; + public string Description { get; set; } = string.Empty; /// /// The timeout in milliseconds to acquire a lock before executing the task atomically. diff --git a/src/OrchardCore/OrchardCore.Abstractions/BackgroundTasks/HttpContextExtensions.cs b/src/OrchardCore/OrchardCore.Abstractions/BackgroundTasks/HttpContextExtensions.cs index 34529f79e95..b43d30f3421 100644 --- a/src/OrchardCore/OrchardCore.Abstractions/BackgroundTasks/HttpContextExtensions.cs +++ b/src/OrchardCore/OrchardCore.Abstractions/BackgroundTasks/HttpContextExtensions.cs @@ -13,7 +13,7 @@ public static void SetBaseUrl(this HttpContext context, string baseUrl) context.Request.Host = new HostString(uri.Host, uri.Port); context.Request.PathBase = uri.AbsolutePath; - if (!String.IsNullOrWhiteSpace(uri.Query)) + if (!string.IsNullOrWhiteSpace(uri.Query)) { context.Request.QueryString = new QueryString(uri.Query); } diff --git a/src/OrchardCore/OrchardCore.Abstractions/BackgroundTasks/ShellContextExtensions.cs b/src/OrchardCore/OrchardCore.Abstractions/BackgroundTasks/ShellContextExtensions.cs index 32188a5fc36..d3334b552b5 100644 --- a/src/OrchardCore/OrchardCore.Abstractions/BackgroundTasks/ShellContextExtensions.cs +++ b/src/OrchardCore/OrchardCore.Abstractions/BackgroundTasks/ShellContextExtensions.cs @@ -33,7 +33,7 @@ private static HttpContext CreateHttpContext(ShellSettings settings) context.Request.Host = new HostString(urlHost ?? Localhost); context.Request.PathBase = PathString.Empty; - if (!String.IsNullOrWhiteSpace(settings.RequestUrlPrefix)) + if (!string.IsNullOrWhiteSpace(settings.RequestUrlPrefix)) { context.Request.PathBase = $"/{settings.RequestUrlPrefix}"; } diff --git a/src/OrchardCore/OrchardCore.Abstractions/Extensions/IExtensionDependencyStrategy.cs b/src/OrchardCore/OrchardCore.Abstractions/Extensions/IExtensionDependencyStrategy.cs index 8adefa3c0ae..3d45f427f00 100644 --- a/src/OrchardCore/OrchardCore.Abstractions/Extensions/IExtensionDependencyStrategy.cs +++ b/src/OrchardCore/OrchardCore.Abstractions/Extensions/IExtensionDependencyStrategy.cs @@ -1,4 +1,4 @@ -using OrchardCore.Environment.Extensions.Features; +using OrchardCore.Environment.Extensions.Features; namespace OrchardCore.Environment.Extensions { diff --git a/src/OrchardCore/OrchardCore.Abstractions/Extensions/IExtensionPriorityStrategy.cs b/src/OrchardCore/OrchardCore.Abstractions/Extensions/IExtensionPriorityStrategy.cs index a4aaedb8a29..43b534b19c9 100644 --- a/src/OrchardCore/OrchardCore.Abstractions/Extensions/IExtensionPriorityStrategy.cs +++ b/src/OrchardCore/OrchardCore.Abstractions/Extensions/IExtensionPriorityStrategy.cs @@ -1,4 +1,4 @@ -using OrchardCore.Environment.Extensions.Features; +using OrchardCore.Environment.Extensions.Features; namespace OrchardCore.Environment.Extensions { diff --git a/src/OrchardCore/OrchardCore.Abstractions/IdGenerator.cs b/src/OrchardCore/OrchardCore.Abstractions/IdGenerator.cs index 885b47e37cb..0c15928ad66 100644 --- a/src/OrchardCore/OrchardCore.Abstractions/IdGenerator.cs +++ b/src/OrchardCore/OrchardCore.Abstractions/IdGenerator.cs @@ -11,7 +11,7 @@ public static string GenerateId() { var guid = Guid.NewGuid().ToByteArray(); - return String.Create(26, guid, (buffer, guid) => + return string.Create(26, guid, (buffer, guid) => { var hs = BitConverter.ToInt64(guid, 0); var ls = BitConverter.ToInt64(guid, 8); diff --git a/src/OrchardCore/OrchardCore.Abstractions/Modules/Application.cs b/src/OrchardCore/OrchardCore.Abstractions/Modules/Application.cs index 88417c5d85c..51980541fcb 100644 --- a/src/OrchardCore/OrchardCore.Abstractions/Modules/Application.cs +++ b/src/OrchardCore/OrchardCore.Abstractions/Modules/Application.cs @@ -16,7 +16,7 @@ public class Application public const string ModuleName = "Application Main Feature"; public const string ModuleDescription = "Provides components defined at the application level."; - public static readonly string ModulePriority = Int32.MinValue.ToString(); + public static readonly string ModulePriority = int.MinValue.ToString(); public const string ModuleCategory = "Application"; public const string DefaultFeatureId = "Application.Default"; @@ -49,7 +49,7 @@ public Module GetModule(string name) { if (!_modulesByName.TryGetValue(name, out var module)) { - return new Module(String.Empty); + return new Module(string.Empty); } return module; diff --git a/src/OrchardCore/OrchardCore.Abstractions/Modules/Asset.cs b/src/OrchardCore/OrchardCore.Abstractions/Modules/Asset.cs index a04e59c43bc..1f7dfc67539 100644 --- a/src/OrchardCore/OrchardCore.Abstractions/Modules/Asset.cs +++ b/src/OrchardCore/OrchardCore.Abstractions/Modules/Asset.cs @@ -11,8 +11,8 @@ public Asset(string asset) if (index == -1) { - ModuleAssetPath = String.Empty; - ProjectAssetPath = String.Empty; + ModuleAssetPath = string.Empty; + ProjectAssetPath = string.Empty; } else { diff --git a/src/OrchardCore/OrchardCore.Abstractions/Modules/Manifest/FeatureAttribute.cs b/src/OrchardCore/OrchardCore.Abstractions/Modules/Manifest/FeatureAttribute.cs index 5a28895a222..4433ef2ede6 100644 --- a/src/OrchardCore/OrchardCore.Abstractions/Modules/Manifest/FeatureAttribute.cs +++ b/src/OrchardCore/OrchardCore.Abstractions/Modules/Manifest/FeatureAttribute.cs @@ -67,7 +67,7 @@ public FeatureAttribute() /// Whether considered default tenant only. /// Whether feature is always enabled. /// Whether feature is enabled by dependency only. - /// Supported types are and only. + /// Supported types are and only. public FeatureAttribute( string id, string description, @@ -99,11 +99,11 @@ object enabledByDependencyOnly /// Zero or more delimited feature dependencies, /// corresponding to each of the feature properties. /// Whether considered default tenant only. - /// Supported types are and only. + /// Supported types are and only. /// Whether feature is always enabled. - /// Supported types are and only. + /// Supported types are and only. /// Whether feature is enabled by dependency only. - /// Supported types are and only. + /// Supported types are and only. public FeatureAttribute( string id, string name, @@ -138,11 +138,11 @@ object enabledByDependencyOnly /// Zero or more delimited feature dependencies, /// corresponding to each of the feature properties. /// Whether considered default tenant only. - /// Supported types are and only. + /// Supported types are and only. /// Whether feature is always enabled. - /// Supported types are and only. + /// Supported types are and only. /// Whether feature is enabled by dependency only. - /// Supported types are and only. + /// Supported types are and only. public FeatureAttribute( string id, string name, @@ -158,7 +158,7 @@ object enabledByDependencyOnly Id = id; Name = name; Category = category ?? DefaultCategory; - Priority = priority ?? String.Empty; + Priority = priority ?? string.Empty; Description = description ?? DefaultDescription; DelimitedDependencies = featureDependencies ?? DefaultFeatureDependencies; @@ -173,7 +173,7 @@ object enabledByDependencyOnly /// /// Whether the feature exists based on the . /// - public virtual bool Exists => !String.IsNullOrEmpty(Id); + public virtual bool Exists => !string.IsNullOrEmpty(Id); private string _id; @@ -186,7 +186,7 @@ public virtual string Id set { // Guards setting Id with strictly invalid values. - if (String.IsNullOrEmpty(value)) + if (string.IsNullOrEmpty(value)) { throw new InvalidOperationException($"When '{nameof(Id)}' has been provided it should not be null or empty.") { @@ -201,13 +201,13 @@ public virtual string Id private string _name; /// - /// Returns the as is, or null when that - /// or . + /// Returns the as is, or null when that + /// or . /// /// The string value to consider. /// The value as is, or Null when either that or Empty. - /// - internal static string StringOrNull(string s) => String.IsNullOrEmpty(s) ? null : s; + /// + internal static string StringOrNull(string s) => string.IsNullOrEmpty(s) ? null : s; /// /// Gets or sets the human readable or canonical feature name. will be @@ -246,7 +246,7 @@ protected static IEnumerable GetValues(params T[] values) /// The first or default Description with optional back stop features. internal virtual string Describe(params FeatureAttribute[] additionalFeatures) { - static bool IsNotNullOrEmpty(string s) => !String.IsNullOrEmpty(s); + static bool IsNotNullOrEmpty(string s) => !string.IsNullOrEmpty(s); var firstOrDefaultResult = GetValues(this).Concat(additionalFeatures) .Select(feature => feature.Description) .FirstOrDefault(IsNotNullOrEmpty); @@ -265,7 +265,7 @@ internal virtual string Describe(params FeatureAttribute[] additionalFeatures) /// perspective. Also common are comma (',') and space (' ') /// delimiters. /// - /// + /// internal protected static char[] ListDelims { get; } = GetValues(';', ',', ' ').ToArray(); /// @@ -304,9 +304,9 @@ public virtual string[] Dependencies /// /// Gets the , parsed and ready to go for Internal use. May yield - /// null when failing to . + /// null when failing to . /// - internal virtual int? InternalPriority => Int32.TryParse(Priority, out var result) ? result : null; + internal virtual int? InternalPriority => int.TryParse(Priority, out var result) ? result : null; /// /// Prioritizes the Features starting with This one, concatenating @@ -344,7 +344,7 @@ public virtual string Category /// The Category normalized across This instance and optional Module. internal virtual string Categorize(params FeatureAttribute[] additionalFeatures) { - static bool IsNotNullOrEmpty(string s) => !String.IsNullOrEmpty(s); + static bool IsNotNullOrEmpty(string s) => !string.IsNullOrEmpty(s); var categories = GetValues(this).Concat(additionalFeatures).Select(feature => feature.Category); var category = categories.FirstOrDefault(IsNotNullOrEmpty); // TODO: MWP: 'Uncategorized'? or is empty acceptable here? diff --git a/src/OrchardCore/OrchardCore.Abstractions/Modules/Manifest/ModuleAssetAttribute.cs b/src/OrchardCore/OrchardCore.Abstractions/Modules/Manifest/ModuleAssetAttribute.cs index ac17a20a5f3..e22cfebb600 100644 --- a/src/OrchardCore/OrchardCore.Abstractions/Modules/Manifest/ModuleAssetAttribute.cs +++ b/src/OrchardCore/OrchardCore.Abstractions/Modules/Manifest/ModuleAssetAttribute.cs @@ -10,7 +10,7 @@ public class ModuleAssetAttribute : Attribute { public ModuleAssetAttribute(string asset) { - Asset = asset ?? String.Empty; + Asset = asset ?? string.Empty; } /// diff --git a/src/OrchardCore/OrchardCore.Abstractions/Modules/Manifest/ModuleAttribute.cs b/src/OrchardCore/OrchardCore.Abstractions/Modules/Manifest/ModuleAttribute.cs index e2419ee6c36..451f68f65ce 100644 --- a/src/OrchardCore/OrchardCore.Abstractions/Modules/Manifest/ModuleAttribute.cs +++ b/src/OrchardCore/OrchardCore.Abstractions/Modules/Manifest/ModuleAttribute.cs @@ -52,14 +52,14 @@ public ModuleAttribute() : base() /// properties. /// Tags associated with the Module. /// Whether considered default tenant only. - /// Supported types are and only. + /// Supported types are and only. /// Whether feature is always enabled. - /// Supported types are and only. + /// Supported types are and only. /// Semantic Versioning /// At least expected herein to differentiate with /// parameterless ctor. /// Whether feature is enabled by dependency only. - /// Supported types are and only. + /// Supported types are and only. public ModuleAttribute( string id, string description, @@ -105,14 +105,14 @@ object enabledByDependencyOnly /// properties. /// Tags associated with the Module. /// Whether considered default tenant only. - /// Supported types are and only. + /// Supported types are and only. /// Whether feature is always enabled. - /// Supported types are and only. + /// Supported types are and only. /// Semantic Versioning /// At least expected herein to differentiate with /// parameterless ctor. /// Whether feature is enabled by dependency only. - /// Supported types are and only. + /// Supported types are and only. public ModuleAttribute( string id, string name, @@ -161,14 +161,14 @@ object enabledByDependencyOnly /// The module website URL. /// Tags associated with the Module. /// Whether considered default tenant only. - /// Supported types are and only. + /// Supported types are and only. /// Whether feature is always enabled. - /// Supported types are and only. + /// Supported types are and only. /// Semantic Versioning /// At least expected herein to differentiate with /// parameterless ctor. /// Whether feature is enabled by dependency only. - /// Supported types are and only. + /// Supported types are and only. public ModuleAttribute( string id, string name, @@ -220,14 +220,14 @@ object enabledByDependencyOnly /// The module website URL. /// Tags associated with the Module. /// Whether considered default tenant only. - /// Supported types are and only. + /// Supported types are and only. /// Whether feature is always enabled. - /// Supported types are and only. + /// Supported types are and only. /// Semantic Versioning /// At least expected herein to differentiate with /// parameterless ctor. /// Whether feature is enabled by dependency only. - /// Supported types are and only. + /// Supported types are and only. public ModuleAttribute( string id, string name, @@ -259,8 +259,8 @@ object enabledByDependencyOnly enabledByDependencyOnly ) { - type = (type ?? String.Empty).Trim(); - _type = String.IsNullOrEmpty(type) ? null : type; + type = (type ?? string.Empty).Trim(); + _type = string.IsNullOrEmpty(type) ? null : type; } /// diff --git a/src/OrchardCore/OrchardCore.Abstractions/Modules/Manifest/ModuleNameAttribute.cs b/src/OrchardCore/OrchardCore.Abstractions/Modules/Manifest/ModuleNameAttribute.cs index 09256c0eb26..5323a49f369 100644 --- a/src/OrchardCore/OrchardCore.Abstractions/Modules/Manifest/ModuleNameAttribute.cs +++ b/src/OrchardCore/OrchardCore.Abstractions/Modules/Manifest/ModuleNameAttribute.cs @@ -10,7 +10,7 @@ public class ModuleNameAttribute : Attribute { public ModuleNameAttribute(string name) { - Name = name ?? String.Empty; + Name = name ?? string.Empty; } /// diff --git a/src/OrchardCore/OrchardCore.Abstractions/Modules/Module.cs b/src/OrchardCore/OrchardCore.Abstractions/Modules/Module.cs index a8a4b7a26ab..d1584f980df 100644 --- a/src/OrchardCore/OrchardCore.Abstractions/Modules/Module.cs +++ b/src/OrchardCore/OrchardCore.Abstractions/Modules/Module.cs @@ -29,7 +29,7 @@ public class Module /// Whether the Module may be considered to be the "Application". public Module(string assemblyName, bool isApplication = false) { - if (!String.IsNullOrWhiteSpace(assemblyName)) + if (!string.IsNullOrWhiteSpace(assemblyName)) { Assembly = Assembly.Load(new AssemblyName(assemblyName)); @@ -98,7 +98,7 @@ public Module(string assemblyName, bool isApplication = false) } else { - Name = Root = SubPath = String.Empty; + Name = Root = SubPath = string.Empty; Assets = Enumerable.Empty(); AssetPaths = Enumerable.Empty(); ModuleInfo = new ModuleAttribute(); @@ -107,7 +107,7 @@ public Module(string assemblyName, bool isApplication = false) _baseNamespace = Name + '.'; _lastModified = DateTimeOffset.UtcNow; - if (!String.IsNullOrEmpty(Assembly?.Location)) + if (!string.IsNullOrEmpty(Assembly?.Location)) { try { diff --git a/src/OrchardCore/OrchardCore.Abstractions/Routing/FormValueRequiredMatcherPolicy.cs b/src/OrchardCore/OrchardCore.Abstractions/Routing/FormValueRequiredMatcherPolicy.cs index 0a0d0d64252..60ddd9a821c 100644 --- a/src/OrchardCore/OrchardCore.Abstractions/Routing/FormValueRequiredMatcherPolicy.cs +++ b/src/OrchardCore/OrchardCore.Abstractions/Routing/FormValueRequiredMatcherPolicy.cs @@ -14,7 +14,7 @@ public FormValueRequiredMatcherPolicy() { } - public override int Order => Int32.MinValue + 100; + public override int Order => int.MinValue + 100; public bool AppliesToEndpoints(IReadOnlyList endpoints) { @@ -60,7 +60,7 @@ public Task ApplyAsync(HttpContext httpContext, CandidateSet candidates) var value = httpContext.Request.Form[required.FormKey]; - candidates.SetValidity(i, !String.IsNullOrEmpty(value)); + candidates.SetValidity(i, !string.IsNullOrEmpty(value)); } return Task.CompletedTask; diff --git a/src/OrchardCore/OrchardCore.Abstractions/Shell/Configuration/Internal/UpdatableDataProvider.cs b/src/OrchardCore/OrchardCore.Abstractions/Shell/Configuration/Internal/UpdatableDataProvider.cs index 298267ade3e..9ef4a86234d 100644 --- a/src/OrchardCore/OrchardCore.Abstractions/Shell/Configuration/Internal/UpdatableDataProvider.cs +++ b/src/OrchardCore/OrchardCore.Abstractions/Shell/Configuration/Internal/UpdatableDataProvider.cs @@ -36,7 +36,7 @@ public virtual void Load() public virtual IEnumerable GetChildKeys(IEnumerable earlierKeys, string parentPath) { - var prefix = parentPath == null ? String.Empty : parentPath + ConfigurationPath.KeyDelimiter; + var prefix = parentPath == null ? string.Empty : parentPath + ConfigurationPath.KeyDelimiter; return Data .Where(kv => kv.Key.StartsWith(prefix, StringComparison.OrdinalIgnoreCase)) diff --git a/src/OrchardCore/OrchardCore.Abstractions/Shell/Extensions/ShellSettingsExtensions.cs b/src/OrchardCore/OrchardCore.Abstractions/Shell/Extensions/ShellSettingsExtensions.cs index 057f2ad2990..52b437ac98d 100644 --- a/src/OrchardCore/OrchardCore.Abstractions/Shell/Extensions/ShellSettingsExtensions.cs +++ b/src/OrchardCore/OrchardCore.Abstractions/Shell/Extensions/ShellSettingsExtensions.cs @@ -45,9 +45,9 @@ public static class ShellSettingsExtensions /// public static bool HasUrlPrefix(this ShellSettings settings, string urlPrefix) => settings is not null && - String.Equals( - settings.RequestUrlPrefix ?? String.Empty, - urlPrefix?.Trim(' ', '/') ?? String.Empty, + string.Equals( + settings.RequestUrlPrefix ?? string.Empty, + urlPrefix?.Trim(' ', '/') ?? string.Empty, StringComparison.OrdinalIgnoreCase); /// diff --git a/src/OrchardCore/OrchardCore.Abstractions/StringUriExtensions.cs b/src/OrchardCore/OrchardCore.Abstractions/StringUriExtensions.cs index 4d2c254f1af..dc5d9807f5d 100644 --- a/src/OrchardCore/OrchardCore.Abstractions/StringUriExtensions.cs +++ b/src/OrchardCore/OrchardCore.Abstractions/StringUriExtensions.cs @@ -6,7 +6,7 @@ public static class StringUriExtensions { public static string ToUriComponents(this string url, UriFormat uriFormat = UriFormat.UriEscaped) { - if (String.IsNullOrEmpty(url)) + if (string.IsNullOrEmpty(url)) { return url; } @@ -18,7 +18,7 @@ public static string ToUriComponents(this string url, UriFormat uriFormat = UriF public static string ToSnakeCase(this string str) { - return String.Concat(str.Select((x, i) => i > 0 && Char.IsUpper(x) ? "_" + x.ToString() : x.ToString())).ToLower(); + return string.Concat(str.Select((x, i) => i > 0 && char.IsUpper(x) ? "_" + x.ToString() : x.ToString())).ToLower(); } } } diff --git a/src/OrchardCore/OrchardCore.Admin.Abstractions/IAdminThemeService.cs b/src/OrchardCore/OrchardCore.Admin.Abstractions/IAdminThemeService.cs index 8d4de54d01c..e3299984a34 100644 --- a/src/OrchardCore/OrchardCore.Admin.Abstractions/IAdminThemeService.cs +++ b/src/OrchardCore/OrchardCore.Admin.Abstractions/IAdminThemeService.cs @@ -1,4 +1,4 @@ -using System.Threading.Tasks; +using System.Threading.Tasks; using OrchardCore.Environment.Extensions; namespace OrchardCore.Admin diff --git a/src/OrchardCore/OrchardCore.Admin.Abstractions/Properties/AssemblyInfo.cs b/src/OrchardCore/OrchardCore.Admin.Abstractions/Properties/AssemblyInfo.cs index 4a9075d7d30..ad90c1be4c4 100644 --- a/src/OrchardCore/OrchardCore.Admin.Abstractions/Properties/AssemblyInfo.cs +++ b/src/OrchardCore/OrchardCore.Admin.Abstractions/Properties/AssemblyInfo.cs @@ -1,4 +1,4 @@ -using System.Reflection; +using System.Reflection; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following diff --git a/src/OrchardCore/OrchardCore.Apis.GraphQL.Abstractions/Extensions/ResolveFieldContextExtensions.cs b/src/OrchardCore/OrchardCore.Apis.GraphQL.Abstractions/Extensions/ResolveFieldContextExtensions.cs index 0755d571ed8..2904d33bf78 100644 --- a/src/OrchardCore/OrchardCore.Apis.GraphQL.Abstractions/Extensions/ResolveFieldContextExtensions.cs +++ b/src/OrchardCore/OrchardCore.Apis.GraphQL.Abstractions/Extensions/ResolveFieldContextExtensions.cs @@ -15,7 +15,7 @@ public static bool HasPopulatedArgument(this IResolveFieldContext source, string { if (source.Arguments?.ContainsKey(argumentName) ?? false) { - return !String.IsNullOrEmpty(source.Arguments[argumentName].Value?.ToString()); + return !string.IsNullOrEmpty(source.Arguments[argumentName].Value?.ToString()); }; return false; @@ -25,7 +25,7 @@ public static bool HasPopulatedArgument(this IResolveFieldContext Char.ToLower(value[0]) + value[1..]; + public static string ToGraphQLStringFormat(this string value) => char.ToLower(value[0]) + value[1..]; } } diff --git a/src/OrchardCore/OrchardCore.AuditTrail.Abstractions/Services/AuditTrailFilterEngineModelBinder.cs b/src/OrchardCore/OrchardCore.AuditTrail.Abstractions/Services/AuditTrailFilterEngineModelBinder.cs index 6b649c8d0b7..742886dd5ee 100644 --- a/src/OrchardCore/OrchardCore.AuditTrail.Abstractions/Services/AuditTrailFilterEngineModelBinder.cs +++ b/src/OrchardCore/OrchardCore.AuditTrail.Abstractions/Services/AuditTrailFilterEngineModelBinder.cs @@ -27,7 +27,7 @@ public Task BindModelAsync(ModelBindingContext bindingContext) if (valueProviderResult == ValueProviderResult.None) { - bindingContext.Result = ModelBindingResult.Success(_parser.Parse(String.Empty)); + bindingContext.Result = ModelBindingResult.Success(_parser.Parse(string.Empty)); return Task.CompletedTask; } diff --git a/src/OrchardCore/OrchardCore.Autoroute.Core/Indexes/AutoroutePartIndex.cs b/src/OrchardCore/OrchardCore.Autoroute.Core/Indexes/AutoroutePartIndex.cs index eae40c5f9e5..726158c1c24 100644 --- a/src/OrchardCore/OrchardCore.Autoroute.Core/Indexes/AutoroutePartIndex.cs +++ b/src/OrchardCore/OrchardCore.Autoroute.Core/Indexes/AutoroutePartIndex.cs @@ -126,7 +126,7 @@ public void Describe(DescribeContext context) var partRemoved = _partRemoved.Contains(contentItem.ContentItemId); var part = contentItem.As(); - if (!partRemoved && String.IsNullOrEmpty(part?.Path)) + if (!partRemoved && string.IsNullOrEmpty(part?.Path)) { return null; } diff --git a/src/OrchardCore/OrchardCore.Autoroute.Core/Services/AutorouteEntries.cs b/src/OrchardCore/OrchardCore.Autoroute.Core/Services/AutorouteEntries.cs index 591566f37b6..1f984e15e05 100644 --- a/src/OrchardCore/OrchardCore.Autoroute.Core/Services/AutorouteEntries.cs +++ b/src/OrchardCore/OrchardCore.Autoroute.Core/Services/AutorouteEntries.cs @@ -85,10 +85,10 @@ protected void AddEntries(IEnumerable entries) // Evict all entries related to a container item from autoroute entries. // This is necessary to account for deletions, disabling of an item, or disabling routing of contained items. ILookup entriesByContainer = null; - foreach (var entry in entries.Where(x => String.IsNullOrEmpty(x.ContainedContentItemId))) + foreach (var entry in entries.Where(x => string.IsNullOrEmpty(x.ContainedContentItemId))) { entriesByContainer ??= _paths.Values - .Where(x => !String.IsNullOrEmpty(x.ContainedContentItemId)) + .Where(x => !string.IsNullOrEmpty(x.ContainedContentItemId)) .ToLookup(x => x.ContentItemId); if (!entriesByContainer.Contains(entry.ContentItemId)) @@ -105,12 +105,12 @@ protected void AddEntries(IEnumerable entries) foreach (var entry in entries) { if (_paths.TryGetValue(entry.ContentItemId, out var previousContainerEntry) && - String.IsNullOrEmpty(entry.ContainedContentItemId)) + string.IsNullOrEmpty(entry.ContainedContentItemId)) { _contentItemIds = _contentItemIds.Remove(previousContainerEntry.Path); } - if (!String.IsNullOrEmpty(entry.ContainedContentItemId) && + if (!string.IsNullOrEmpty(entry.ContainedContentItemId) && _paths.TryGetValue(entry.ContainedContentItemId, out var previousContainedEntry)) { _contentItemIds = _contentItemIds.Remove(previousContainedEntry.Path); @@ -118,7 +118,7 @@ protected void AddEntries(IEnumerable entries) _contentItemIds = _contentItemIds.SetItem(entry.Path, entry); - if (!String.IsNullOrEmpty(entry.ContainedContentItemId)) + if (!string.IsNullOrEmpty(entry.ContainedContentItemId)) { _paths = _paths.SetItem(entry.ContainedContentItemId, entry); } @@ -135,7 +135,7 @@ protected void RemoveEntries(IEnumerable entries) { // Evict all entries related to a container item from autoroute entries. var entriesToRemove = _paths.Values.Where(x => x.ContentItemId == entry.ContentItemId && - !String.IsNullOrEmpty(x.ContainedContentItemId)); + !string.IsNullOrEmpty(x.ContainedContentItemId)); _paths = _paths.RemoveRange(entriesToRemove.Select(x => x.ContainedContentItemId)); _contentItemIds = _contentItemIds.RemoveRange(entriesToRemove.Select(x => x.Path)); diff --git a/src/OrchardCore/OrchardCore.Configuration.KeyVault/Extensions/AzureKeyVaultWebHostBuilderExtension.cs b/src/OrchardCore/OrchardCore.Configuration.KeyVault/Extensions/AzureKeyVaultWebHostBuilderExtension.cs index 3d0a7765652..ba732c488d9 100644 --- a/src/OrchardCore/OrchardCore.Configuration.KeyVault/Extensions/AzureKeyVaultWebHostBuilderExtension.cs +++ b/src/OrchardCore/OrchardCore.Configuration.KeyVault/Extensions/AzureKeyVaultWebHostBuilderExtension.cs @@ -46,7 +46,7 @@ public static IHostBuilder AddOrchardCoreAzureKeyVault(this IHostBuilder builder var keyVaultName = builtConfig["OrchardCore:OrchardCore_KeyVault_Azure:KeyVaultName"]; TimeSpan? reloadInterval = null; - if (Double.TryParse(builtConfig["OrchardCore:OrchardCore_KeyVault_Azure:ReloadInterval"], out var interval)) + if (double.TryParse(builtConfig["OrchardCore:OrchardCore_KeyVault_Azure:ReloadInterval"], out var interval)) { reloadInterval = TimeSpan.FromSeconds(interval); } diff --git a/src/OrchardCore/OrchardCore.ContentLocalization.Abstractions/Records/LocalizedContentItemIndex.cs b/src/OrchardCore/OrchardCore.ContentLocalization.Abstractions/Records/LocalizedContentItemIndex.cs index 777b6d7e32a..5de14975db8 100644 --- a/src/OrchardCore/OrchardCore.ContentLocalization.Abstractions/Records/LocalizedContentItemIndex.cs +++ b/src/OrchardCore/OrchardCore.ContentLocalization.Abstractions/Records/LocalizedContentItemIndex.cs @@ -92,7 +92,7 @@ public void Describe(DescribeContext context) var partRemoved = _partRemoved.Contains(contentItem.ContentItemId); var part = contentItem.As(); - if (!partRemoved && (part == null || String.IsNullOrEmpty(part.LocalizationSet) || part.Culture == null)) + if (!partRemoved && (part == null || string.IsNullOrEmpty(part.LocalizationSet) || part.Culture == null)) { return null; } diff --git a/src/OrchardCore/OrchardCore.ContentManagement.Abstractions/Handlers/ContentItemMetadataContext.cs b/src/OrchardCore/OrchardCore.ContentManagement.Abstractions/Handlers/ContentItemMetadataContext.cs index 245ff53f651..be02d8ed348 100644 --- a/src/OrchardCore/OrchardCore.ContentManagement.Abstractions/Handlers/ContentItemMetadataContext.cs +++ b/src/OrchardCore/OrchardCore.ContentManagement.Abstractions/Handlers/ContentItemMetadataContext.cs @@ -1,4 +1,4 @@ -namespace OrchardCore.ContentManagement.Handlers +namespace OrchardCore.ContentManagement.Handlers { public class ContentItemMetadataContext { diff --git a/src/OrchardCore/OrchardCore.ContentManagement.Abstractions/Handlers/IContentFieldHandlerResolver.cs b/src/OrchardCore/OrchardCore.ContentManagement.Abstractions/Handlers/IContentFieldHandlerResolver.cs index cb682c06cc9..2d5b68da87d 100644 --- a/src/OrchardCore/OrchardCore.ContentManagement.Abstractions/Handlers/IContentFieldHandlerResolver.cs +++ b/src/OrchardCore/OrchardCore.ContentManagement.Abstractions/Handlers/IContentFieldHandlerResolver.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; namespace OrchardCore.ContentManagement.Handlers { diff --git a/src/OrchardCore/OrchardCore.ContentManagement.Abstractions/IContentHandleManager.cs b/src/OrchardCore/OrchardCore.ContentManagement.Abstractions/IContentHandleManager.cs index 891b8cc0518..810e84f5faf 100644 --- a/src/OrchardCore/OrchardCore.ContentManagement.Abstractions/IContentHandleManager.cs +++ b/src/OrchardCore/OrchardCore.ContentManagement.Abstractions/IContentHandleManager.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Threading.Tasks; namespace OrchardCore.ContentManagement diff --git a/src/OrchardCore/OrchardCore.ContentManagement.Abstractions/IContentHandleProvider.cs b/src/OrchardCore/OrchardCore.ContentManagement.Abstractions/IContentHandleProvider.cs index 972ef3deaf5..1769d71c273 100644 --- a/src/OrchardCore/OrchardCore.ContentManagement.Abstractions/IContentHandleProvider.cs +++ b/src/OrchardCore/OrchardCore.ContentManagement.Abstractions/IContentHandleProvider.cs @@ -1,4 +1,4 @@ -using System.Threading.Tasks; +using System.Threading.Tasks; namespace OrchardCore.ContentManagement { diff --git a/src/OrchardCore/OrchardCore.ContentManagement.Abstractions/IContentItemIdGenerator.cs b/src/OrchardCore/OrchardCore.ContentManagement.Abstractions/IContentItemIdGenerator.cs index bf62158cd23..3ece3132020 100644 --- a/src/OrchardCore/OrchardCore.ContentManagement.Abstractions/IContentItemIdGenerator.cs +++ b/src/OrchardCore/OrchardCore.ContentManagement.Abstractions/IContentItemIdGenerator.cs @@ -1,4 +1,4 @@ -namespace OrchardCore.ContentManagement +namespace OrchardCore.ContentManagement { public interface IContentItemIdGenerator { diff --git a/src/OrchardCore/OrchardCore.ContentManagement.Abstractions/IContentManager.cs b/src/OrchardCore/OrchardCore.ContentManagement.Abstractions/IContentManager.cs index aa0341ee66f..efc364b8a4f 100644 --- a/src/OrchardCore/OrchardCore.ContentManagement.Abstractions/IContentManager.cs +++ b/src/OrchardCore/OrchardCore.ContentManagement.Abstractions/IContentManager.cs @@ -237,7 +237,7 @@ public static async Task GetAsync(this IContentManager contentManag var contentItem = await contentManager.GetAsync(id, options); // It represents a contained content item - if (!String.IsNullOrEmpty(jsonPath)) + if (!string.IsNullOrEmpty(jsonPath)) { var root = contentItem.Content as JObject; contentItem = root.SelectToken(jsonPath)?.ToObject(); diff --git a/src/OrchardCore/OrchardCore.ContentManagement.Abstractions/Metadata/Builders/ContentPartDefinitionBuilder.cs b/src/OrchardCore/OrchardCore.ContentManagement.Abstractions/Metadata/Builders/ContentPartDefinitionBuilder.cs index b07bd92e309..0a0424bb6c1 100644 --- a/src/OrchardCore/OrchardCore.ContentManagement.Abstractions/Metadata/Builders/ContentPartDefinitionBuilder.cs +++ b/src/OrchardCore/OrchardCore.ContentManagement.Abstractions/Metadata/Builders/ContentPartDefinitionBuilder.cs @@ -46,7 +46,7 @@ public ContentPartDefinition Build() { throw new ArgumentException("Content part name must start with a letter", "name"); } - if (!String.Equals(Name, Name.ToSafeName(), StringComparison.OrdinalIgnoreCase)) + if (!string.Equals(Name, Name.ToSafeName(), StringComparison.OrdinalIgnoreCase)) { throw new ArgumentException("Content part name contains invalid characters", "name"); } @@ -66,7 +66,7 @@ public ContentPartDefinitionBuilder Named(string name) public ContentPartDefinitionBuilder RemoveField(string fieldName) { - var existingField = _fields.SingleOrDefault(x => String.Equals(x.Name, fieldName, StringComparison.OrdinalIgnoreCase)); + var existingField = _fields.SingleOrDefault(x => string.Equals(x.Name, fieldName, StringComparison.OrdinalIgnoreCase)); if (existingField != null) { _fields.Remove(existingField); @@ -123,7 +123,7 @@ public ContentPartDefinitionBuilder WithField(string fieldName) public ContentPartDefinitionBuilder WithField(string fieldName, Action configuration) { - var existingField = _fields.FirstOrDefault(x => String.Equals(x.Name, fieldName, StringComparison.OrdinalIgnoreCase)); + var existingField = _fields.FirstOrDefault(x => string.Equals(x.Name, fieldName, StringComparison.OrdinalIgnoreCase)); if (existingField != null) { var toRemove = _fields.Where(x => x.Name == fieldName).ToArray(); @@ -144,7 +144,7 @@ public ContentPartDefinitionBuilder WithField(string fieldName, Action WithFieldAsync(string fieldName, Func configurationAsync) { - var existingField = _fields.FirstOrDefault(x => String.Equals(x.Name, fieldName, StringComparison.OrdinalIgnoreCase)); + var existingField = _fields.FirstOrDefault(x => string.Equals(x.Name, fieldName, StringComparison.OrdinalIgnoreCase)); if (existingField != null) { @@ -188,7 +188,7 @@ public override ContentPartFieldDefinition Build() { throw new ArgumentException("Content field name must start with a letter", "name"); } - if (!String.Equals(_fieldName, _fieldName.ToSafeName(), StringComparison.OrdinalIgnoreCase)) + if (!string.Equals(_fieldName, _fieldName.ToSafeName(), StringComparison.OrdinalIgnoreCase)) { throw new ArgumentException("Content field name contains invalid characters", "name"); } diff --git a/src/OrchardCore/OrchardCore.ContentManagement.Abstractions/Metadata/Builders/ContentTypeDefinitionBuilder.cs b/src/OrchardCore/OrchardCore.ContentManagement.Abstractions/Metadata/Builders/ContentTypeDefinitionBuilder.cs index 9aeb5f4de41..26e9d8c7972 100644 --- a/src/OrchardCore/OrchardCore.ContentManagement.Abstractions/Metadata/Builders/ContentTypeDefinitionBuilder.cs +++ b/src/OrchardCore/OrchardCore.ContentManagement.Abstractions/Metadata/Builders/ContentTypeDefinitionBuilder.cs @@ -46,7 +46,7 @@ public ContentTypeDefinition Build() { throw new ArgumentException("Content type name must start with a letter", "name"); } - if (!String.Equals(_name, _name.ToSafeName(), StringComparison.OrdinalIgnoreCase)) + if (!string.Equals(_name, _name.ToSafeName(), StringComparison.OrdinalIgnoreCase)) { throw new ArgumentException("Content type name contains invalid characters", "name"); } @@ -114,7 +114,7 @@ public ContentTypeDefinitionBuilder WithSettings(T settings) public ContentTypeDefinitionBuilder RemovePart(string partName) { - var existingPart = _parts.SingleOrDefault(x => String.Equals(x.Name, partName, StringComparison.OrdinalIgnoreCase)); + var existingPart = _parts.SingleOrDefault(x => string.Equals(x.Name, partName, StringComparison.OrdinalIgnoreCase)); if (existingPart != null) { _parts.Remove(existingPart); @@ -144,7 +144,7 @@ public ContentTypeDefinitionBuilder WithPart(string partName, Action configuration) { - var existingPart = _parts.FirstOrDefault(x => String.Equals(x.Name, name, StringComparison.OrdinalIgnoreCase)); + var existingPart = _parts.FirstOrDefault(x => string.Equals(x.Name, name, StringComparison.OrdinalIgnoreCase)); if (existingPart != null) { _parts.Remove(existingPart); @@ -175,7 +175,7 @@ public Task WithPartAsync(string partName, Func WithPartAsync(string name, ContentPartDefinition partDefinition, Func configurationAsync) { - var existingPart = _parts.FirstOrDefault(x => String.Equals(x.Name, name, StringComparison.OrdinalIgnoreCase)); + var existingPart = _parts.FirstOrDefault(x => string.Equals(x.Name, name, StringComparison.OrdinalIgnoreCase)); if (existingPart != null) { @@ -216,7 +216,7 @@ public override ContentTypePartDefinition Build() throw new ArgumentException("Content part name must start with a letter", "name"); } - if (!String.Equals(Current.Name, Current.Name.ToSafeName(), StringComparison.OrdinalIgnoreCase)) + if (!string.Equals(Current.Name, Current.Name.ToSafeName(), StringComparison.OrdinalIgnoreCase)) { throw new ArgumentException("Content part name contains invalid characters", "name"); } diff --git a/src/OrchardCore/OrchardCore.ContentManagement.Abstractions/Metadata/Models/ContentPartFieldSettingsExtensions.cs b/src/OrchardCore/OrchardCore.ContentManagement.Abstractions/Metadata/Models/ContentPartFieldSettingsExtensions.cs index 52952a47ed7..8cc55a5e14c 100644 --- a/src/OrchardCore/OrchardCore.ContentManagement.Abstractions/Metadata/Models/ContentPartFieldSettingsExtensions.cs +++ b/src/OrchardCore/OrchardCore.ContentManagement.Abstractions/Metadata/Models/ContentPartFieldSettingsExtensions.cs @@ -9,7 +9,7 @@ public static string DisplayName(this ContentPartFieldDefinition partField) { var displayName = partField.GetSettings().DisplayName; - if (String.IsNullOrEmpty(displayName)) + if (string.IsNullOrEmpty(displayName)) { displayName = partField.FieldDefinition.Name; } diff --git a/src/OrchardCore/OrchardCore.ContentManagement.Abstractions/Metadata/Models/ContentTypeExtensions.cs b/src/OrchardCore/OrchardCore.ContentManagement.Abstractions/Metadata/Models/ContentTypeExtensions.cs index 8d84350e050..136fa680911 100644 --- a/src/OrchardCore/OrchardCore.ContentManagement.Abstractions/Metadata/Models/ContentTypeExtensions.cs +++ b/src/OrchardCore/OrchardCore.ContentManagement.Abstractions/Metadata/Models/ContentTypeExtensions.cs @@ -9,24 +9,24 @@ public static bool TryGetStereotype(this ContentTypeDefinition contentTypeDefini { stereotype = contentTypeDefinition.GetStereotype(); - return !String.IsNullOrWhiteSpace(stereotype); + return !string.IsNullOrWhiteSpace(stereotype); } public static bool HasStereotype(this ContentTypeDefinition contentTypeDefinition) - => !String.IsNullOrEmpty(contentTypeDefinition.GetStereotype()); + => !string.IsNullOrEmpty(contentTypeDefinition.GetStereotype()); public static bool StereotypeEquals(this ContentTypeDefinition contentTypeDefinition, string stereotype) => contentTypeDefinition.StereotypeEquals(stereotype, StringComparison.Ordinal); public static bool StereotypeEquals(this ContentTypeDefinition contentTypeDefinition, string stereotype, StringComparison stringComparison) { - if (String.IsNullOrEmpty(stereotype)) + if (string.IsNullOrEmpty(stereotype)) { throw new ArgumentNullException(nameof(stereotype)); } return contentTypeDefinition.TryGetStereotype(out var st) - && String.Equals(st, stereotype, stringComparison); + && string.Equals(st, stereotype, stringComparison); } public static string GetStereotype(this ContentTypeDefinition contentTypeDefinition) @@ -48,7 +48,7 @@ public static bool IsSecurable(this ContentTypeDefinition contentTypeDefinition) => contentTypeDefinition.GetSettings().Securable; public static bool HasDescription(this ContentTypeDefinition contentTypeDefinition) - => !String.IsNullOrWhiteSpace(contentTypeDefinition.GetSettings().Description); + => !string.IsNullOrWhiteSpace(contentTypeDefinition.GetSettings().Description); public static string GetDescription(this ContentTypeDefinition contentTypeDefinition) => contentTypeDefinition.GetSettings().Description; diff --git a/src/OrchardCore/OrchardCore.ContentManagement.Abstractions/Metadata/Models/ContentTypePartExtensions.cs b/src/OrchardCore/OrchardCore.ContentManagement.Abstractions/Metadata/Models/ContentTypePartExtensions.cs index edc25ceeedd..969d1e455f9 100644 --- a/src/OrchardCore/OrchardCore.ContentManagement.Abstractions/Metadata/Models/ContentTypePartExtensions.cs +++ b/src/OrchardCore/OrchardCore.ContentManagement.Abstractions/Metadata/Models/ContentTypePartExtensions.cs @@ -9,7 +9,7 @@ public static string DisplayName(this ContentTypePartDefinition typePart) { var displayName = typePart.GetSettings().DisplayName; - if (String.IsNullOrEmpty(displayName)) + if (string.IsNullOrEmpty(displayName)) { // ContentType creates a same named ContentPart. As DisplayName is not stored in ContentPart, // fetching it from the parent ContentType @@ -28,7 +28,7 @@ public static string Description(this ContentTypePartDefinition typePart) { var description = typePart.GetSettings().Description; - if (String.IsNullOrEmpty(description)) + if (string.IsNullOrEmpty(description)) { description = typePart.PartDefinition.Description(); } diff --git a/src/OrchardCore/OrchardCore.ContentManagement.Abstractions/Metadata/Settings/ContentPartSettingsExtensions.cs b/src/OrchardCore/OrchardCore.ContentManagement.Abstractions/Metadata/Settings/ContentPartSettingsExtensions.cs index 4795267ec80..67b44ec535a 100644 --- a/src/OrchardCore/OrchardCore.ContentManagement.Abstractions/Metadata/Settings/ContentPartSettingsExtensions.cs +++ b/src/OrchardCore/OrchardCore.ContentManagement.Abstractions/Metadata/Settings/ContentPartSettingsExtensions.cs @@ -56,7 +56,7 @@ public static string DisplayName(this ContentPartDefinition part) { var displayName = part.GetSettings().DisplayName; - if (String.IsNullOrEmpty(displayName)) + if (string.IsNullOrEmpty(displayName)) { displayName = part.Name.TrimEnd("Part"); } diff --git a/src/OrchardCore/OrchardCore.ContentManagement.Abstractions/Models/BodyAspect.cs b/src/OrchardCore/OrchardCore.ContentManagement.Abstractions/Models/BodyAspect.cs index dee1616ef2b..43f3ea8ce97 100644 --- a/src/OrchardCore/OrchardCore.ContentManagement.Abstractions/Models/BodyAspect.cs +++ b/src/OrchardCore/OrchardCore.ContentManagement.Abstractions/Models/BodyAspect.cs @@ -1,4 +1,4 @@ -using Microsoft.AspNetCore.Html; +using Microsoft.AspNetCore.Html; namespace OrchardCore.ContentManagement.Models { diff --git a/src/OrchardCore/OrchardCore.ContentManagement.Abstractions/Utilities/StringExtensions.cs b/src/OrchardCore/OrchardCore.ContentManagement.Abstractions/Utilities/StringExtensions.cs index 1820baf350a..b7403bab4cf 100644 --- a/src/OrchardCore/OrchardCore.ContentManagement.Abstractions/Utilities/StringExtensions.cs +++ b/src/OrchardCore/OrchardCore.ContentManagement.Abstractions/Utilities/StringExtensions.cs @@ -14,7 +14,7 @@ public static class StringExtensions public static string CamelFriendly(this string camel) { // optimize common cases - if (String.IsNullOrWhiteSpace(camel)) + if (string.IsNullOrWhiteSpace(camel)) { return ""; } @@ -23,7 +23,7 @@ public static string CamelFriendly(this string camel) for (var i = 0; i < camel.Length; ++i) { var c = camel[i]; - if (i != 0 && Char.IsUpper(c)) + if (i != 0 && char.IsUpper(c)) { sb.Append(' '); } @@ -40,7 +40,7 @@ public static string Ellipsize(this string text, int characterCount) public static string Ellipsize(this string text, int characterCount, string ellipsis, bool wordBoundary = false) { - if (String.IsNullOrWhiteSpace(text)) + if (string.IsNullOrWhiteSpace(text)) return ""; if (characterCount < 0 || text.Length <= characterCount) @@ -71,16 +71,16 @@ public static string Ellipsize(this string text, int characterCount, string elli public static LocalizedString OrDefault(this string text, LocalizedString defaultValue) { - return String.IsNullOrEmpty(text) + return string.IsNullOrEmpty(text) ? defaultValue : new LocalizedString(null, text); } public static string RemoveTags(this string html, bool htmlDecode = false) { - if (String.IsNullOrEmpty(html)) + if (string.IsNullOrEmpty(html)) { - return String.Empty; + return string.Empty; } var result = new char[html.Length]; @@ -120,12 +120,12 @@ public static string RemoveTags(this string html, bool htmlDecode = false) // not accounting for only \r (e.g. Apple OS 9 carriage return only new lines) public static string ReplaceNewLinesWith(this string text, string replacement) { - return String.IsNullOrWhiteSpace(text) - ? String.Empty + return string.IsNullOrWhiteSpace(text) + ? string.Empty : text .Replace("\r\n", "\r\r") - .Replace("\n", String.Format(replacement, "\r\n")) - .Replace("\r\r", String.Format(replacement, "\r\n")); + .Replace("\n", string.Format(replacement, "\r\n")) + .Replace("\r\r", string.Format(replacement, "\r\n")); } private static readonly char[] _validSegmentChars = "/?#[]@\"^{}|`<>\t\r\n\f ".ToCharArray(); @@ -153,15 +153,15 @@ public static bool IsValidUrlSegment(this string segment) /// public static string ToSafeName(this string name) { - if (String.IsNullOrWhiteSpace(name)) + if (string.IsNullOrWhiteSpace(name)) { - return String.Empty; + return string.Empty; } name = RemoveDiacritics(name); name = name.Strip(c => !c.IsLetter() - && !Char.IsDigit(c) + && !char.IsDigit(c) ); name = name.Trim(); @@ -238,7 +238,7 @@ public static string RemoveDiacritics(this string name) public static string Strip(this string subject, params char[] stripped) { - if (stripped == null || stripped.Length == 0 || String.IsNullOrEmpty(subject)) + if (stripped == null || stripped.Length == 0 || string.IsNullOrEmpty(subject)) { return subject; } @@ -277,7 +277,7 @@ public static string Strip(this string subject, Func predicate) public static bool Any(this string subject, params char[] chars) { - if (String.IsNullOrEmpty(subject) || chars == null || chars.Length == 0) + if (string.IsNullOrEmpty(subject) || chars == null || chars.Length == 0) { return false; } @@ -296,7 +296,7 @@ public static bool Any(this string subject, params char[] chars) public static bool All(this string subject, params char[] chars) { - if (String.IsNullOrEmpty(subject)) + if (string.IsNullOrEmpty(subject)) { return true; } @@ -320,7 +320,7 @@ public static bool All(this string subject, params char[] chars) public static string Translate(this string subject, char[] from, char[] to) { - if (String.IsNullOrEmpty(subject)) + if (string.IsNullOrEmpty(subject)) { return subject; } @@ -366,7 +366,7 @@ public static string Translate(this string subject, char[] from, char[] to) public static string ReplaceAll(this string original, IDictionary replacements) { - var pattern = $"{String.Join("|", replacements.Keys)}"; + var pattern = $"{string.Join("|", replacements.Keys)}"; return Regex.Replace(original, pattern, match => replacements[match.Value]); } diff --git a/src/OrchardCore/OrchardCore.ContentManagement.Display/ContentDisplay/ContentFieldDisplayDriver.cs b/src/OrchardCore/OrchardCore.ContentManagement.Display/ContentDisplay/ContentFieldDisplayDriver.cs index 13d38491de7..396d2a8de69 100644 --- a/src/OrchardCore/OrchardCore.ContentManagement.Display/ContentDisplay/ContentFieldDisplayDriver.cs +++ b/src/OrchardCore/OrchardCore.ContentManagement.Display/ContentDisplay/ContentFieldDisplayDriver.cs @@ -32,7 +32,7 @@ public override ShapeResult Factory(string shapeType, Func IContentFieldDisplayDriver.BuildDisplayAsync(ContentPart contentPart, ContentPartFieldDefinition partFieldDefinition, ContentTypePartDefinition typePartDefinition, BuildDisplayContext context) { - if (!String.Equals(typeof(TField).Name, partFieldDefinition.FieldDefinition.Name) && - !String.Equals(nameof(ContentField), partFieldDefinition.FieldDefinition.Name)) + if (!string.Equals(typeof(TField).Name, partFieldDefinition.FieldDefinition.Name) && + !string.Equals(nameof(ContentField), partFieldDefinition.FieldDefinition.Name)) { return Task.FromResult(default(IDisplayResult)); } @@ -160,8 +160,8 @@ Task IContentFieldDisplayDriver.BuildDisplayAsync(ContentPart co Task IContentFieldDisplayDriver.BuildEditorAsync(ContentPart contentPart, ContentPartFieldDefinition partFieldDefinition, ContentTypePartDefinition typePartDefinition, BuildEditorContext context) { - if (!String.Equals(typeof(TField).Name, partFieldDefinition.FieldDefinition.Name) && - !String.Equals(nameof(ContentField), partFieldDefinition.FieldDefinition.Name)) + if (!string.Equals(typeof(TField).Name, partFieldDefinition.FieldDefinition.Name) && + !string.Equals(nameof(ContentField), partFieldDefinition.FieldDefinition.Name)) { return Task.FromResult(default(IDisplayResult)); } @@ -190,8 +190,8 @@ Task IContentFieldDisplayDriver.BuildEditorAsync(ContentPart con async Task IContentFieldDisplayDriver.UpdateEditorAsync(ContentPart contentPart, ContentPartFieldDefinition partFieldDefinition, ContentTypePartDefinition typePartDefinition, UpdateEditorContext context) { - if (!String.Equals(typeof(TField).Name, partFieldDefinition.FieldDefinition.Name) && - !String.Equals(nameof(ContentField), partFieldDefinition.FieldDefinition.Name)) + if (!string.Equals(typeof(TField).Name, partFieldDefinition.FieldDefinition.Name) && + !string.Equals(nameof(ContentField), partFieldDefinition.FieldDefinition.Name)) { return null; } @@ -253,7 +253,7 @@ public virtual IDisplayResult Update(TField field, IUpdateModel updater, UpdateF protected string GetEditorShapeType(string shapeType, ContentPartFieldDefinition partFieldDefinition) { var editor = partFieldDefinition.Editor(); - return !String.IsNullOrEmpty(editor) + return !string.IsNullOrEmpty(editor) ? shapeType + "__" + editor : shapeType; } @@ -276,7 +276,7 @@ protected string GetEditorShapeType(BuildFieldEditorContext context) protected string GetDisplayShapeType(string shapeType, BuildFieldDisplayContext context) { var displayMode = context.PartFieldDefinition.DisplayMode(); - return !String.IsNullOrEmpty(displayMode) + return !string.IsNullOrEmpty(displayMode) ? shapeType + DisplaySeparator + displayMode : shapeType; } @@ -290,7 +290,7 @@ private void BuildPrefix(ContentTypePartDefinition typePartDefinition, ContentPa { Prefix = typePartDefinition.Name + "." + partFieldDefinition.Name; - if (!String.IsNullOrEmpty(htmlFieldPrefix)) + if (!string.IsNullOrEmpty(htmlFieldPrefix)) { Prefix = htmlFieldPrefix + "." + Prefix; } diff --git a/src/OrchardCore/OrchardCore.ContentManagement.Display/ContentDisplay/ContentItemDisplayCoordinator.cs b/src/OrchardCore/OrchardCore.ContentManagement.Display/ContentDisplay/ContentItemDisplayCoordinator.cs index 408a7f30a8a..d881cc232f3 100644 --- a/src/OrchardCore/OrchardCore.ContentManagement.Display/ContentDisplay/ContentItemDisplayCoordinator.cs +++ b/src/OrchardCore/OrchardCore.ContentManagement.Display/ContentDisplay/ContentItemDisplayCoordinator.cs @@ -114,7 +114,7 @@ public async Task BuildDisplayAsync(ContentItem contentItem, BuildDisplayContext shapeResult.OnGroup(context.GroupId); shapeResult.Displaying(ctx => { - var displayTypes = new[] { String.Empty, "_" + ctx.Shape.Metadata.DisplayType }; + var displayTypes = new[] { string.Empty, "_" + ctx.Shape.Metadata.DisplayType }; foreach (var displayType in displayTypes) { diff --git a/src/OrchardCore/OrchardCore.ContentManagement.Display/ContentDisplay/ContentPartDisplayDriverTPart.cs b/src/OrchardCore/OrchardCore.ContentManagement.Display/ContentDisplay/ContentPartDisplayDriverTPart.cs index df64c9ab65a..6f16baac500 100644 --- a/src/OrchardCore/OrchardCore.ContentManagement.Display/ContentDisplay/ContentPartDisplayDriverTPart.cs +++ b/src/OrchardCore/OrchardCore.ContentManagement.Display/ContentDisplay/ContentPartDisplayDriverTPart.cs @@ -38,9 +38,9 @@ public override ShapeResult Factory(string shapeType, Func UpdateAsync(TPart part, IUpdateModel updater protected string GetEditorShapeType(string shapeType, ContentTypePartDefinition typePartDefinition) { var editor = typePartDefinition.Editor(); - return !String.IsNullOrEmpty(editor) + return !string.IsNullOrEmpty(editor) ? shapeType + "__" + editor : shapeType; } @@ -318,7 +318,7 @@ protected string GetEditorShapeType(BuildPartEditorContext context) protected string GetDisplayShapeType(string shapeType, BuildPartDisplayContext context) { var displayMode = context.TypePartDefinition.DisplayMode(); - return !String.IsNullOrEmpty(displayMode) + return !string.IsNullOrEmpty(displayMode) ? shapeType + DisplaySeparator + displayMode : shapeType; } @@ -334,7 +334,7 @@ private TempPrefix BuildPrefix(ContentTypePartDefinition typePartDefinition, str Prefix = typePartDefinition.Name; - if (!String.IsNullOrEmpty(htmlFieldPrefix)) + if (!string.IsNullOrEmpty(htmlFieldPrefix)) { Prefix = htmlFieldPrefix + "." + Prefix; } diff --git a/src/OrchardCore/OrchardCore.ContentManagement.Display/ContentDisplay/IContentDisplayDriver.cs b/src/OrchardCore/OrchardCore.ContentManagement.Display/ContentDisplay/IContentDisplayDriver.cs index 190698535c3..c75b71071bc 100644 --- a/src/OrchardCore/OrchardCore.ContentManagement.Display/ContentDisplay/IContentDisplayDriver.cs +++ b/src/OrchardCore/OrchardCore.ContentManagement.Display/ContentDisplay/IContentDisplayDriver.cs @@ -1,4 +1,4 @@ -using OrchardCore.DisplayManagement.Handlers; +using OrchardCore.DisplayManagement.Handlers; namespace OrchardCore.ContentManagement.Display.ContentDisplay { diff --git a/src/OrchardCore/OrchardCore.ContentManagement.Display/ContentDisplay/IContentDisplayHandler.cs b/src/OrchardCore/OrchardCore.ContentManagement.Display/ContentDisplay/IContentDisplayHandler.cs index e9c8c5d1360..32e302a513d 100644 --- a/src/OrchardCore/OrchardCore.ContentManagement.Display/ContentDisplay/IContentDisplayHandler.cs +++ b/src/OrchardCore/OrchardCore.ContentManagement.Display/ContentDisplay/IContentDisplayHandler.cs @@ -1,4 +1,4 @@ -using System.Threading.Tasks; +using System.Threading.Tasks; using OrchardCore.DisplayManagement.Handlers; namespace OrchardCore.ContentManagement.Display.ContentDisplay diff --git a/src/OrchardCore/OrchardCore.ContentManagement.Display/ContentDisplay/IContentFieldDisplayDriver.cs b/src/OrchardCore/OrchardCore.ContentManagement.Display/ContentDisplay/IContentFieldDisplayDriver.cs index f85c72996f0..ea15576350e 100644 --- a/src/OrchardCore/OrchardCore.ContentManagement.Display/ContentDisplay/IContentFieldDisplayDriver.cs +++ b/src/OrchardCore/OrchardCore.ContentManagement.Display/ContentDisplay/IContentFieldDisplayDriver.cs @@ -1,4 +1,4 @@ -using System.Threading.Tasks; +using System.Threading.Tasks; using OrchardCore.ContentManagement.Metadata.Models; using OrchardCore.DisplayManagement.Handlers; using OrchardCore.DisplayManagement.Views; diff --git a/src/OrchardCore/OrchardCore.ContentManagement.Display/ContentDisplay/IContentPartDisplayDriver.cs b/src/OrchardCore/OrchardCore.ContentManagement.Display/ContentDisplay/IContentPartDisplayDriver.cs index 190d6a02d7c..fddaf9f0934 100644 --- a/src/OrchardCore/OrchardCore.ContentManagement.Display/ContentDisplay/IContentPartDisplayDriver.cs +++ b/src/OrchardCore/OrchardCore.ContentManagement.Display/ContentDisplay/IContentPartDisplayDriver.cs @@ -1,4 +1,4 @@ -using System.Threading.Tasks; +using System.Threading.Tasks; using OrchardCore.ContentManagement.Metadata.Models; using OrchardCore.DisplayManagement.Handlers; using OrchardCore.DisplayManagement.Views; diff --git a/src/OrchardCore/OrchardCore.ContentManagement.Display/ContentItemDisplayManager.cs b/src/OrchardCore/OrchardCore.ContentManagement.Display/ContentItemDisplayManager.cs index bcff6ee12e6..3919804c1fd 100644 --- a/src/OrchardCore/OrchardCore.ContentManagement.Display/ContentItemDisplayManager.cs +++ b/src/OrchardCore/OrchardCore.ContentManagement.Display/ContentItemDisplayManager.cs @@ -59,7 +59,7 @@ public async Task BuildDisplayAsync(ContentItem contentItem, IUpdateMode var contentTypeDefinition = _contentDefinitionManager.GetTypeDefinition(contentItem.ContentType) ?? throw new NullReferenceException($"Content Type {contentItem.ContentType} does not exist."); - var actualDisplayType = String.IsNullOrEmpty(displayType) ? "Detail" : displayType; + var actualDisplayType = string.IsNullOrEmpty(displayType) ? "Detail" : displayType; var hasStereotype = contentTypeDefinition.TryGetStereotype(out var stereotype); var actualShapeType = "Content"; diff --git a/src/OrchardCore/OrchardCore.ContentManagement.Display/Models/BuildFieldDisplayContext.cs b/src/OrchardCore/OrchardCore.ContentManagement.Display/Models/BuildFieldDisplayContext.cs index 48cc6cde03b..f5e8ea58c36 100644 --- a/src/OrchardCore/OrchardCore.ContentManagement.Display/Models/BuildFieldDisplayContext.cs +++ b/src/OrchardCore/OrchardCore.ContentManagement.Display/Models/BuildFieldDisplayContext.cs @@ -1,4 +1,4 @@ -using OrchardCore.ContentManagement.Metadata.Models; +using OrchardCore.ContentManagement.Metadata.Models; using OrchardCore.DisplayManagement.Handlers; namespace OrchardCore.ContentManagement.Display.Models diff --git a/src/OrchardCore/OrchardCore.ContentManagement.Display/Models/BuildPartDisplayContext.cs b/src/OrchardCore/OrchardCore.ContentManagement.Display/Models/BuildPartDisplayContext.cs index b999e3795ae..d3ea3180f47 100644 --- a/src/OrchardCore/OrchardCore.ContentManagement.Display/Models/BuildPartDisplayContext.cs +++ b/src/OrchardCore/OrchardCore.ContentManagement.Display/Models/BuildPartDisplayContext.cs @@ -1,4 +1,4 @@ -using OrchardCore.ContentManagement.Metadata.Models; +using OrchardCore.ContentManagement.Metadata.Models; using OrchardCore.DisplayManagement.Handlers; namespace OrchardCore.ContentManagement.Display.Models diff --git a/src/OrchardCore/OrchardCore.ContentManagement.Display/Models/UpdateFieldEditorContext.cs b/src/OrchardCore/OrchardCore.ContentManagement.Display/Models/UpdateFieldEditorContext.cs index eb89318e769..d7d5f166b3e 100644 --- a/src/OrchardCore/OrchardCore.ContentManagement.Display/Models/UpdateFieldEditorContext.cs +++ b/src/OrchardCore/OrchardCore.ContentManagement.Display/Models/UpdateFieldEditorContext.cs @@ -1,4 +1,4 @@ -using OrchardCore.ContentManagement.Metadata.Models; +using OrchardCore.ContentManagement.Metadata.Models; using OrchardCore.DisplayManagement.Handlers; namespace OrchardCore.ContentManagement.Display.Models diff --git a/src/OrchardCore/OrchardCore.ContentManagement.GraphQL/Options/GraphQLContentOptions.cs b/src/OrchardCore/OrchardCore.ContentManagement.GraphQL/Options/GraphQLContentOptions.cs index 1af9f7fd9d4..8f997654552 100644 --- a/src/OrchardCore/OrchardCore.ContentManagement.GraphQL/Options/GraphQLContentOptions.cs +++ b/src/OrchardCore/OrchardCore.ContentManagement.GraphQL/Options/GraphQLContentOptions.cs @@ -158,7 +158,7 @@ internal bool ShouldSkip(ContentTypePartDefinition definition) public bool IsHiddenByDefault(string contentType) { - if (String.IsNullOrEmpty(contentType)) + if (string.IsNullOrEmpty(contentType)) { throw new ArgumentNullException(nameof(contentType)); } diff --git a/src/OrchardCore/OrchardCore.ContentManagement.GraphQL/Queries/ContentItemQuery.cs b/src/OrchardCore/OrchardCore.ContentManagement.GraphQL/Queries/ContentItemQuery.cs index 5e0bbaeb997..4e9c980f0fd 100644 --- a/src/OrchardCore/OrchardCore.ContentManagement.GraphQL/Queries/ContentItemQuery.cs +++ b/src/OrchardCore/OrchardCore.ContentManagement.GraphQL/Queries/ContentItemQuery.cs @@ -24,7 +24,7 @@ public ContentItemQuery(IHttpContextAccessor httpContextAccessor, S = localizer; } - public Task GetIdentifierAsync() => Task.FromResult(String.Empty); + public Task GetIdentifierAsync() => Task.FromResult(string.Empty); public Task BuildAsync(ISchema schema) { diff --git a/src/OrchardCore/OrchardCore.ContentManagement.GraphQL/Queries/ContentItemsFieldType.cs b/src/OrchardCore/OrchardCore.ContentManagement.GraphQL/Queries/ContentItemsFieldType.cs index d13ee2ccd3b..08b057790c0 100644 --- a/src/OrchardCore/OrchardCore.ContentManagement.GraphQL/Queries/ContentItemsFieldType.cs +++ b/src/OrchardCore/OrchardCore.ContentManagement.GraphQL/Queries/ContentItemsFieldType.cs @@ -305,17 +305,17 @@ private void BuildExpressionsInternal(JObject where, Junction expressions, strin if (values.Length == 1) { - if (String.Equals(values[0], "or", StringComparison.OrdinalIgnoreCase)) + if (string.Equals(values[0], "or", StringComparison.OrdinalIgnoreCase)) { expression = Expression.Disjunction(); BuildWhereExpressions(entry.Value, (Junction)expression, tableAlias, fieldContext, indexAliases); } - else if (String.Equals(values[0], "and", StringComparison.OrdinalIgnoreCase)) + else if (string.Equals(values[0], "and", StringComparison.OrdinalIgnoreCase)) { expression = Expression.Conjunction(); BuildWhereExpressions(entry.Value, (Junction)expression, tableAlias, fieldContext, indexAliases); } - else if (String.Equals(values[0], "not", StringComparison.OrdinalIgnoreCase)) + else if (string.Equals(values[0], "not", StringComparison.OrdinalIgnoreCase)) { expression = Expression.Conjunction(); BuildWhereExpressions(entry.Value, (Junction)expression, tableAlias, fieldContext, indexAliases); diff --git a/src/OrchardCore/OrchardCore.ContentManagement.GraphQL/Queries/Predicates/PredicateQuery.cs b/src/OrchardCore/OrchardCore.ContentManagement.GraphQL/Queries/Predicates/PredicateQuery.cs index 3aa4c4f4efd..3d97502ae82 100644 --- a/src/OrchardCore/OrchardCore.ContentManagement.GraphQL/Queries/Predicates/PredicateQuery.cs +++ b/src/OrchardCore/OrchardCore.ContentManagement.GraphQL/Queries/Predicates/PredicateQuery.cs @@ -86,7 +86,7 @@ public void SearchUsedAlias(string propertyPath) var values = propertyPath.Split('.', 2); // if empty prefix, use default (empty alias) - var aliasPath = values.Length == 1 ? String.Empty : values[0]; + var aliasPath = values.Length == 1 ? string.Empty : values[0]; // get the actual index from the alias if (_aliases.TryGetValue(aliasPath, out alias)) @@ -130,7 +130,7 @@ public string GetColumnName(string propertyPath) var values = propertyPath.Split('.', 2); // if empty prefix, use default (empty alias) - var aliasPath = values.Length == 1 ? String.Empty : values[0]; + var aliasPath = values.Length == 1 ? string.Empty : values[0]; // get the actual index from the alias if (_aliases.TryGetValue(aliasPath, out alias)) diff --git a/src/OrchardCore/OrchardCore.ContentManagement/Cache/ContentDefinitionCacheContextProvider.cs b/src/OrchardCore/OrchardCore.ContentManagement/Cache/ContentDefinitionCacheContextProvider.cs index c8f24fecdba..eccbaf6a66f 100644 --- a/src/OrchardCore/OrchardCore.ContentManagement/Cache/ContentDefinitionCacheContextProvider.cs +++ b/src/OrchardCore/OrchardCore.ContentManagement/Cache/ContentDefinitionCacheContextProvider.cs @@ -18,7 +18,7 @@ public ContentDefinitionCacheContextProvider(IContentDefinitionManager contentDe public async Task PopulateContextEntriesAsync(IEnumerable contexts, List entries) { - if (contexts.Any(ctx => String.Equals(ctx, "types", StringComparison.OrdinalIgnoreCase))) + if (contexts.Any(ctx => string.Equals(ctx, "types", StringComparison.OrdinalIgnoreCase))) { var identifier = await _contentDefinitionManager.GetIdentifierAsync(); entries.Add(new CacheContextEntry("types", identifier)); diff --git a/src/OrchardCore/OrchardCore.ContentManagement/ContentDefinitionManager.cs b/src/OrchardCore/OrchardCore.ContentManagement/ContentDefinitionManager.cs index 5d5503eab79..4781477d3ee 100644 --- a/src/OrchardCore/OrchardCore.ContentManagement/ContentDefinitionManager.cs +++ b/src/OrchardCore/OrchardCore.ContentManagement/ContentDefinitionManager.cs @@ -40,7 +40,7 @@ public ContentDefinitionManager( public ContentTypeDefinition LoadTypeDefinition(string name) { - if (String.IsNullOrEmpty(name)) + if (string.IsNullOrEmpty(name)) { throw new ArgumentException("Argument cannot be null or empty", nameof(name)); } @@ -49,7 +49,7 @@ public ContentTypeDefinition LoadTypeDefinition(string name) { var contentTypeDefinitionRecord = LoadContentDefinitionRecord() .ContentTypeDefinitionRecords - .FirstOrDefault(x => String.Equals(x.Name, name, StringComparison.OrdinalIgnoreCase)); + .FirstOrDefault(x => string.Equals(x.Name, name, StringComparison.OrdinalIgnoreCase)); _scopedTypeDefinitions[name] = typeDefinition = Build(contentTypeDefinitionRecord, LoadContentDefinitionRecord().ContentPartDefinitionRecords); }; @@ -59,7 +59,7 @@ public ContentTypeDefinition LoadTypeDefinition(string name) public ContentTypeDefinition GetTypeDefinition(string name) { - if (String.IsNullOrEmpty(name)) + if (string.IsNullOrEmpty(name)) { throw new ArgumentException("Argument cannot be null or empty", nameof(name)); } @@ -71,7 +71,7 @@ public ContentTypeDefinition GetTypeDefinition(string name) { var contentTypeDefinitionRecord = document .ContentTypeDefinitionRecords - .FirstOrDefault(x => String.Equals(x.Name, name, StringComparison.OrdinalIgnoreCase)); + .FirstOrDefault(x => string.Equals(x.Name, name, StringComparison.OrdinalIgnoreCase)); return Build(contentTypeDefinitionRecord, GetContentDefinitionRecord().ContentPartDefinitionRecords); }); @@ -83,7 +83,7 @@ public ContentPartDefinition LoadPartDefinition(string name) { _scopedPartDefinitions[name] = partDefinition = Build(LoadContentDefinitionRecord() .ContentPartDefinitionRecords - .FirstOrDefault(x => String.Equals(x.Name, name, StringComparison.OrdinalIgnoreCase))); + .FirstOrDefault(x => string.Equals(x.Name, name, StringComparison.OrdinalIgnoreCase))); }; return partDefinition; @@ -98,7 +98,7 @@ public ContentPartDefinition GetPartDefinition(string name) { return Build(document .ContentPartDefinitionRecords - .FirstOrDefault(x => String.Equals(x.Name, name, StringComparison.OrdinalIgnoreCase))); + .FirstOrDefault(x => string.Equals(x.Name, name, StringComparison.OrdinalIgnoreCase))); }); } @@ -136,7 +136,7 @@ public void StorePartDefinition(ContentPartDefinition contentPartDefinition) public void DeleteTypeDefinition(string name) { - var record = LoadContentDefinitionRecord().ContentTypeDefinitionRecords.FirstOrDefault(x => String.Equals(x.Name, name, StringComparison.OrdinalIgnoreCase)); + var record = LoadContentDefinitionRecord().ContentTypeDefinitionRecords.FirstOrDefault(x => string.Equals(x.Name, name, StringComparison.OrdinalIgnoreCase)); // deletes the content type record associated if (record != null) @@ -149,7 +149,7 @@ public void DeleteTypeDefinition(string name) public void DeletePartDefinition(string name) { // remove parts from current types - var typesWithPart = LoadTypeDefinitions().Where(typeDefinition => typeDefinition.Parts.Any(part => String.Equals(part.PartDefinition.Name, name, StringComparison.OrdinalIgnoreCase))); + var typesWithPart = LoadTypeDefinitions().Where(typeDefinition => typeDefinition.Parts.Any(part => string.Equals(part.PartDefinition.Name, name, StringComparison.OrdinalIgnoreCase))); foreach (var typeDefinition in typesWithPart) { @@ -157,7 +157,7 @@ public void DeletePartDefinition(string name) } // delete part - var record = LoadContentDefinitionRecord().ContentPartDefinitionRecords.FirstOrDefault(x => String.Equals(x.Name, name, StringComparison.OrdinalIgnoreCase)); + var record = LoadContentDefinitionRecord().ContentPartDefinitionRecords.FirstOrDefault(x => string.Equals(x.Name, name, StringComparison.OrdinalIgnoreCase)); if (record != null) { @@ -168,7 +168,7 @@ public void DeletePartDefinition(string name) private ContentTypeDefinitionRecord Acquire(ContentTypeDefinition contentTypeDefinition) { - var result = LoadContentDefinitionRecord().ContentTypeDefinitionRecords.FirstOrDefault(x => String.Equals(x.Name, contentTypeDefinition.Name, StringComparison.OrdinalIgnoreCase)); + var result = LoadContentDefinitionRecord().ContentTypeDefinitionRecords.FirstOrDefault(x => string.Equals(x.Name, contentTypeDefinition.Name, StringComparison.OrdinalIgnoreCase)); if (result == null) { result = new ContentTypeDefinitionRecord { Name = contentTypeDefinition.Name, DisplayName = contentTypeDefinition.DisplayName }; @@ -179,7 +179,7 @@ private ContentTypeDefinitionRecord Acquire(ContentTypeDefinition contentTypeDef private ContentPartDefinitionRecord Acquire(ContentPartDefinition contentPartDefinition) { - var result = LoadContentDefinitionRecord().ContentPartDefinitionRecords.FirstOrDefault(x => String.Equals(x.Name, contentPartDefinition.Name, StringComparison.OrdinalIgnoreCase)); + var result = LoadContentDefinitionRecord().ContentPartDefinitionRecords.FirstOrDefault(x => string.Equals(x.Name, contentPartDefinition.Name, StringComparison.OrdinalIgnoreCase)); if (result == null) { result = new ContentPartDefinitionRecord { Name = contentPartDefinition.Name, }; @@ -194,7 +194,7 @@ private static void Apply(ContentTypeDefinition model, ContentTypeDefinitionReco record.Settings = model.Settings; var toRemove = record.ContentTypePartDefinitionRecords - .Where(typePartDefinitionRecord => !model.Parts.Any(part => String.Equals(typePartDefinitionRecord.Name, part.Name, StringComparison.OrdinalIgnoreCase))) + .Where(typePartDefinitionRecord => !model.Parts.Any(part => string.Equals(typePartDefinitionRecord.Name, part.Name, StringComparison.OrdinalIgnoreCase))) .ToList(); foreach (var remove in toRemove) @@ -204,7 +204,7 @@ private static void Apply(ContentTypeDefinition model, ContentTypeDefinitionReco foreach (var part in model.Parts) { - var typePartRecord = record.ContentTypePartDefinitionRecords.FirstOrDefault(r => String.Equals(r.Name, part.Name, StringComparison.OrdinalIgnoreCase)); + var typePartRecord = record.ContentTypePartDefinitionRecords.FirstOrDefault(r => string.Equals(r.Name, part.Name, StringComparison.OrdinalIgnoreCase)); if (typePartRecord == null) { typePartRecord = new ContentTypePartDefinitionRecord @@ -230,7 +230,7 @@ private static void Apply(ContentPartDefinition model, ContentPartDefinitionReco record.Settings = model.Settings; var toRemove = record.ContentPartFieldDefinitionRecords - .Where(partFieldDefinitionRecord => !model.Fields.Any(partField => String.Equals(partFieldDefinitionRecord.Name, partField.Name, StringComparison.OrdinalIgnoreCase))) + .Where(partFieldDefinitionRecord => !model.Fields.Any(partField => string.Equals(partFieldDefinitionRecord.Name, partField.Name, StringComparison.OrdinalIgnoreCase))) .ToList(); foreach (var remove in toRemove) @@ -241,7 +241,7 @@ private static void Apply(ContentPartDefinition model, ContentPartDefinitionReco foreach (var field in model.Fields) { var fieldName = field.Name; - var partFieldRecord = record.ContentPartFieldDefinitionRecords.FirstOrDefault(r => String.Equals(r.Name, fieldName, StringComparison.OrdinalIgnoreCase)); + var partFieldRecord = record.ContentPartFieldDefinitionRecords.FirstOrDefault(r => string.Equals(r.Name, fieldName, StringComparison.OrdinalIgnoreCase)); if (partFieldRecord == null) { partFieldRecord = new ContentPartFieldDefinitionRecord @@ -270,7 +270,7 @@ private ContentTypeDefinition Build(ContentTypeDefinitionRecord source, IList Build(tp, partDefinitionRecords.FirstOrDefault(p => String.Equals(p.Name, tp.PartName, StringComparison.OrdinalIgnoreCase)))), + source.ContentTypePartDefinitionRecords.Select(tp => Build(tp, partDefinitionRecords.FirstOrDefault(p => string.Equals(p.Name, tp.PartName, StringComparison.OrdinalIgnoreCase)))), source.Settings); return contentTypeDefinition; diff --git a/src/OrchardCore/OrchardCore.ContentManagement/ContentHandleManager.cs b/src/OrchardCore/OrchardCore.ContentManagement/ContentHandleManager.cs index 5b97d563d8f..0b85e459d56 100644 --- a/src/OrchardCore/OrchardCore.ContentManagement/ContentHandleManager.cs +++ b/src/OrchardCore/OrchardCore.ContentManagement/ContentHandleManager.cs @@ -20,7 +20,7 @@ public async Task GetContentItemIdAsync(string handle) { var result = await provider.GetContentItemIdAsync(handle); - if (!String.IsNullOrEmpty(result)) + if (!string.IsNullOrEmpty(result)) { return result; } diff --git a/src/OrchardCore/OrchardCore.ContentManagement/DefaultContentManager.cs b/src/OrchardCore/OrchardCore.ContentManagement/DefaultContentManager.cs index cd7eb9f16ce..cacc8fde1e9 100644 --- a/src/OrchardCore/OrchardCore.ContentManagement/DefaultContentManager.cs +++ b/src/OrchardCore/OrchardCore.ContentManagement/DefaultContentManager.cs @@ -163,7 +163,7 @@ public async Task> GetAsync(IEnumerable content public async Task GetAsync(string contentItemId, VersionOptions options) { - if (String.IsNullOrEmpty(contentItemId)) + if (string.IsNullOrEmpty(contentItemId)) { return null; } @@ -597,7 +597,7 @@ protected async Task> BuildNewVersionsAsync(IEnumerable public async Task CreateAsync(ContentItem contentItem, VersionOptions options) { - if (String.IsNullOrEmpty(contentItem.ContentItemVersionId)) + if (string.IsNullOrEmpty(contentItem.ContentItemVersionId)) { contentItem.ContentItemVersionId = _idGenerator.GenerateUniqueId(contentItem); contentItem.Published = true; @@ -655,11 +655,11 @@ public async Task ImportAsync(IEnumerable contentItems) { // Preload all the versions for this batch from the database. var versionIds = batchedContentItems - .Where(x => !String.IsNullOrEmpty(x.ContentItemVersionId)) + .Where(x => !string.IsNullOrEmpty(x.ContentItemVersionId)) .Select(x => x.ContentItemVersionId); var itemIds = batchedContentItems - .Where(x => !String.IsNullOrEmpty(x.ContentItemId)) + .Where(x => !string.IsNullOrEmpty(x.ContentItemId)) .Select(x => x.ContentItemId); var existingContentItems = await _session @@ -668,7 +668,7 @@ public async Task ImportAsync(IEnumerable contentItems) (x.Latest || x.Published || x.ContentItemVersionId.IsIn(versionIds))) .ListAsync(); - var versionsToUpdate = existingContentItems.Where(c => versionIds.Any(v => String.Equals(v, c.ContentItemVersionId, StringComparison.OrdinalIgnoreCase))); + var versionsToUpdate = existingContentItems.Where(c => versionIds.Any(v => string.Equals(v, c.ContentItemVersionId, StringComparison.OrdinalIgnoreCase))); var versionsThatMaybeEvicted = existingContentItems.Except(versionsToUpdate); foreach (var version in existingContentItems) @@ -679,7 +679,7 @@ public async Task ImportAsync(IEnumerable contentItems) foreach (var importingItem in batchedContentItems) { ContentItem originalVersion = null; - if (!String.IsNullOrEmpty(importingItem.ContentItemVersionId)) + if (!string.IsNullOrEmpty(importingItem.ContentItemVersionId)) { if (importedVersionIds.Contains(importingItem.ContentItemVersionId)) { @@ -689,7 +689,7 @@ public async Task ImportAsync(IEnumerable contentItems) importedVersionIds.Add(importingItem.ContentItemVersionId); - originalVersion = versionsToUpdate.FirstOrDefault(x => String.Equals(x.ContentItemVersionId, importingItem.ContentItemVersionId, StringComparison.OrdinalIgnoreCase)); + originalVersion = versionsToUpdate.FirstOrDefault(x => string.Equals(x.ContentItemVersionId, importingItem.ContentItemVersionId, StringComparison.OrdinalIgnoreCase)); } if (originalVersion == null) @@ -699,16 +699,16 @@ public async Task ImportAsync(IEnumerable contentItems) await Handlers.InvokeAsync((handler, context) => handler.ImportingAsync(context), context, _logger); - var evictionVersions = versionsThatMaybeEvicted.Where(x => String.Equals(x.ContentItemId, importingItem.ContentItemId, StringComparison.OrdinalIgnoreCase)); + var evictionVersions = versionsThatMaybeEvicted.Where(x => string.Equals(x.ContentItemId, importingItem.ContentItemId, StringComparison.OrdinalIgnoreCase)); var result = await CreateContentItemVersionAsync(importingItem, evictionVersions); if (!result.Succeeded) { if (_logger.IsEnabled(LogLevel.Error)) { - _logger.LogError("Error importing content item version id '{ContentItemVersionId}' : '{Errors}'", importingItem?.ContentItemVersionId, String.Join(", ", result.Errors)); + _logger.LogError("Error importing content item version id '{ContentItemVersionId}' : '{Errors}'", importingItem?.ContentItemVersionId, string.Join(", ", result.Errors)); } - throw new ValidationException(String.Join(", ", result.Errors)); + throw new ValidationException(string.Join(", ", result.Errors)); } // Imported handlers will only be fired if the validation has been successful. @@ -750,16 +750,16 @@ public async Task ImportAsync(IEnumerable contentItems) await Handlers.InvokeAsync((handler, context) => handler.ImportingAsync(context), context, _logger); - var evictionVersions = versionsThatMaybeEvicted.Where(x => String.Equals(x.ContentItemId, importingItem.ContentItemId, StringComparison.OrdinalIgnoreCase)); + var evictionVersions = versionsThatMaybeEvicted.Where(x => string.Equals(x.ContentItemId, importingItem.ContentItemId, StringComparison.OrdinalIgnoreCase)); var result = await UpdateContentItemVersionAsync(originalVersion, importingItem, evictionVersions); if (!result.Succeeded) { if (_logger.IsEnabled(LogLevel.Error)) { - _logger.LogError("Error importing content item version id '{ContentItemVersionId}' : '{Errors}'", importingItem.ContentItemVersionId, String.Join(", ", result.Errors)); + _logger.LogError("Error importing content item version id '{ContentItemVersionId}' : '{Errors}'", importingItem.ContentItemVersionId, string.Join(", ", result.Errors)); } - throw new ValidationException(String.Join(", ", result.Errors)); + throw new ValidationException(string.Join(", ", result.Errors)); } // Imported handlers will only be fired if the validation has been successful. @@ -925,7 +925,7 @@ public async Task CloneAsync(ContentItem contentItem) private async Task CreateContentItemVersionAsync(ContentItem contentItem, IEnumerable evictionVersions = null) { - if (String.IsNullOrEmpty(contentItem.ContentItemId)) + if (string.IsNullOrEmpty(contentItem.ContentItemId)) { // NewAsync should be used to create new content items. throw new InvalidOperationException($"The content item is missing a '{nameof(ContentItem.ContentItemId)}'."); @@ -940,7 +940,7 @@ private async Task CreateContentItemVersionAsync(ContentI var owner = contentItem.Owner; var author = contentItem.Author; - if (String.IsNullOrEmpty(contentItem.ContentItemVersionId)) + if (string.IsNullOrEmpty(contentItem.ContentItemVersionId)) { contentItem.ContentItemVersionId = _idGenerator.GenerateUniqueId(contentItem); } @@ -1006,11 +1006,11 @@ private async Task CreateContentItemVersionAsync(ContentI // There is a risk here that the owner or author does not exist in the importing system. // We check that at least a value has been supplied, if not the owner property and author // property would be left as the user who has run this import. - if (!String.IsNullOrEmpty(owner)) + if (!string.IsNullOrEmpty(owner)) { contentItem.Owner = owner; } - if (!String.IsNullOrEmpty(author)) + if (!string.IsNullOrEmpty(author)) { contentItem.Author = author; } diff --git a/src/OrchardCore/OrchardCore.ContentManagement/GenericTypeActivator.cs b/src/OrchardCore/OrchardCore.ContentManagement/GenericTypeActivator.cs index 91d70fbbc94..8e076e701c2 100644 --- a/src/OrchardCore/OrchardCore.ContentManagement/GenericTypeActivator.cs +++ b/src/OrchardCore/OrchardCore.ContentManagement/GenericTypeActivator.cs @@ -1,4 +1,4 @@ -using System; +using System; namespace OrchardCore.ContentManagement { diff --git a/src/OrchardCore/OrchardCore.ContentManagement/Handlers/ContentFieldHandlerResolver.cs b/src/OrchardCore/OrchardCore.ContentManagement/Handlers/ContentFieldHandlerResolver.cs index 1943e6760b0..142a097aa9e 100644 --- a/src/OrchardCore/OrchardCore.ContentManagement/Handlers/ContentFieldHandlerResolver.cs +++ b/src/OrchardCore/OrchardCore.ContentManagement/Handlers/ContentFieldHandlerResolver.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Options; diff --git a/src/OrchardCore/OrchardCore.ContentTypes.Abstractions/Editors/ContentPartFieldDefinitionDisplayDriver.cs b/src/OrchardCore/OrchardCore.ContentTypes.Abstractions/Editors/ContentPartFieldDefinitionDisplayDriver.cs index 25d04cd2aed..2180e6bc0bc 100644 --- a/src/OrchardCore/OrchardCore.ContentTypes.Abstractions/Editors/ContentPartFieldDefinitionDisplayDriver.cs +++ b/src/OrchardCore/OrchardCore.ContentTypes.Abstractions/Editors/ContentPartFieldDefinitionDisplayDriver.cs @@ -14,7 +14,7 @@ protected override void BuildPrefix(ContentPartFieldDefinition model, string htm { Prefix = $"{model.PartDefinition.Name}.{model.Name}"; - if (!String.IsNullOrEmpty(htmlFieldPrefix)) + if (!string.IsNullOrEmpty(htmlFieldPrefix)) { Prefix = htmlFieldPrefix + "." + Prefix; } diff --git a/src/OrchardCore/OrchardCore.ContentTypes.Abstractions/Editors/ContentTypePartDefinitionDisplayDriver.cs b/src/OrchardCore/OrchardCore.ContentTypes.Abstractions/Editors/ContentTypePartDefinitionDisplayDriver.cs index eced7f0ac79..d52aeb7053a 100644 --- a/src/OrchardCore/OrchardCore.ContentTypes.Abstractions/Editors/ContentTypePartDefinitionDisplayDriver.cs +++ b/src/OrchardCore/OrchardCore.ContentTypes.Abstractions/Editors/ContentTypePartDefinitionDisplayDriver.cs @@ -11,7 +11,7 @@ protected override void BuildPrefix(ContentTypePartDefinition model, string html { Prefix = $"{model.ContentTypeDefinition.Name}.{model.PartDefinition.Name}"; - if (!String.IsNullOrEmpty(htmlFielPrefix)) + if (!string.IsNullOrEmpty(htmlFielPrefix)) { Prefix = htmlFielPrefix + "." + Prefix; } diff --git a/src/OrchardCore/OrchardCore.Contents.Core/AuthorizationServiceExtensions.cs b/src/OrchardCore/OrchardCore.Contents.Core/AuthorizationServiceExtensions.cs index e9ad8766356..7d815563884 100644 --- a/src/OrchardCore/OrchardCore.Contents.Core/AuthorizationServiceExtensions.cs +++ b/src/OrchardCore/OrchardCore.Contents.Core/AuthorizationServiceExtensions.cs @@ -34,7 +34,7 @@ public static Task AuthorizeContentTypeAsync(this IAuthorizationService se throw new ArgumentNullException(nameof(requiredPermission)); } - if (String.IsNullOrWhiteSpace(contentType)) + if (string.IsNullOrWhiteSpace(contentType)) { throw new ArgumentException($"{nameof(contentType)} cannot be empty."); } diff --git a/src/OrchardCore/OrchardCore.Contents.Core/ContentTypePermissionsHelper.cs b/src/OrchardCore/OrchardCore.Contents.Core/ContentTypePermissionsHelper.cs index d8094d7ac46..67cd92f0e68 100644 --- a/src/OrchardCore/OrchardCore.Contents.Core/ContentTypePermissionsHelper.cs +++ b/src/OrchardCore/OrchardCore.Contents.Core/ContentTypePermissionsHelper.cs @@ -71,8 +71,8 @@ public static Permission CreateDynamicPermission(Permission template, ContentTyp } return new Permission( - String.Format(template.Name, typeDefinition.Name), - String.Format(template.Description, typeDefinition.DisplayName), + string.Format(template.Name, typeDefinition.Name), + string.Format(template.Description, typeDefinition.DisplayName), (template.ImpliedBy ?? Array.Empty()).Where(t => t != null).Select(t => CreateDynamicPermission(t, typeDefinition)) ) { @@ -98,8 +98,8 @@ public static Permission CreateDynamicPermission(Permission template, string con } permission = new Permission( - String.Format(template.Name, contentType), - String.Format(template.Description, contentType), + string.Format(template.Name, contentType), + string.Format(template.Description, contentType), (template.ImpliedBy ?? Array.Empty()).Select(t => CreateDynamicPermission(t, contentType)) ); diff --git a/src/OrchardCore/OrchardCore.Contents.Core/Services/ContentItemFilterEngineModelBinder.cs b/src/OrchardCore/OrchardCore.Contents.Core/Services/ContentItemFilterEngineModelBinder.cs index 07aea5cf478..5d3b017a847 100644 --- a/src/OrchardCore/OrchardCore.Contents.Core/Services/ContentItemFilterEngineModelBinder.cs +++ b/src/OrchardCore/OrchardCore.Contents.Core/Services/ContentItemFilterEngineModelBinder.cs @@ -27,7 +27,7 @@ public Task BindModelAsync(ModelBindingContext bindingContext) if (valueProviderResult == ValueProviderResult.None) { - bindingContext.Result = ModelBindingResult.Success(_parser.Parse(String.Empty)); + bindingContext.Result = ModelBindingResult.Success(_parser.Parse(string.Empty)); return Task.CompletedTask; } diff --git a/src/OrchardCore/OrchardCore.Contents.TagHelpers/ContentLinkTagHelper.cs b/src/OrchardCore/OrchardCore.Contents.TagHelpers/ContentLinkTagHelper.cs index 7dca66fc163..6109a7eac97 100644 --- a/src/OrchardCore/OrchardCore.Contents.TagHelpers/ContentLinkTagHelper.cs +++ b/src/OrchardCore/OrchardCore.Contents.TagHelpers/ContentLinkTagHelper.cs @@ -85,7 +85,7 @@ public override async Task ProcessAsync(TagHelperContext tagHelperContext, TagHe contentItem = DisplayFor; var previewAspect = await _contentManager.PopulateAspectAsync(contentItem); - if (!String.IsNullOrEmpty(previewAspect.PreviewUrl)) + if (!string.IsNullOrEmpty(previewAspect.PreviewUrl)) { var previewUrl = previewAspect.PreviewUrl; if (!previewUrl.StartsWith("~/", StringComparison.OrdinalIgnoreCase)) @@ -176,7 +176,7 @@ public override async Task ProcessAsync(TagHelperContext tagHelperContext, TagHe if (output.TagMode == TagMode.SelfClosing && metadata != null) { output.TagMode = TagMode.StartTagAndEndTag; - if (!String.IsNullOrEmpty(contentItem.DisplayText)) + if (!string.IsNullOrEmpty(contentItem.DisplayText)) { output.Content.Append(contentItem.DisplayText); } diff --git a/src/OrchardCore/OrchardCore.Data.Abstractions/ServiceCollectionExtensions.cs b/src/OrchardCore/OrchardCore.Data.Abstractions/ServiceCollectionExtensions.cs index ad890292787..3c9926f1224 100644 --- a/src/OrchardCore/OrchardCore.Data.Abstractions/ServiceCollectionExtensions.cs +++ b/src/OrchardCore/OrchardCore.Data.Abstractions/ServiceCollectionExtensions.cs @@ -27,7 +27,7 @@ public static IServiceCollection TryAddDataProvider(this IServiceCollection serv if (entry.ImplementationInstance != null) { var databaseProvider = entry.ImplementationInstance as DatabaseProvider; - if (databaseProvider != null && String.Equals(databaseProvider.Name, name, StringComparison.OrdinalIgnoreCase)) + if (databaseProvider != null && string.Equals(databaseProvider.Name, name, StringComparison.OrdinalIgnoreCase)) { services.RemoveAt(i); } diff --git a/src/OrchardCore/OrchardCore.Data.Abstractions/ShellSettingsExtensions.cs b/src/OrchardCore/OrchardCore.Data.Abstractions/ShellSettingsExtensions.cs index 63b04d2ad9b..ab00b1465c6 100644 --- a/src/OrchardCore/OrchardCore.Data.Abstractions/ShellSettingsExtensions.cs +++ b/src/OrchardCore/OrchardCore.Data.Abstractions/ShellSettingsExtensions.cs @@ -40,7 +40,7 @@ public static string GetDocumentTable(this ShellSettings shellSettings) : shellSettings["DocumentTable"]) ?.Trim(); - if (String.IsNullOrEmpty(documentTable)) + if (string.IsNullOrEmpty(documentTable)) { documentTable = "Document"; } @@ -55,13 +55,13 @@ public static string GetTableNameSeparator(this ShellSettings shellSettings) : shellSettings["TableNameSeparator"]) ?.Trim(); - if (String.IsNullOrEmpty(tableNameSeparator)) + if (string.IsNullOrEmpty(tableNameSeparator)) { tableNameSeparator = "_"; } else if (tableNameSeparator == "NULL") { - tableNameSeparator = String.Empty; + tableNameSeparator = string.Empty; } else if (tableNameSeparator.Any(c => c != '_')) { @@ -78,7 +78,7 @@ public static string GetIdentityColumnSize(this ShellSettings shellSettings) : shellSettings["IdentityColumnSize"]) ?.Trim(); - if (String.IsNullOrEmpty(identityColumnSize)) + if (string.IsNullOrEmpty(identityColumnSize)) { identityColumnSize = !shellSettings.IsInitialized() ? nameof(Int64) : nameof(Int32); } diff --git a/src/OrchardCore/OrchardCore.Data.YesSql.Abstractions/DataMigrationExtensions.cs b/src/OrchardCore/OrchardCore.Data.YesSql.Abstractions/DataMigrationExtensions.cs index 7621693391e..bfe927b3cb3 100644 --- a/src/OrchardCore/OrchardCore.Data.YesSql.Abstractions/DataMigrationExtensions.cs +++ b/src/OrchardCore/OrchardCore.Data.YesSql.Abstractions/DataMigrationExtensions.cs @@ -93,7 +93,7 @@ private static (int Version, MethodInfo MethodInfo) GetUpdateMethod(MethodInfo m ? methodInfo.Name["UpdateFrom".Length..^"Async".Length] : methodInfo.Name["UpdateFrom".Length..]; - if (Int32.TryParse(version, out var versionValue)) + if (int.TryParse(version, out var versionValue)) { return (versionValue, methodInfo); } diff --git a/src/OrchardCore/OrchardCore.Data.YesSql.Abstractions/DefaultTableNameConvention.cs b/src/OrchardCore/OrchardCore.Data.YesSql.Abstractions/DefaultTableNameConvention.cs index eadc36728fe..0e0df520e1e 100644 --- a/src/OrchardCore/OrchardCore.Data.YesSql.Abstractions/DefaultTableNameConvention.cs +++ b/src/OrchardCore/OrchardCore.Data.YesSql.Abstractions/DefaultTableNameConvention.cs @@ -11,7 +11,7 @@ public class DefaultTableNameConvention : ITableNameConvention public string GetIndexTable(Type type, string collection = null) { - if (String.IsNullOrEmpty(collection)) + if (string.IsNullOrEmpty(collection)) { return type.Name; } @@ -21,7 +21,7 @@ public string GetIndexTable(Type type, string collection = null) public string GetDocumentTable(string collection = null) { - if (String.IsNullOrEmpty(collection)) + if (string.IsNullOrEmpty(collection)) { return _options.DocumentTable; } diff --git a/src/OrchardCore/OrchardCore.Data.YesSql/DbConnectionValidator.cs b/src/OrchardCore/OrchardCore.Data.YesSql/DbConnectionValidator.cs index c46a0e3a7ac..b6626e3cb24 100644 --- a/src/OrchardCore/OrchardCore.Data.YesSql/DbConnectionValidator.cs +++ b/src/OrchardCore/OrchardCore.Data.YesSql/DbConnectionValidator.cs @@ -54,7 +54,7 @@ public async Task ValidateAsync(DbConnectionValidat throw new ArgumentNullException(nameof(context)); } - if (String.IsNullOrWhiteSpace(context.DatabaseProvider)) + if (string.IsNullOrWhiteSpace(context.DatabaseProvider)) { return DbConnectionValidatorResult.NoProvider; } @@ -76,7 +76,7 @@ public async Task ValidateAsync(DbConnectionValidat connectionString = SqliteHelper.GetConnectionString(_sqliteOptions, _shellOptions, context.ShellName); } - if (String.IsNullOrWhiteSpace(connectionString)) + if (string.IsNullOrWhiteSpace(connectionString)) { return DbConnectionValidatorResult.InvalidConnection; } @@ -211,8 +211,8 @@ private static ISqlDialect GetSqlDialect(string databaseProvider) private static ISqlBuilder GetSqlBuilder(ISqlDialect sqlDialect, string tablePrefix, string tableNameSeparator) { - var prefix = String.Empty; - if (!String.IsNullOrWhiteSpace(tablePrefix)) + var prefix = string.Empty; + if (!string.IsNullOrWhiteSpace(tablePrefix)) { prefix = tablePrefix.Trim() + tableNameSeparator; } diff --git a/src/OrchardCore/OrchardCore.Data.YesSql/Migration/DataMigrationManager.cs b/src/OrchardCore/OrchardCore.Data.YesSql/Migration/DataMigrationManager.cs index 53338ba9f52..7cf25481b5e 100644 --- a/src/OrchardCore/OrchardCore.Data.YesSql/Migration/DataMigrationManager.cs +++ b/src/OrchardCore/OrchardCore.Data.YesSql/Migration/DataMigrationManager.cs @@ -292,7 +292,7 @@ private static Tuple GetUpdateMethod(MethodInfo methodInfo) ? methodInfo.Name.Substring(updateFromPrefix.Length, methodInfo.Name.Length - updateFromPrefix.Length - asyncSuffix.Length) : methodInfo.Name[updateFromPrefix.Length..]; - if (Int32.TryParse(version, out var versionValue)) + if (int.TryParse(version, out var versionValue)) { return new Tuple(versionValue, methodInfo); } diff --git a/src/OrchardCore/OrchardCore.Data.YesSql/OrchardCoreBuilderExtensions.cs b/src/OrchardCore/OrchardCore.Data.YesSql/OrchardCoreBuilderExtensions.cs index c497930b20f..3c588a89324 100644 --- a/src/OrchardCore/OrchardCore.Data.YesSql/OrchardCoreBuilderExtensions.cs +++ b/src/OrchardCore/OrchardCore.Data.YesSql/OrchardCoreBuilderExtensions.cs @@ -97,7 +97,7 @@ public static OrchardCoreBuilder AddDataAccess(this OrchardCoreBuilder builder) throw new ArgumentException("Unknown database provider: " + shellSettings["DatabaseProvider"]); } - if (!String.IsNullOrWhiteSpace(shellSettings["TablePrefix"])) + if (!string.IsNullOrWhiteSpace(shellSettings["TablePrefix"])) { var tablePrefix = shellSettings["TablePrefix"].Trim() + databaseTableOptions.TableNameSeparator; diff --git a/src/OrchardCore/OrchardCore.Data.YesSql/Removing/ShellDbTablesInfo.cs b/src/OrchardCore/OrchardCore.Data.YesSql/Removing/ShellDbTablesInfo.cs index 121cdcb8d04..e4604b38fbb 100644 --- a/src/OrchardCore/OrchardCore.Data.YesSql/Removing/ShellDbTablesInfo.cs +++ b/src/OrchardCore/OrchardCore.Data.YesSql/Removing/ShellDbTablesInfo.cs @@ -141,7 +141,7 @@ public void RemoveMapIndexTables() var indexTypeName = index.Type.Name; var indexTable = TableNameConvention.GetIndexTable(index.Type, index.Collection); - if (String.IsNullOrEmpty(Dialect.CascadeConstraintsString)) + if (string.IsNullOrEmpty(Dialect.CascadeConstraintsString)) { DropForeignKey(indexTable, "FK_" + (index.Collection ?? "") + indexTypeName); } @@ -158,7 +158,7 @@ public void RemoveReduceIndexTables() var documentTable = TableNameConvention.GetDocumentTable(index.Collection); var bridgeTable = indexTable + "_" + documentTable; - if (String.IsNullOrEmpty(Dialect.CascadeConstraintsString)) + if (string.IsNullOrEmpty(Dialect.CascadeConstraintsString)) { DropForeignKey(bridgeTable, "FK_" + bridgeTable + "_Id"); DropForeignKey(bridgeTable, "FK_" + bridgeTable + "_DocumentId"); @@ -173,7 +173,7 @@ public void RemoveDocumentTables() { // Always try to remove the main 'Document' table that may have been // auto created on 'YesSql' side, even if no document was persisted. - DocumentTables.Add(TableNameConvention.GetDocumentTable(String.Empty)); + DocumentTables.Add(TableNameConvention.GetDocumentTable(string.Empty)); foreach (var name in DocumentTables) { diff --git a/src/OrchardCore/OrchardCore.Deployment.Abstractions/DeploymentStep.cs b/src/OrchardCore/OrchardCore.Deployment.Abstractions/DeploymentStep.cs index e8a4ccfc281..76e754f6a64 100644 --- a/src/OrchardCore/OrchardCore.Deployment.Abstractions/DeploymentStep.cs +++ b/src/OrchardCore/OrchardCore.Deployment.Abstractions/DeploymentStep.cs @@ -1,4 +1,4 @@ -namespace OrchardCore.Deployment +namespace OrchardCore.Deployment { public abstract class DeploymentStep { diff --git a/src/OrchardCore/OrchardCore.Deployment.Abstractions/DeploymentTarget.cs b/src/OrchardCore/OrchardCore.Deployment.Abstractions/DeploymentTarget.cs index 03ec572ea13..4d586f28732 100644 --- a/src/OrchardCore/OrchardCore.Deployment.Abstractions/DeploymentTarget.cs +++ b/src/OrchardCore/OrchardCore.Deployment.Abstractions/DeploymentTarget.cs @@ -1,4 +1,4 @@ -using Microsoft.AspNetCore.Routing; +using Microsoft.AspNetCore.Routing; using Microsoft.Extensions.Localization; namespace OrchardCore.Deployment diff --git a/src/OrchardCore/OrchardCore.Deployment.Abstractions/IDeploymentSource.cs b/src/OrchardCore/OrchardCore.Deployment.Abstractions/IDeploymentSource.cs index 67e92958412..cf1678ff261 100644 --- a/src/OrchardCore/OrchardCore.Deployment.Abstractions/IDeploymentSource.cs +++ b/src/OrchardCore/OrchardCore.Deployment.Abstractions/IDeploymentSource.cs @@ -1,4 +1,4 @@ -using System.Threading.Tasks; +using System.Threading.Tasks; namespace OrchardCore.Deployment { diff --git a/src/OrchardCore/OrchardCore.Deployment.Abstractions/IDeploymentTargetProvider.cs b/src/OrchardCore/OrchardCore.Deployment.Abstractions/IDeploymentTargetProvider.cs index 158ab47f3dc..e775dba848f 100644 --- a/src/OrchardCore/OrchardCore.Deployment.Abstractions/IDeploymentTargetProvider.cs +++ b/src/OrchardCore/OrchardCore.Deployment.Abstractions/IDeploymentTargetProvider.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.Threading.Tasks; namespace OrchardCore.Deployment diff --git a/src/OrchardCore/OrchardCore.Deployment.Core/Mvc/DeleteFileResultFilter.cs b/src/OrchardCore/OrchardCore.Deployment.Core/Mvc/DeleteFileResultFilter.cs index ae730155ba9..59e5ccd77b9 100644 --- a/src/OrchardCore/OrchardCore.Deployment.Core/Mvc/DeleteFileResultFilter.cs +++ b/src/OrchardCore/OrchardCore.Deployment.Core/Mvc/DeleteFileResultFilter.cs @@ -1,4 +1,4 @@ -using System.IO; +using System.IO; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Filters; diff --git a/src/OrchardCore/OrchardCore.Deployment.Core/ServiceCollectionExtensions.cs b/src/OrchardCore/OrchardCore.Deployment.Core/ServiceCollectionExtensions.cs index 1056adb408b..0ecda53e797 100644 --- a/src/OrchardCore/OrchardCore.Deployment.Core/ServiceCollectionExtensions.cs +++ b/src/OrchardCore/OrchardCore.Deployment.Core/ServiceCollectionExtensions.cs @@ -1,4 +1,4 @@ -using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.DependencyInjection; using OrchardCore.Deployment.Core.Services; using OrchardCore.Deployment.Services; diff --git a/src/OrchardCore/OrchardCore.DisplayManagement.Abstractions/ModelBinding/IUpdateModelAccessor.cs b/src/OrchardCore/OrchardCore.DisplayManagement.Abstractions/ModelBinding/IUpdateModelAccessor.cs index 217f46f39cc..2adeb7df6ae 100644 --- a/src/OrchardCore/OrchardCore.DisplayManagement.Abstractions/ModelBinding/IUpdateModelAccessor.cs +++ b/src/OrchardCore/OrchardCore.DisplayManagement.Abstractions/ModelBinding/IUpdateModelAccessor.cs @@ -1,4 +1,4 @@ -namespace OrchardCore.DisplayManagement.ModelBinding +namespace OrchardCore.DisplayManagement.ModelBinding { public interface IUpdateModelAccessor { diff --git a/src/OrchardCore/OrchardCore.DisplayManagement.Liquid/Cache/CacheTag.cs b/src/OrchardCore/OrchardCore.DisplayManagement.Liquid/Cache/CacheTag.cs index 4316ea0de8a..5a3cac938dc 100644 --- a/src/OrchardCore/OrchardCore.DisplayManagement.Liquid/Cache/CacheTag.cs +++ b/src/OrchardCore/OrchardCore.DisplayManagement.Liquid/Cache/CacheTag.cs @@ -113,8 +113,8 @@ The contents of the cache block will not be cached. var debugContent = new StringWriter(); debugContent.WriteLine(); debugContent.WriteLine($"