diff --git a/src/Umbraco.Cms.Api.Common/Configuration/ConfigureOpenIddict.cs b/src/Umbraco.Cms.Api.Common/Configuration/ConfigureOpenIddict.cs index f428957bd9..8751cc1bb9 100644 --- a/src/Umbraco.Cms.Api.Common/Configuration/ConfigureOpenIddict.cs +++ b/src/Umbraco.Cms.Api.Common/Configuration/ConfigureOpenIddict.cs @@ -4,7 +4,7 @@ using Umbraco.Cms.Core.Configuration.Models; namespace Umbraco.Cms.Api.Common.Configuration; -internal class ConfigureOpenIddict : IConfigureOptions +internal sealed class ConfigureOpenIddict : IConfigureOptions { private readonly IOptions _globalSettings; diff --git a/src/Umbraco.Cms.Api.Common/Json/NamedSystemTextJsonInputFormatter.cs b/src/Umbraco.Cms.Api.Common/Json/NamedSystemTextJsonInputFormatter.cs index 1ae57bd8c4..0a3a6dd8be 100644 --- a/src/Umbraco.Cms.Api.Common/Json/NamedSystemTextJsonInputFormatter.cs +++ b/src/Umbraco.Cms.Api.Common/Json/NamedSystemTextJsonInputFormatter.cs @@ -4,7 +4,7 @@ using Microsoft.Extensions.Logging; namespace Umbraco.Cms.Api.Common.Json; -internal class NamedSystemTextJsonInputFormatter : SystemTextJsonInputFormatter +internal sealed class NamedSystemTextJsonInputFormatter : SystemTextJsonInputFormatter { private readonly string _jsonOptionsName; diff --git a/src/Umbraco.Cms.Api.Common/Json/NamedSystemTextJsonOutputFormatter.cs b/src/Umbraco.Cms.Api.Common/Json/NamedSystemTextJsonOutputFormatter.cs index bd1b17b81d..c78e5b8ef9 100644 --- a/src/Umbraco.Cms.Api.Common/Json/NamedSystemTextJsonOutputFormatter.cs +++ b/src/Umbraco.Cms.Api.Common/Json/NamedSystemTextJsonOutputFormatter.cs @@ -3,8 +3,7 @@ using Microsoft.AspNetCore.Mvc.Formatters; namespace Umbraco.Cms.Api.Common.Json; - -internal class NamedSystemTextJsonOutputFormatter : SystemTextJsonOutputFormatter +internal sealed class NamedSystemTextJsonOutputFormatter : SystemTextJsonOutputFormatter { private readonly string _jsonOptionsName; diff --git a/src/Umbraco.Cms.Api.Delivery/Configuration/ConfigureUmbracoMemberAuthenticationDeliveryApiSwaggerGenOptions.cs b/src/Umbraco.Cms.Api.Delivery/Configuration/ConfigureUmbracoMemberAuthenticationDeliveryApiSwaggerGenOptions.cs index 5eaa75002c..3161105dca 100644 --- a/src/Umbraco.Cms.Api.Delivery/Configuration/ConfigureUmbracoMemberAuthenticationDeliveryApiSwaggerGenOptions.cs +++ b/src/Umbraco.Cms.Api.Delivery/Configuration/ConfigureUmbracoMemberAuthenticationDeliveryApiSwaggerGenOptions.cs @@ -26,7 +26,7 @@ public class ConfigureUmbracoMemberAuthenticationDeliveryApiSwaggerGenOptions : options.OperationFilter(); } - private class DeliveryApiSecurityFilter : SwaggerFilterBase, IOperationFilter, IDocumentFilter + private sealed class DeliveryApiSecurityFilter : SwaggerFilterBase, IOperationFilter, IDocumentFilter { public void Apply(OpenApiOperation operation, OperationFilterContext context) { diff --git a/src/Umbraco.Cms.Api.Delivery/Filters/ContextualizeFromAcceptHeadersAttribute.cs b/src/Umbraco.Cms.Api.Delivery/Filters/ContextualizeFromAcceptHeadersAttribute.cs index aaa7dc8d4f..da8e9eeea0 100644 --- a/src/Umbraco.Cms.Api.Delivery/Filters/ContextualizeFromAcceptHeadersAttribute.cs +++ b/src/Umbraco.Cms.Api.Delivery/Filters/ContextualizeFromAcceptHeadersAttribute.cs @@ -13,7 +13,7 @@ internal sealed class ContextualizeFromAcceptHeadersAttribute : TypeFilterAttrib { } - private class LocalizeFromAcceptLanguageHeaderAttributeFilter : IActionFilter + private sealed class LocalizeFromAcceptLanguageHeaderAttributeFilter : IActionFilter { private readonly IRequestCultureService _requestCultureService; private readonly IRequestSegmmentService _requestSegmentService; diff --git a/src/Umbraco.Cms.Api.Delivery/Filters/DeliveryApiAccessAttribute.cs b/src/Umbraco.Cms.Api.Delivery/Filters/DeliveryApiAccessAttribute.cs index 01f0b04074..350b73112f 100644 --- a/src/Umbraco.Cms.Api.Delivery/Filters/DeliveryApiAccessAttribute.cs +++ b/src/Umbraco.Cms.Api.Delivery/Filters/DeliveryApiAccessAttribute.cs @@ -11,7 +11,7 @@ internal sealed class DeliveryApiAccessAttribute : TypeFilterAttribute { } - private class DeliveryApiAccessFilter : IActionFilter + private sealed class DeliveryApiAccessFilter : IActionFilter { private readonly IApiAccessService _apiAccessService; private readonly IRequestPreviewService _requestPreviewService; diff --git a/src/Umbraco.Cms.Api.Delivery/Filters/DeliveryApiMediaAccessAttribute.cs b/src/Umbraco.Cms.Api.Delivery/Filters/DeliveryApiMediaAccessAttribute.cs index e6dacce2c1..ac761e3be0 100644 --- a/src/Umbraco.Cms.Api.Delivery/Filters/DeliveryApiMediaAccessAttribute.cs +++ b/src/Umbraco.Cms.Api.Delivery/Filters/DeliveryApiMediaAccessAttribute.cs @@ -11,7 +11,7 @@ internal sealed class DeliveryApiMediaAccessAttribute : TypeFilterAttribute { } - private class DeliveryApiMediaAccessFilter : IActionFilter + private sealed class DeliveryApiMediaAccessFilter : IActionFilter { private readonly IApiAccessService _apiAccessService; diff --git a/src/Umbraco.Cms.Api.Delivery/Filters/ValidateStartItemAttribute.cs b/src/Umbraco.Cms.Api.Delivery/Filters/ValidateStartItemAttribute.cs index 54f2b06b14..8373a51ce4 100644 --- a/src/Umbraco.Cms.Api.Delivery/Filters/ValidateStartItemAttribute.cs +++ b/src/Umbraco.Cms.Api.Delivery/Filters/ValidateStartItemAttribute.cs @@ -12,7 +12,7 @@ internal sealed class ValidateStartItemAttribute : TypeFilterAttribute { } - private class ValidateStartItemFilter : IActionFilter + private sealed class ValidateStartItemFilter : IActionFilter { private readonly IRequestStartItemProviderAccessor _requestStartItemProviderAccessor; diff --git a/src/Umbraco.Cms.Api.Delivery/Rendering/RequestContextOutputExpansionStrategyV2.cs b/src/Umbraco.Cms.Api.Delivery/Rendering/RequestContextOutputExpansionStrategyV2.cs index 6cc2100e93..e1a29b3ec7 100644 --- a/src/Umbraco.Cms.Api.Delivery/Rendering/RequestContextOutputExpansionStrategyV2.cs +++ b/src/Umbraco.Cms.Api.Delivery/Rendering/RequestContextOutputExpansionStrategyV2.cs @@ -124,7 +124,7 @@ internal sealed class RequestContextOutputExpansionStrategyV2 : IOutputExpansion private object? GetPropertyValue(IPublishedProperty property) => _propertyRenderer.GetPropertyValue(property, _expandProperties.Peek() is not null); - private class Node + private sealed class Node { public string Key { get; private set; } = string.Empty; diff --git a/src/Umbraco.Cms.Api.Management/DependencyInjection/BackOfficeAuthBuilderExtensions.cs b/src/Umbraco.Cms.Api.Management/DependencyInjection/BackOfficeAuthBuilderExtensions.cs index 5ddb98b570..b633f7bdd6 100644 --- a/src/Umbraco.Cms.Api.Management/DependencyInjection/BackOfficeAuthBuilderExtensions.cs +++ b/src/Umbraco.Cms.Api.Management/DependencyInjection/BackOfficeAuthBuilderExtensions.cs @@ -79,7 +79,7 @@ public static class BackOfficeAuthBuilderExtensions } } -internal class BackofficePipelineFilter : UmbracoPipelineFilter +internal sealed class BackofficePipelineFilter : UmbracoPipelineFilter { public BackofficePipelineFilter(string name) : base(name) diff --git a/src/Umbraco.Cms.Api.Management/Factories/PackagePresentationFactory.cs b/src/Umbraco.Cms.Api.Management/Factories/PackagePresentationFactory.cs index 960b2fdbcd..f8e6eaf790 100644 --- a/src/Umbraco.Cms.Api.Management/Factories/PackagePresentationFactory.cs +++ b/src/Umbraco.Cms.Api.Management/Factories/PackagePresentationFactory.cs @@ -13,7 +13,7 @@ using Umbraco.Extensions; namespace Umbraco.Cms.Api.Management.Factories; -internal class PackagePresentationFactory : IPackagePresentationFactory +internal sealed class PackagePresentationFactory : IPackagePresentationFactory { private readonly IUmbracoMapper _umbracoMapper; private readonly IRuntimeState _runtimeState; diff --git a/src/Umbraco.Cms.Api.Management/Factories/WebhookPresentationFactory.cs b/src/Umbraco.Cms.Api.Management/Factories/WebhookPresentationFactory.cs index 95a69dfeb5..a063a8e228 100644 --- a/src/Umbraco.Cms.Api.Management/Factories/WebhookPresentationFactory.cs +++ b/src/Umbraco.Cms.Api.Management/Factories/WebhookPresentationFactory.cs @@ -8,7 +8,7 @@ using Umbraco.Cms.Core.Webhooks; namespace Umbraco.Cms.Api.Management.Factories; -internal class WebhookPresentationFactory : IWebhookPresentationFactory +internal sealed class WebhookPresentationFactory : IWebhookPresentationFactory { private readonly WebhookEventCollection _webhookEventCollection; private readonly IHostingEnvironment _hostingEnvironment; diff --git a/src/Umbraco.Cms.Api.Management/Filters/AppendEventMessagesAttribute.cs b/src/Umbraco.Cms.Api.Management/Filters/AppendEventMessagesAttribute.cs index d4333ece06..e13594ed71 100644 --- a/src/Umbraco.Cms.Api.Management/Filters/AppendEventMessagesAttribute.cs +++ b/src/Umbraco.Cms.Api.Management/Filters/AppendEventMessagesAttribute.cs @@ -21,7 +21,7 @@ public sealed class AppendEventMessagesAttribute : TypeFilterAttribute { } - private class AppendEventMessagesFilter : IActionFilter + private sealed class AppendEventMessagesFilter : IActionFilter { private readonly IEventMessagesFactory _eventMessagesFactory; private readonly IJsonSerializer _jsonSerializer; diff --git a/src/Umbraco.Cms.Api.Management/Filters/UserPasswordEnsureMinimumResponseTimeAttribute.cs b/src/Umbraco.Cms.Api.Management/Filters/UserPasswordEnsureMinimumResponseTimeAttribute.cs index ab4b1fcc82..dd60a73d21 100644 --- a/src/Umbraco.Cms.Api.Management/Filters/UserPasswordEnsureMinimumResponseTimeAttribute.cs +++ b/src/Umbraco.Cms.Api.Management/Filters/UserPasswordEnsureMinimumResponseTimeAttribute.cs @@ -4,14 +4,14 @@ using Umbraco.Cms.Core.Configuration.Models; namespace Umbraco.Cms.Api.Management.Filters; -internal class UserPasswordEnsureMinimumResponseTimeAttribute : TypeFilterAttribute +internal sealed class UserPasswordEnsureMinimumResponseTimeAttribute : TypeFilterAttribute { public UserPasswordEnsureMinimumResponseTimeAttribute() : base(typeof(UserPasswordEnsureMinimumResponseTimeFilter)) { } - private class UserPasswordEnsureMinimumResponseTimeFilter : EnsureMinimumResponseTimeFilter + private sealed class UserPasswordEnsureMinimumResponseTimeFilter : EnsureMinimumResponseTimeFilter { public UserPasswordEnsureMinimumResponseTimeFilter(IOptions options) : base(options.Value.MinimumResponseTime) diff --git a/src/Umbraco.Cms.Api.Management/Mapping/SectionMapper.cs b/src/Umbraco.Cms.Api.Management/Mapping/SectionMapper.cs index 41db2123e3..d125fcd735 100644 --- a/src/Umbraco.Cms.Api.Management/Mapping/SectionMapper.cs +++ b/src/Umbraco.Cms.Api.Management/Mapping/SectionMapper.cs @@ -45,7 +45,7 @@ public static class SectionMapper return name; } - private class SectionMapping + private sealed class SectionMapping { public required string Alias { get; init; } diff --git a/src/Umbraco.Cms.Api.Management/OpenApi/BackOfficeSecurityRequirementsOperationFilter.cs b/src/Umbraco.Cms.Api.Management/OpenApi/BackOfficeSecurityRequirementsOperationFilter.cs index 5e5f3f8653..d7b18acd93 100644 --- a/src/Umbraco.Cms.Api.Management/OpenApi/BackOfficeSecurityRequirementsOperationFilter.cs +++ b/src/Umbraco.Cms.Api.Management/OpenApi/BackOfficeSecurityRequirementsOperationFilter.cs @@ -2,7 +2,7 @@ using Umbraco.Cms.Api.Management.DependencyInjection; namespace Umbraco.Cms.Api.Management.OpenApi; -internal class BackOfficeSecurityRequirementsOperationFilter : BackOfficeSecurityRequirementsOperationFilterBase +internal sealed class BackOfficeSecurityRequirementsOperationFilter : BackOfficeSecurityRequirementsOperationFilterBase { protected override string ApiName => ManagementApiConfiguration.ApiName; } diff --git a/src/Umbraco.Cms.Api.Management/OpenApi/NotificationHeaderFilter.cs b/src/Umbraco.Cms.Api.Management/OpenApi/NotificationHeaderFilter.cs index bee1910f2c..f11c350aae 100644 --- a/src/Umbraco.Cms.Api.Management/OpenApi/NotificationHeaderFilter.cs +++ b/src/Umbraco.Cms.Api.Management/OpenApi/NotificationHeaderFilter.cs @@ -6,7 +6,7 @@ using Umbraco.Cms.Core; namespace Umbraco.Cms.Api.Management.OpenApi; -internal class NotificationHeaderFilter : IOperationFilter +internal sealed class NotificationHeaderFilter : IOperationFilter { public void Apply(OpenApiOperation operation, OperationFilterContext context) { diff --git a/src/Umbraco.Cms.Api.Management/OpenApi/ReponseHeaderOperationFilter.cs b/src/Umbraco.Cms.Api.Management/OpenApi/ReponseHeaderOperationFilter.cs index e579fe2ce9..e639a64091 100644 --- a/src/Umbraco.Cms.Api.Management/OpenApi/ReponseHeaderOperationFilter.cs +++ b/src/Umbraco.Cms.Api.Management/OpenApi/ReponseHeaderOperationFilter.cs @@ -7,7 +7,7 @@ using Umbraco.Extensions; namespace Umbraco.Cms.Api.Management.OpenApi; -internal class ResponseHeaderOperationFilter : IOperationFilter +internal sealed class ResponseHeaderOperationFilter : IOperationFilter { public void Apply(OpenApiOperation operation, OperationFilterContext context) { @@ -29,7 +29,7 @@ internal class ResponseHeaderOperationFilter : IOperationFilter } } - private void SetHeader(OpenApiResponse value, string headerName, string description, string type, string? format = null) + private static void SetHeader(OpenApiResponse value, string headerName, string description, string type, string? format = null) { if (value.Headers is null) diff --git a/src/Umbraco.Cms.Api.Management/Security/BackOfficeAuthenticationBuilder.cs b/src/Umbraco.Cms.Api.Management/Security/BackOfficeAuthenticationBuilder.cs index 0c00fa7e51..7729510029 100644 --- a/src/Umbraco.Cms.Api.Management/Security/BackOfficeAuthenticationBuilder.cs +++ b/src/Umbraco.Cms.Api.Management/Security/BackOfficeAuthenticationBuilder.cs @@ -61,7 +61,7 @@ public class BackOfficeAuthenticationBuilder : AuthenticationBuilder // TODO: We could override and throw NotImplementedException for other methods? // Ensures that the sign in scheme is always the Umbraco back office external type - internal class EnsureBackOfficeScheme : IPostConfigureOptions + internal sealed class EnsureBackOfficeScheme : IPostConfigureOptions where TOptions : RemoteAuthenticationOptions { public void PostConfigure(string? name, TOptions options) diff --git a/src/Umbraco.Cms.Api.Management/Security/BackOfficeSecureDataFormat.cs b/src/Umbraco.Cms.Api.Management/Security/BackOfficeSecureDataFormat.cs index d2e0e799a8..b8f7367946 100644 --- a/src/Umbraco.Cms.Api.Management/Security/BackOfficeSecureDataFormat.cs +++ b/src/Umbraco.Cms.Api.Management/Security/BackOfficeSecureDataFormat.cs @@ -7,7 +7,7 @@ namespace Umbraco.Cms.Api.Management.Security; /// /// Custom secure format that ensures the Identity in the ticket is verified /// -internal class BackOfficeSecureDataFormat : ISecureDataFormat +internal sealed class BackOfficeSecureDataFormat : ISecureDataFormat { private readonly TimeSpan _loginTimeout; private readonly ISecureDataFormat _ticketDataFormat; diff --git a/src/Umbraco.Core/Cache/PartialViewCacheInvalidators/NoopMemberPartialViewCacheInvalidator.cs b/src/Umbraco.Core/Cache/PartialViewCacheInvalidators/NoopMemberPartialViewCacheInvalidator.cs index 9b0b69ea6b..fa7bcb596e 100644 --- a/src/Umbraco.Core/Cache/PartialViewCacheInvalidators/NoopMemberPartialViewCacheInvalidator.cs +++ b/src/Umbraco.Core/Cache/PartialViewCacheInvalidators/NoopMemberPartialViewCacheInvalidator.cs @@ -7,7 +7,7 @@ namespace Umbraco.Cms.Core.Cache.PartialViewCacheInvalidators; /// The default implementation is added in Umbraco.Web.Website, but we need this to ensure we have a service /// registered for this interface even in headless setups). /// -internal class NoopMemberPartialViewCacheInvalidator : IMemberPartialViewCacheInvalidator +internal sealed class NoopMemberPartialViewCacheInvalidator : IMemberPartialViewCacheInvalidator { /// public void ClearPartialViewCacheItems(IEnumerable memberIds) diff --git a/src/Umbraco.Core/Composing/ComposerGraph.cs b/src/Umbraco.Core/Composing/ComposerGraph.cs index a4e8f189f7..0c376befd5 100644 --- a/src/Umbraco.Core/Composing/ComposerGraph.cs +++ b/src/Umbraco.Core/Composing/ComposerGraph.cs @@ -11,7 +11,7 @@ namespace Umbraco.Cms.Core.Composing; /// /// Handles the composers. /// -internal class ComposerGraph +internal sealed class ComposerGraph { private readonly IUmbracoBuilder _builder; private readonly IEnumerable _composerTypes; @@ -415,7 +415,7 @@ internal class ComposerGraph } } - private class EnableInfo + private sealed class EnableInfo { public bool Enabled { get; set; } diff --git a/src/Umbraco.Core/Composing/FindAssembliesWithReferencesTo.cs b/src/Umbraco.Core/Composing/FindAssembliesWithReferencesTo.cs index 1b516636b3..a1581ccfcb 100644 --- a/src/Umbraco.Core/Composing/FindAssembliesWithReferencesTo.cs +++ b/src/Umbraco.Core/Composing/FindAssembliesWithReferencesTo.cs @@ -11,7 +11,7 @@ namespace Umbraco.Cms.Core.Composing; /// borrowed and modified from here /// https://github.com/dotnet/aspnetcore-tooling/blob/master/src/Razor/src/Microsoft.NET.Sdk.Razor/FindAssembliesWithReferencesTo.cs /// -internal class FindAssembliesWithReferencesTo +internal sealed class FindAssembliesWithReferencesTo { private readonly bool _includeTargets; private readonly ILogger _logger; diff --git a/src/Umbraco.Core/Composing/TypeLoader.cs b/src/Umbraco.Core/Composing/TypeLoader.cs index 3c4fa06d54..9b9bbb11f2 100644 --- a/src/Umbraco.Core/Composing/TypeLoader.cs +++ b/src/Umbraco.Core/Composing/TypeLoader.cs @@ -408,7 +408,7 @@ public sealed class TypeLoader /// /// [Serializable] - internal class CachedTypeNotFoundInFileException : Exception + internal sealed class CachedTypeNotFoundInFileException : Exception { /// /// Initializes a new instance of the class. diff --git a/src/Umbraco.Core/Configuration/EntryAssemblyMetadata.cs b/src/Umbraco.Core/Configuration/EntryAssemblyMetadata.cs index 096eac6fe0..9b0c23d0a7 100644 --- a/src/Umbraco.Core/Configuration/EntryAssemblyMetadata.cs +++ b/src/Umbraco.Core/Configuration/EntryAssemblyMetadata.cs @@ -2,7 +2,7 @@ using System.Reflection; namespace Umbraco.Cms.Core.Configuration; -internal class EntryAssemblyMetadata : IEntryAssemblyMetadata +internal sealed class EntryAssemblyMetadata : IEntryAssemblyMetadata { public EntryAssemblyMetadata() { diff --git a/src/Umbraco.Core/Configuration/Models/ContentErrorPage.cs b/src/Umbraco.Core/Configuration/Models/ContentErrorPage.cs index 27c34f0394..5e194ffabb 100644 --- a/src/Umbraco.Core/Configuration/Models/ContentErrorPage.cs +++ b/src/Umbraco.Core/Configuration/Models/ContentErrorPage.cs @@ -37,7 +37,7 @@ public class ContentErrorPage : ValidatableEntryBase [Required] public string Culture { get; set; } = null!; - internal override bool IsValid() => + internal sealed override bool IsValid() => base.IsValid() && (HasContentId ^ HasContentKey); } diff --git a/src/Umbraco.Core/Diagnostics/NoopMarchal.cs b/src/Umbraco.Core/Diagnostics/NoopMarchal.cs index 770aefd50f..991426aab9 100644 --- a/src/Umbraco.Core/Diagnostics/NoopMarchal.cs +++ b/src/Umbraco.Core/Diagnostics/NoopMarchal.cs @@ -1,6 +1,6 @@ namespace Umbraco.Cms.Core.Diagnostics; -internal class NoopMarchal : IMarchal +internal sealed class NoopMarchal : IMarchal { public IntPtr GetExceptionPointers() => IntPtr.Zero; } diff --git a/src/Umbraco.Core/Dictionary/UmbracoCultureDictionary.cs b/src/Umbraco.Core/Dictionary/UmbracoCultureDictionary.cs index 01dea9b4ef..4a59ed9fd4 100644 --- a/src/Umbraco.Core/Dictionary/UmbracoCultureDictionary.cs +++ b/src/Umbraco.Core/Dictionary/UmbracoCultureDictionary.cs @@ -17,7 +17,7 @@ namespace Umbraco.Cms.Core.Dictionary; /// fast /// (even though there is caching involved, if there's lots of dictionary items the caching is not great) /// -internal class DefaultCultureDictionary : ICultureDictionary +internal sealed class DefaultCultureDictionary : ICultureDictionary { private readonly ILocalizationService _localizationService; private readonly IAppCache _requestCache; diff --git a/src/Umbraco.Core/EnvironmentHelper.cs b/src/Umbraco.Core/EnvironmentHelper.cs index 04b3bc91ff..d1448ac5c7 100644 --- a/src/Umbraco.Core/EnvironmentHelper.cs +++ b/src/Umbraco.Core/EnvironmentHelper.cs @@ -5,7 +5,7 @@ namespace Umbraco.Cms.Core; /// /// Currently just used to get the machine name for use with file names /// -internal class EnvironmentHelper +internal static class EnvironmentHelper { /// /// Returns the machine name that is safe to use in file paths. diff --git a/src/Umbraco.Core/Events/EventAggregator.Notifications.cs b/src/Umbraco.Core/Events/EventAggregator.Notifications.cs index 5676af3f3c..4bd6355fc5 100644 --- a/src/Umbraco.Core/Events/EventAggregator.Notifications.cs +++ b/src/Umbraco.Core/Events/EventAggregator.Notifications.cs @@ -102,7 +102,7 @@ public partial class EventAggregator : IEventAggregator } } - private void PublishCore(IEnumerable>> allHandlers, IEnumerable notifications) + private static void PublishCore(IEnumerable>> allHandlers, IEnumerable notifications) { foreach (Action> handler in allHandlers) { @@ -110,7 +110,7 @@ public partial class EventAggregator : IEventAggregator } } - private async Task PublishCoreAsync(IEnumerable, CancellationToken, Task>> allHandlers, IEnumerable notifications, CancellationToken cancellationToken) + private static async Task PublishCoreAsync(IEnumerable, CancellationToken, Task>> allHandlers, IEnumerable notifications, CancellationToken cancellationToken) { foreach (Func, CancellationToken, Task> handler in allHandlers) { @@ -192,7 +192,7 @@ internal abstract class NotificationAsyncHandlerWrapper where TNotificationHandler : INotificationHandler; } -internal class NotificationAsyncHandlerWrapperImpl : NotificationAsyncHandlerWrapper +internal sealed class NotificationAsyncHandlerWrapperImpl : NotificationAsyncHandlerWrapper where TNotificationType : INotification { /// @@ -260,7 +260,7 @@ internal class NotificationAsyncHandlerWrapperImpl : Notifica } } -internal class NotificationHandlerWrapperImpl : NotificationHandlerWrapper +internal sealed class NotificationHandlerWrapperImpl : NotificationHandlerWrapper where TNotificationType : INotification { /// diff --git a/src/Umbraco.Core/Events/EventNameExtractor.cs b/src/Umbraco.Core/Events/EventNameExtractor.cs index 16f772dcb2..67eb221238 100644 --- a/src/Umbraco.Core/Events/EventNameExtractor.cs +++ b/src/Umbraco.Core/Events/EventNameExtractor.cs @@ -169,7 +169,7 @@ public class EventNameExtractor return words[0].EndsWith("ing") == false; } - private class EventInfoArgs + private sealed class EventInfoArgs { public EventInfoArgs(EventInfo eventInfo, Type[] genericArgs) { diff --git a/src/Umbraco.Core/Events/PassThroughEventDispatcher.cs b/src/Umbraco.Core/Events/PassThroughEventDispatcher.cs index 20398502a1..a3b8dc02b5 100644 --- a/src/Umbraco.Core/Events/PassThroughEventDispatcher.cs +++ b/src/Umbraco.Core/Events/PassThroughEventDispatcher.cs @@ -7,7 +7,7 @@ namespace Umbraco.Cms.Core.Events; /// This means that events will be raised during the scope transaction, /// whatever happens, and the transaction could roll back in the end. /// -internal class PassThroughEventDispatcher : IEventDispatcher +internal sealed class PassThroughEventDispatcher : IEventDispatcher { public bool DispatchCancelable(EventHandler? eventHandler, object sender, CancellableEventArgs args, string? eventName = null) { diff --git a/src/Umbraco.Core/Events/QueuingEventDispatcherBase.cs b/src/Umbraco.Core/Events/QueuingEventDispatcherBase.cs index c259e271e5..d319a1cd71 100644 --- a/src/Umbraco.Core/Events/QueuingEventDispatcherBase.cs +++ b/src/Umbraco.Core/Events/QueuingEventDispatcherBase.cs @@ -414,7 +414,7 @@ public abstract class QueuingEventDispatcherBase : IEventDispatcher } } - private class EventDefinitionInfos + private sealed class EventDefinitionInfos { public IEventDefinition? EventDefinition { get; set; } diff --git a/src/Umbraco.Core/Events/ScopedNotificationPublisher.cs b/src/Umbraco.Core/Events/ScopedNotificationPublisher.cs index a3bf6d7682..0dc8b96054 100644 --- a/src/Umbraco.Core/Events/ScopedNotificationPublisher.cs +++ b/src/Umbraco.Core/Events/ScopedNotificationPublisher.cs @@ -116,7 +116,7 @@ public class ScopedNotificationPublisher : IScopedNotifica protected virtual void PublishScopedNotifications(IList notifications) => _eventAggregator.Publish(notifications); - private class Suppressor : IDisposable + private sealed class Suppressor : IDisposable { private readonly ScopedNotificationPublisher _scopedNotificationPublisher; private bool _disposedValue; @@ -129,7 +129,7 @@ public class ScopedNotificationPublisher : IScopedNotifica public void Dispose() => Dispose(true); - protected virtual void Dispose(bool disposing) + private void Dispose(bool disposing) { if (!_disposedValue) { diff --git a/src/Umbraco.Core/Handlers/WarnDocumentTypeElementSwitchNotificationHandler.cs b/src/Umbraco.Core/Handlers/WarnDocumentTypeElementSwitchNotificationHandler.cs index 86ad4ad95c..ab6b82c735 100644 --- a/src/Umbraco.Core/Handlers/WarnDocumentTypeElementSwitchNotificationHandler.cs +++ b/src/Umbraco.Core/Handlers/WarnDocumentTypeElementSwitchNotificationHandler.cs @@ -96,7 +96,7 @@ public class WarnDocumentTypeElementSwitchNotificationHandler : } } - private class DocumentTypeElementSwitchInformation + private sealed class DocumentTypeElementSwitchInformation { public bool WasElement { get; set; } } diff --git a/src/Umbraco.Core/Hosting/NoopApplicationShutdownRegistry.cs b/src/Umbraco.Core/Hosting/NoopApplicationShutdownRegistry.cs index e821102f09..824ce3249a 100644 --- a/src/Umbraco.Core/Hosting/NoopApplicationShutdownRegistry.cs +++ b/src/Umbraco.Core/Hosting/NoopApplicationShutdownRegistry.cs @@ -1,6 +1,6 @@ namespace Umbraco.Cms.Core.Hosting; -internal class NoopApplicationShutdownRegistry : IApplicationShutdownRegistry +internal sealed class NoopApplicationShutdownRegistry : IApplicationShutdownRegistry { public void RegisterObject(IRegisteredObject registeredObject) { diff --git a/src/Umbraco.Core/IO/ShadowFileSystem.cs b/src/Umbraco.Core/IO/ShadowFileSystem.cs index 95517f8054..ef35006ef5 100644 --- a/src/Umbraco.Core/IO/ShadowFileSystem.cs +++ b/src/Umbraco.Core/IO/ShadowFileSystem.cs @@ -2,7 +2,7 @@ using System.Text.RegularExpressions; namespace Umbraco.Cms.Core.IO; -internal class ShadowFileSystem : IFileSystem +internal sealed class ShadowFileSystem : IFileSystem { private readonly IFileSystem _sfs; @@ -392,7 +392,7 @@ internal class ShadowFileSystem : IFileSystem } // copied from System.Web.Util.Wildcard internal - internal class WildcardExpression + internal sealed class WildcardExpression { private static readonly Regex MetaRegex = new("[\\+\\{\\\\\\[\\|\\(\\)\\.\\^\\$]"); private static readonly Regex QuestRegex = new("\\?"); @@ -454,7 +454,7 @@ internal class ShadowFileSystem : IFileSystem } } - private class ShadowNode + private sealed class ShadowNode { public ShadowNode(bool isDelete, bool isdir) { diff --git a/src/Umbraco.Core/IO/ShadowFileSystems.cs b/src/Umbraco.Core/IO/ShadowFileSystems.cs index 3d69875dc4..6e3ce7ca19 100644 --- a/src/Umbraco.Core/IO/ShadowFileSystems.cs +++ b/src/Umbraco.Core/IO/ShadowFileSystems.cs @@ -1,7 +1,7 @@ namespace Umbraco.Cms.Core.IO; // shadow filesystems is definitively ... too convoluted -internal class ShadowFileSystems : ICompletable +internal sealed class ShadowFileSystems : ICompletable { private readonly FileSystems _fileSystems; private bool _completed; diff --git a/src/Umbraco.Core/IO/ShadowWrapper.cs b/src/Umbraco.Core/IO/ShadowWrapper.cs index ca82c67bd2..aa3d7c9b97 100644 --- a/src/Umbraco.Core/IO/ShadowWrapper.cs +++ b/src/Umbraco.Core/IO/ShadowWrapper.cs @@ -5,7 +5,7 @@ using Umbraco.Extensions; namespace Umbraco.Cms.Core.IO; -internal class ShadowWrapper : IFileSystem, IFileProviderFactory +internal sealed class ShadowWrapper : IFileSystem, IFileProviderFactory { private const string ShadowFsPath = "ShadowFs"; diff --git a/src/Umbraco.Core/Logging/LogProfiler.cs b/src/Umbraco.Core/Logging/LogProfiler.cs index cc93372d75..a16b4caa7c 100644 --- a/src/Umbraco.Core/Logging/LogProfiler.cs +++ b/src/Umbraco.Core/Logging/LogProfiler.cs @@ -39,7 +39,7 @@ public class LogProfiler : IProfiler public bool IsEnabled => _logger.IsEnabled(Microsoft.Extensions.Logging.LogLevel.Debug); // a lightweight disposable timer - private class LightDisposableTimer : DisposableObjectSlim + private sealed class LightDisposableTimer : DisposableObjectSlim { private readonly Action _callback; private readonly Stopwatch _stopwatch = Stopwatch.StartNew(); diff --git a/src/Umbraco.Core/Logging/NoopProfiler.cs b/src/Umbraco.Core/Logging/NoopProfiler.cs index c7bcf34bc0..7c7b0b3234 100644 --- a/src/Umbraco.Core/Logging/NoopProfiler.cs +++ b/src/Umbraco.Core/Logging/NoopProfiler.cs @@ -17,7 +17,7 @@ public class NoopProfiler : IProfiler /// public bool IsEnabled => false; - private class VoidDisposable : DisposableObjectSlim + private sealed class VoidDisposable : DisposableObjectSlim { protected override void DisposeResources() { diff --git a/src/Umbraco.Core/Mail/NotImplementedEmailSender.cs b/src/Umbraco.Core/Mail/NotImplementedEmailSender.cs index 5b1fa0923a..7d0d2b4865 100644 --- a/src/Umbraco.Core/Mail/NotImplementedEmailSender.cs +++ b/src/Umbraco.Core/Mail/NotImplementedEmailSender.cs @@ -2,7 +2,7 @@ using Umbraco.Cms.Core.Models.Email; namespace Umbraco.Cms.Core.Mail; -internal class NotImplementedEmailSender : IEmailSender +internal sealed class NotImplementedEmailSender : IEmailSender { public Task SendAsync(EmailMessage message, string emailType) => throw new NotImplementedException( diff --git a/src/Umbraco.Core/Mail/NotImplementedSmsSender.cs b/src/Umbraco.Core/Mail/NotImplementedSmsSender.cs index b3901d5ab9..af3e0dff8b 100644 --- a/src/Umbraco.Core/Mail/NotImplementedSmsSender.cs +++ b/src/Umbraco.Core/Mail/NotImplementedSmsSender.cs @@ -3,7 +3,7 @@ namespace Umbraco.Cms.Core.Mail; /// /// An that throws /// -internal class NotImplementedSmsSender : ISmsSender +internal sealed class NotImplementedSmsSender : ISmsSender { public Task SendSmsAsync(string number, string message) => throw new NotImplementedException( diff --git a/src/Umbraco.Core/Models/DefaultPayloadModel.cs b/src/Umbraco.Core/Models/DefaultPayloadModel.cs index 45b2592b51..deccb4c427 100644 --- a/src/Umbraco.Core/Models/DefaultPayloadModel.cs +++ b/src/Umbraco.Core/Models/DefaultPayloadModel.cs @@ -1,6 +1,6 @@ namespace Umbraco.Cms.Core.Models; -internal class DefaultPayloadModel +internal sealed class DefaultPayloadModel { public Guid Id { get; set; } } diff --git a/src/Umbraco.Core/Models/Membership/User.cs b/src/Umbraco.Core/Models/Membership/User.cs index 487f9c4209..571449dcc3 100644 --- a/src/Umbraco.Core/Models/Membership/User.cs +++ b/src/Umbraco.Core/Models/Membership/User.cs @@ -426,7 +426,7 @@ public class User : EntityBase, IUser, IProfile /// /// Internal class used to wrap the user in a profile /// - private class WrappedUserProfile : IProfile + private sealed class WrappedUserProfile : IProfile { private readonly IUser _user; diff --git a/src/Umbraco.Core/Models/PublishedContent/ModelType.cs b/src/Umbraco.Core/Models/PublishedContent/ModelType.cs index 4588d47967..56df7dae23 100644 --- a/src/Umbraco.Core/Models/PublishedContent/ModelType.cs +++ b/src/Umbraco.Core/Models/PublishedContent/ModelType.cs @@ -373,7 +373,7 @@ public class ModelType : Type } /// -internal class ModelTypeArrayType : Type +internal sealed class ModelTypeArrayType : Type { private readonly Type _elementType; diff --git a/src/Umbraco.Core/Models/PublishedContent/PublishedContentTypeConverter.cs b/src/Umbraco.Core/Models/PublishedContent/PublishedContentTypeConverter.cs index 957246ccfe..c2b1cae7d7 100644 --- a/src/Umbraco.Core/Models/PublishedContent/PublishedContentTypeConverter.cs +++ b/src/Umbraco.Core/Models/PublishedContent/PublishedContentTypeConverter.cs @@ -3,7 +3,7 @@ using System.Globalization; namespace Umbraco.Cms.Core.Models.PublishedContent; -internal class PublishedContentTypeConverter : TypeConverter +internal sealed class PublishedContentTypeConverter : TypeConverter { private static readonly Type[] ConvertingTypes = { typeof(int) }; diff --git a/src/Umbraco.Core/Models/PublishedContent/PublishedModelFactory.cs b/src/Umbraco.Core/Models/PublishedContent/PublishedModelFactory.cs index b2d5da7876..7067b357fe 100644 --- a/src/Umbraco.Core/Models/PublishedContent/PublishedModelFactory.cs +++ b/src/Umbraco.Core/Models/PublishedContent/PublishedModelFactory.cs @@ -151,7 +151,7 @@ public class PublishedModelFactory : IPublishedModelFactory public Type MapModelType(Type type) => ModelType.Map(type, _modelTypeMap); - private class ModelInfo + private sealed class ModelInfo { public Type? ParameterType { get; set; } diff --git a/src/Umbraco.Core/Persistence/Repositories/UpgradeCheckRepository.cs b/src/Umbraco.Core/Persistence/Repositories/UpgradeCheckRepository.cs index e6190b049a..3dab741acc 100644 --- a/src/Umbraco.Core/Persistence/Repositories/UpgradeCheckRepository.cs +++ b/src/Umbraco.Core/Persistence/Repositories/UpgradeCheckRepository.cs @@ -33,7 +33,7 @@ public class UpgradeCheckRepository : IUpgradeCheckRepository } } - private class CheckUpgradeDto + private sealed class CheckUpgradeDto { public CheckUpgradeDto(SemVersion version) { diff --git a/src/Umbraco.Core/PropertyEditors/ContentPickerConfigurationEditor.cs b/src/Umbraco.Core/PropertyEditors/ContentPickerConfigurationEditor.cs index be8a755dfc..7997db5f0f 100644 --- a/src/Umbraco.Core/PropertyEditors/ContentPickerConfigurationEditor.cs +++ b/src/Umbraco.Core/PropertyEditors/ContentPickerConfigurationEditor.cs @@ -5,7 +5,7 @@ using Umbraco.Cms.Core.IO; namespace Umbraco.Cms.Core.PropertyEditors; -internal class ContentPickerConfigurationEditor : ConfigurationEditor +internal sealed class ContentPickerConfigurationEditor : ConfigurationEditor { public ContentPickerConfigurationEditor(IIOHelper ioHelper) : base(ioHelper) diff --git a/src/Umbraco.Core/PropertyEditors/ContentPickerPropertyEditor.cs b/src/Umbraco.Core/PropertyEditors/ContentPickerPropertyEditor.cs index 1c5d240c8f..ae8773defc 100644 --- a/src/Umbraco.Core/PropertyEditors/ContentPickerPropertyEditor.cs +++ b/src/Umbraco.Core/PropertyEditors/ContentPickerPropertyEditor.cs @@ -37,7 +37,7 @@ public class ContentPickerPropertyEditor : DataEditor protected override IDataValueEditor CreateValueEditor() => DataValueEditorFactory.Create(Attribute!); - internal class ContentPickerPropertyValueEditor : DataValueEditor, IDataValueReference + internal sealed class ContentPickerPropertyValueEditor : DataValueEditor, IDataValueReference { public ContentPickerPropertyValueEditor( diff --git a/src/Umbraco.Core/PropertyEditors/DateValueEditor.cs b/src/Umbraco.Core/PropertyEditors/DateValueEditor.cs index d0c578d32b..c6c6387c2a 100644 --- a/src/Umbraco.Core/PropertyEditors/DateValueEditor.cs +++ b/src/Umbraco.Core/PropertyEditors/DateValueEditor.cs @@ -12,7 +12,7 @@ namespace Umbraco.Cms.Core.PropertyEditors; /// CUstom value editor so we can serialize with the correct date format (excluding time) /// and includes the date validator /// -internal class DateValueEditor : DataValueEditor +internal sealed class DateValueEditor : DataValueEditor { public DateValueEditor( IShortStringHelper shortStringHelper, diff --git a/src/Umbraco.Core/PropertyEditors/DecimalPropertyEditor.cs b/src/Umbraco.Core/PropertyEditors/DecimalPropertyEditor.cs index fbce2b7a5d..5d10cf7e76 100644 --- a/src/Umbraco.Core/PropertyEditors/DecimalPropertyEditor.cs +++ b/src/Umbraco.Core/PropertyEditors/DecimalPropertyEditor.cs @@ -41,7 +41,7 @@ public class DecimalPropertyEditor : DataEditor /// /// Defines the value editor for the decimal property editor. /// - internal class DecimalPropertyValueEditor : DataValueEditor + internal sealed class DecimalPropertyValueEditor : DataValueEditor { /// /// Initializes a new instance of the class. @@ -63,7 +63,7 @@ public class DecimalPropertyEditor : DataEditor public override object? FromEditor(ContentPropertyData editorValue, object? currentValue) => TryParsePropertyValue(editorValue.Value); - private decimal? TryParsePropertyValue(object? value) + private static decimal? TryParsePropertyValue(object? value) => value is decimal decimalValue ? decimalValue : decimal.TryParse(value?.ToString(), CultureInfo.InvariantCulture, out var parsedDecimalValue) @@ -108,7 +108,7 @@ public class DecimalPropertyEditor : DataEditor /// /// Validates the min/max configuration for the decimal property editor. /// - internal class MinMaxValidator : DecimalPropertyConfigurationValidatorBase, IValueValidator + internal sealed class MinMaxValidator : DecimalPropertyConfigurationValidatorBase, IValueValidator { /// /// Initializes a new instance of the class. @@ -145,7 +145,7 @@ public class DecimalPropertyEditor : DataEditor /// /// Validates the step configuration for the decimal property editor. /// - internal class StepValidator : DecimalPropertyConfigurationValidatorBase, IValueValidator + internal sealed class StepValidator : DecimalPropertyConfigurationValidatorBase, IValueValidator { /// /// Initializes a new instance of the class. diff --git a/src/Umbraco.Core/PropertyEditors/IntegerPropertyEditor.cs b/src/Umbraco.Core/PropertyEditors/IntegerPropertyEditor.cs index 5f282061b0..fd0ff93158 100644 --- a/src/Umbraco.Core/PropertyEditors/IntegerPropertyEditor.cs +++ b/src/Umbraco.Core/PropertyEditors/IntegerPropertyEditor.cs @@ -39,7 +39,7 @@ public class IntegerPropertyEditor : DataEditor /// /// Defines the value editor for the integer property editor. /// - internal class IntegerPropertyValueEditor : DataValueEditor + internal sealed class IntegerPropertyValueEditor : DataValueEditor { /// /// Initializes a new instance of the class. @@ -106,7 +106,7 @@ public class IntegerPropertyEditor : DataEditor /// /// Validates the min/max configuration for the integer property editor. /// - internal class MinMaxValidator : IntegerPropertyConfigurationValidatorBase, IValueValidator + internal sealed class MinMaxValidator : IntegerPropertyConfigurationValidatorBase, IValueValidator { /// /// Initializes a new instance of the class. @@ -143,7 +143,7 @@ public class IntegerPropertyEditor : DataEditor /// /// Validates the step configuration for the integer property editor. /// - internal class StepValidator : IntegerPropertyConfigurationValidatorBase, IValueValidator + internal sealed class StepValidator : IntegerPropertyConfigurationValidatorBase, IValueValidator { /// /// Initializes a new instance of the class. diff --git a/src/Umbraco.Core/PropertyEditors/LabelPropertyEditor.cs b/src/Umbraco.Core/PropertyEditors/LabelPropertyEditor.cs index 646f20efe6..a7456a51a6 100644 --- a/src/Umbraco.Core/PropertyEditors/LabelPropertyEditor.cs +++ b/src/Umbraco.Core/PropertyEditors/LabelPropertyEditor.cs @@ -37,7 +37,7 @@ public class LabelPropertyEditor : DataEditor new LabelConfigurationEditor(_ioHelper); // provides the property value editor - internal class LabelPropertyValueEditor : DataValueEditor + internal sealed class LabelPropertyValueEditor : DataValueEditor { public LabelPropertyValueEditor( IShortStringHelper shortStringHelper, diff --git a/src/Umbraco.Core/PropertyEditors/MarkDownPropertyValueEditor.cs b/src/Umbraco.Core/PropertyEditors/MarkDownPropertyValueEditor.cs index 2a7a97b027..ae78a456cd 100644 --- a/src/Umbraco.Core/PropertyEditors/MarkDownPropertyValueEditor.cs +++ b/src/Umbraco.Core/PropertyEditors/MarkDownPropertyValueEditor.cs @@ -2,13 +2,12 @@ using Umbraco.Cms.Core.IO; using Umbraco.Cms.Core.Models.Editors; using Umbraco.Cms.Core.Security; using Umbraco.Cms.Core.Serialization; -using Umbraco.Cms.Core.Services; using Umbraco.Cms.Core.Strings; using Umbraco.Extensions; namespace Umbraco.Cms.Core.PropertyEditors; -internal class MarkDownPropertyValueEditor : DataValueEditor +internal sealed class MarkDownPropertyValueEditor : DataValueEditor { private readonly IMarkdownSanitizer _markdownSanitizer; diff --git a/src/Umbraco.Core/PropertyEditors/MemberGroupPickerPropertyEditor.cs b/src/Umbraco.Core/PropertyEditors/MemberGroupPickerPropertyEditor.cs index f22c52b159..4f25dc74fe 100644 --- a/src/Umbraco.Core/PropertyEditors/MemberGroupPickerPropertyEditor.cs +++ b/src/Umbraco.Core/PropertyEditors/MemberGroupPickerPropertyEditor.cs @@ -21,7 +21,7 @@ public class MemberGroupPickerPropertyEditor : DataEditor protected override IDataValueEditor CreateValueEditor() => DataValueEditorFactory.Create(Attribute!); - private class MemberGroupPickerPropertyValueEditor : DataValueEditor + private sealed class MemberGroupPickerPropertyValueEditor : DataValueEditor { private readonly IMemberGroupService _memberGroupService; diff --git a/src/Umbraco.Core/PropertyEditors/MemberPickerPropertyEditor.cs b/src/Umbraco.Core/PropertyEditors/MemberPickerPropertyEditor.cs index 8392f852b4..fd9fb503e3 100644 --- a/src/Umbraco.Core/PropertyEditors/MemberPickerPropertyEditor.cs +++ b/src/Umbraco.Core/PropertyEditors/MemberPickerPropertyEditor.cs @@ -21,7 +21,7 @@ public class MemberPickerPropertyEditor : DataEditor protected override IDataValueEditor CreateValueEditor() => DataValueEditorFactory.Create(Attribute!); - private class MemberPickerPropertyValueEditor : DataValueEditor, IDataValueReference + private sealed class MemberPickerPropertyValueEditor : DataValueEditor, IDataValueReference { private readonly IMemberService _memberService; diff --git a/src/Umbraco.Core/PropertyEditors/TextOnlyValueEditor.cs b/src/Umbraco.Core/PropertyEditors/TextOnlyValueEditor.cs index 97b0643e58..143240df08 100644 --- a/src/Umbraco.Core/PropertyEditors/TextOnlyValueEditor.cs +++ b/src/Umbraco.Core/PropertyEditors/TextOnlyValueEditor.cs @@ -63,7 +63,7 @@ public class TextOnlyValueEditor : DataValueEditor /// /// A common length validator for both textbox and text area. /// - internal class LengthValidator : IValueValidator + internal sealed class LengthValidator : IValueValidator { private readonly ILocalizedTextService _localizedTextService; diff --git a/src/Umbraco.Core/PropertyEditors/UserPickerPropertyEditor.cs b/src/Umbraco.Core/PropertyEditors/UserPickerPropertyEditor.cs index 261e8f27d8..c0026e917a 100644 --- a/src/Umbraco.Core/PropertyEditors/UserPickerPropertyEditor.cs +++ b/src/Umbraco.Core/PropertyEditors/UserPickerPropertyEditor.cs @@ -21,7 +21,7 @@ public class UserPickerPropertyEditor : DataEditor protected override IDataValueEditor CreateValueEditor() => DataValueEditorFactory.Create(Attribute!); - private class UserPickerPropertyValueEditor : DataValueEditor + private sealed class UserPickerPropertyValueEditor : DataValueEditor { private readonly IUserService _userService; diff --git a/src/Umbraco.Core/PropertyEditors/Validation/JsonPathValidationError.cs b/src/Umbraco.Core/PropertyEditors/Validation/JsonPathValidationError.cs index 36e06633b6..0a973e888f 100644 --- a/src/Umbraco.Core/PropertyEditors/Validation/JsonPathValidationError.cs +++ b/src/Umbraco.Core/PropertyEditors/Validation/JsonPathValidationError.cs @@ -1,6 +1,6 @@ namespace Umbraco.Cms.Core.PropertyEditors.Validation; -internal class JsonPathValidationError +internal sealed class JsonPathValidationError { public required string JsonPath { get; init; } diff --git a/src/Umbraco.Core/PropertyEditors/Validation/JsonPathValidator.cs b/src/Umbraco.Core/PropertyEditors/Validation/JsonPathValidator.cs index 307abe22a5..fd8f462205 100644 --- a/src/Umbraco.Core/PropertyEditors/Validation/JsonPathValidator.cs +++ b/src/Umbraco.Core/PropertyEditors/Validation/JsonPathValidator.cs @@ -55,7 +55,7 @@ internal static class JsonPathValidator return errors; } - private class JsonPathValidationTreeItem + private sealed class JsonPathValidationTreeItem { public required string JsonPath { get; init; } diff --git a/src/Umbraco.Core/PublishedCache/PublishedElementPropertyBase.cs b/src/Umbraco.Core/PublishedCache/PublishedElementPropertyBase.cs index fb4ed21ef6..af5b658b9f 100644 --- a/src/Umbraco.Core/PublishedCache/PublishedElementPropertyBase.cs +++ b/src/Umbraco.Core/PublishedCache/PublishedElementPropertyBase.cs @@ -4,7 +4,7 @@ using Umbraco.Extensions; namespace Umbraco.Cms.Core.PublishedCache; -internal class PublishedElementPropertyBase : PublishedPropertyBase +internal sealed class PublishedElementPropertyBase : PublishedPropertyBase { protected readonly IPublishedElement Element; diff --git a/src/Umbraco.Core/Security/Authorization/DictionaryPermissionAuthorizer.cs b/src/Umbraco.Core/Security/Authorization/DictionaryPermissionAuthorizer.cs index 312ae37c44..b49b1c76c7 100644 --- a/src/Umbraco.Core/Security/Authorization/DictionaryPermissionAuthorizer.cs +++ b/src/Umbraco.Core/Security/Authorization/DictionaryPermissionAuthorizer.cs @@ -4,7 +4,7 @@ using Umbraco.Cms.Core.Services.AuthorizationStatus; namespace Umbraco.Cms.Core.Security.Authorization; -internal class DictionaryPermissionAuthorizer : IDictionaryPermissionAuthorizer +internal sealed class DictionaryPermissionAuthorizer : IDictionaryPermissionAuthorizer { private readonly IDictionaryPermissionService _dictionaryPermissionService; diff --git a/src/Umbraco.Core/Services/ConsentService.cs b/src/Umbraco.Core/Services/ConsentService.cs index d7bb7af13e..40b76f5a8e 100644 --- a/src/Umbraco.Core/Services/ConsentService.cs +++ b/src/Umbraco.Core/Services/ConsentService.cs @@ -10,7 +10,7 @@ namespace Umbraco.Cms.Core.Services; /// /// Implements . /// -internal class ConsentService : RepositoryService, IConsentService +internal sealed class ConsentService : RepositoryService, IConsentService { private readonly IConsentRepository _consentRepository; diff --git a/src/Umbraco.Core/Services/ContentVersionService.cs b/src/Umbraco.Core/Services/ContentVersionService.cs index 9d5d569b3a..d6562351d7 100644 --- a/src/Umbraco.Core/Services/ContentVersionService.cs +++ b/src/Umbraco.Core/Services/ContentVersionService.cs @@ -13,7 +13,7 @@ using Umbraco.Extensions; // ReSharper disable once CheckNamespace namespace Umbraco.Cms.Core.Services; -internal class ContentVersionService : IContentVersionService +internal sealed class ContentVersionService : IContentVersionService { private readonly IAuditRepository _auditRepository; private readonly IContentVersionCleanupPolicy _contentVersionCleanupPolicy; diff --git a/src/Umbraco.Core/Services/DocumentUrlService.cs b/src/Umbraco.Core/Services/DocumentUrlService.cs index 2b60d736cc..d0c08bbe59 100644 --- a/src/Umbraco.Core/Services/DocumentUrlService.cs +++ b/src/Umbraco.Core/Services/DocumentUrlService.cs @@ -45,7 +45,7 @@ public class DocumentUrlService : IDocumentUrlService /// Model used to cache a single published document along with all it's URL segments. /// /// Internal for the purpose of unit and benchmark testing. - internal class PublishedDocumentUrlSegments + internal sealed class PublishedDocumentUrlSegments { /// /// Gets or sets the document key. @@ -456,7 +456,7 @@ public class DocumentUrlService : IDocumentUrlService private static bool IsVariantAndPublishedForCulture(IContent document, string? culture) => document.PublishCultureInfos?.Values.Any(x => x.Culture == culture) ?? false; - private IEnumerable ConvertToPersistedModel(PublishedDocumentUrlSegments model) + private static IEnumerable ConvertToPersistedModel(PublishedDocumentUrlSegments model) { foreach (PublishedDocumentUrlSegments.UrlSegment urlSegment in model.UrlSegments) { @@ -816,7 +816,7 @@ public class DocumentUrlService : IDocumentUrlService return '/' + string.Join('/', urlSegments); } - private bool HideTopLevel(bool hideTopLevelNodeFromPath, bool isRootFirstItem, List urlSegments) + private static bool HideTopLevel(bool hideTopLevelNodeFromPath, bool isRootFirstItem, List urlSegments) { if (hideTopLevelNodeFromPath is false) { diff --git a/src/Umbraco.Core/Services/EntityXmlSerializer.cs b/src/Umbraco.Core/Services/EntityXmlSerializer.cs index 872b6b6868..5636b957e6 100644 --- a/src/Umbraco.Core/Services/EntityXmlSerializer.cs +++ b/src/Umbraco.Core/Services/EntityXmlSerializer.cs @@ -13,7 +13,7 @@ namespace Umbraco.Cms.Core.Services; /// /// Serializes entities to XML /// -internal class EntityXmlSerializer : IEntityXmlSerializer +internal sealed class EntityXmlSerializer : IEntityXmlSerializer { private readonly IConfigurationEditorJsonSerializer _configurationEditorJsonSerializer; private readonly IContentService _contentService; diff --git a/src/Umbraco.Core/Services/FileSystem/PartialViewFolderService.cs b/src/Umbraco.Core/Services/FileSystem/PartialViewFolderService.cs index 43b631d45b..0625ebf7d1 100644 --- a/src/Umbraco.Core/Services/FileSystem/PartialViewFolderService.cs +++ b/src/Umbraco.Core/Services/FileSystem/PartialViewFolderService.cs @@ -5,7 +5,7 @@ using Umbraco.Cms.Core.Services.OperationStatus; namespace Umbraco.Cms.Core.Services.FileSystem; -internal class PartialViewFolderService : FolderServiceOperationBase, IPartialViewFolderService +internal sealed class PartialViewFolderService : FolderServiceOperationBase, IPartialViewFolderService { public PartialViewFolderService(IPartialViewRepository repository, ICoreScopeProvider scopeProvider) : base(repository, scopeProvider) diff --git a/src/Umbraco.Core/Services/FileSystem/ScriptFolderService.cs b/src/Umbraco.Core/Services/FileSystem/ScriptFolderService.cs index dca28af69c..0bca13a1ed 100644 --- a/src/Umbraco.Core/Services/FileSystem/ScriptFolderService.cs +++ b/src/Umbraco.Core/Services/FileSystem/ScriptFolderService.cs @@ -5,7 +5,7 @@ using Umbraco.Cms.Core.Services.OperationStatus; namespace Umbraco.Cms.Core.Services.FileSystem; -internal class ScriptFolderService : FolderServiceOperationBase, IScriptFolderService +internal sealed class ScriptFolderService : FolderServiceOperationBase, IScriptFolderService { public ScriptFolderService(IScriptRepository repository, ICoreScopeProvider scopeProvider) : base(repository, scopeProvider) diff --git a/src/Umbraco.Core/Services/FileSystem/StylesheetFolderService.cs b/src/Umbraco.Core/Services/FileSystem/StylesheetFolderService.cs index b153ca0845..84bcbf3a18 100644 --- a/src/Umbraco.Core/Services/FileSystem/StylesheetFolderService.cs +++ b/src/Umbraco.Core/Services/FileSystem/StylesheetFolderService.cs @@ -5,7 +5,7 @@ using Umbraco.Cms.Core.Services.OperationStatus; namespace Umbraco.Cms.Core.Services.FileSystem; -internal class StylesheetFolderService : FolderServiceOperationBase, IStylesheetFolderService +internal sealed class StylesheetFolderService : FolderServiceOperationBase, IStylesheetFolderService { public StylesheetFolderService(IStylesheetRepository repository, ICoreScopeProvider scopeProvider) : base(repository, scopeProvider) diff --git a/src/Umbraco.Core/Services/IdKeyMap.cs b/src/Umbraco.Core/Services/IdKeyMap.cs index 2dff4e3cd3..65aa4c5d25 100644 --- a/src/Umbraco.Core/Services/IdKeyMap.cs +++ b/src/Umbraco.Core/Services/IdKeyMap.cs @@ -418,7 +418,7 @@ public class IdKeyMap : IIdKeyMap, IDisposable // ReSharper disable ClassNeverInstantiated.Local // ReSharper disable UnusedAutoPropertyAccessor.Local - private class TypedIdDto + private sealed class TypedIdDto { public int Id { get; set; } diff --git a/src/Umbraco.Core/Services/KeyValueService.cs b/src/Umbraco.Core/Services/KeyValueService.cs index 0a38e3c284..e2c318fd0b 100644 --- a/src/Umbraco.Core/Services/KeyValueService.cs +++ b/src/Umbraco.Core/Services/KeyValueService.cs @@ -4,7 +4,7 @@ using Umbraco.Cms.Core.Scoping; namespace Umbraco.Cms.Core.Services; -internal class KeyValueService : IKeyValueService +internal sealed class KeyValueService : IKeyValueService { private readonly IKeyValueRepository _repository; private readonly ICoreScopeProvider _scopeProvider; diff --git a/src/Umbraco.Core/Services/MemberGroupService.cs b/src/Umbraco.Core/Services/MemberGroupService.cs index bf490c2613..2fda732b3a 100644 --- a/src/Umbraco.Core/Services/MemberGroupService.cs +++ b/src/Umbraco.Core/Services/MemberGroupService.cs @@ -8,7 +8,7 @@ using Umbraco.Cms.Core.Services.OperationStatus; namespace Umbraco.Cms.Core.Services; -internal class MemberGroupService : RepositoryService, IMemberGroupService +internal sealed class MemberGroupService : RepositoryService, IMemberGroupService { private readonly IMemberGroupRepository _memberGroupRepository; diff --git a/src/Umbraco.Core/Services/MemberTwoFactorLoginService.cs b/src/Umbraco.Core/Services/MemberTwoFactorLoginService.cs index b21558b834..db09478dab 100644 --- a/src/Umbraco.Core/Services/MemberTwoFactorLoginService.cs +++ b/src/Umbraco.Core/Services/MemberTwoFactorLoginService.cs @@ -6,7 +6,7 @@ using Umbraco.Cms.Core.Services.OperationStatus; namespace Umbraco.Cms.Core.Services; /// -internal class MemberTwoFactorLoginService : TwoFactorLoginServiceBase, IMemberTwoFactorLoginService +internal sealed class MemberTwoFactorLoginService : TwoFactorLoginServiceBase, IMemberTwoFactorLoginService { private readonly IMemberService _memberService; diff --git a/src/Umbraco.Core/Services/NotificationService.cs b/src/Umbraco.Core/Services/NotificationService.cs index be896eb5f3..24dbb0089a 100644 --- a/src/Umbraco.Core/Services/NotificationService.cs +++ b/src/Umbraco.Core/Services/NotificationService.cs @@ -607,7 +607,7 @@ public class NotificationService : INotificationService } } - private class NotificationRequest + private sealed class NotificationRequest { public NotificationRequest(EmailMessage mail, string? action, string? userName, string? email) { diff --git a/src/Umbraco.Core/Services/RedirectUrlService.cs b/src/Umbraco.Core/Services/RedirectUrlService.cs index 0944b2a6a1..c2050f7ff0 100644 --- a/src/Umbraco.Core/Services/RedirectUrlService.cs +++ b/src/Umbraco.Core/Services/RedirectUrlService.cs @@ -7,7 +7,7 @@ using Umbraco.Cms.Core.Scoping; namespace Umbraco.Cms.Core.Services; -internal class RedirectUrlService : RepositoryService, IRedirectUrlService +internal sealed class RedirectUrlService : RepositoryService, IRedirectUrlService { private readonly IRedirectUrlRepository _redirectUrlRepository; diff --git a/src/Umbraco.Core/Services/UserTwoFactorLoginService.cs b/src/Umbraco.Core/Services/UserTwoFactorLoginService.cs index 10a9de140f..58352a242f 100644 --- a/src/Umbraco.Core/Services/UserTwoFactorLoginService.cs +++ b/src/Umbraco.Core/Services/UserTwoFactorLoginService.cs @@ -7,7 +7,7 @@ using Umbraco.Cms.Core.Services.OperationStatus; namespace Umbraco.Cms.Core.Services; /// -internal class UserTwoFactorLoginService : TwoFactorLoginServiceBase, IUserTwoFactorLoginService +internal sealed class UserTwoFactorLoginService : TwoFactorLoginServiceBase, IUserTwoFactorLoginService { private readonly IUserService _userService; diff --git a/src/Umbraco.Core/Strings/Diff.cs b/src/Umbraco.Core/Strings/Diff.cs index e8a5cc1324..e4c943d811 100644 --- a/src/Umbraco.Core/Strings/Diff.cs +++ b/src/Umbraco.Core/Strings/Diff.cs @@ -500,7 +500,7 @@ internal sealed class Diff /// /// Data on one input file being compared. /// - internal class DiffData + internal sealed class DiffData { /// Buffer of numbers that will be compared. internal int[] Data; diff --git a/src/Umbraco.Core/SystemLock.cs b/src/Umbraco.Core/SystemLock.cs index 0e47096c2e..75ca72e27c 100644 --- a/src/Umbraco.Core/SystemLock.cs +++ b/src/Umbraco.Core/SystemLock.cs @@ -89,7 +89,7 @@ public class SystemLock // note - before making those classes some structs, read // about "impure methods" and mutating readonly structs... - private class NamedSemaphoreReleaser : CriticalFinalizerObject, IDisposable + private sealed class NamedSemaphoreReleaser : CriticalFinalizerObject, IDisposable { private readonly Semaphore? _semaphore; @@ -156,7 +156,7 @@ public class SystemLock } } - private class SemaphoreSlimReleaser : IDisposable + private sealed class SemaphoreSlimReleaser : IDisposable { private readonly SemaphoreSlim _semaphore; diff --git a/src/Umbraco.Core/Telemetry/SiteIdentifierService.cs b/src/Umbraco.Core/Telemetry/SiteIdentifierService.cs index 6af5830cf5..0d2d3a3c8d 100644 --- a/src/Umbraco.Core/Telemetry/SiteIdentifierService.cs +++ b/src/Umbraco.Core/Telemetry/SiteIdentifierService.cs @@ -6,7 +6,7 @@ using Umbraco.Cms.Core.Configuration.Models; namespace Umbraco.Cms.Core.Telemetry; /// -internal class SiteIdentifierService : ISiteIdentifierService +internal sealed class SiteIdentifierService : ISiteIdentifierService { private readonly IConfigManipulator _configManipulator; private readonly ILogger _logger; diff --git a/src/Umbraco.Core/Telemetry/TelemetryService.cs b/src/Umbraco.Core/Telemetry/TelemetryService.cs index 5a31fec4f6..ea10679a5d 100644 --- a/src/Umbraco.Core/Telemetry/TelemetryService.cs +++ b/src/Umbraco.Core/Telemetry/TelemetryService.cs @@ -11,7 +11,7 @@ using Umbraco.Extensions; namespace Umbraco.Cms.Core.Telemetry; /// -internal class TelemetryService : ITelemetryService +internal sealed class TelemetryService : ITelemetryService { private readonly IPackagingService _packagingService; private readonly IMetricsConsentService _metricsConsentService; diff --git a/src/Umbraco.Core/UdiTypeConverter.cs b/src/Umbraco.Core/UdiTypeConverter.cs index 2a52a1e093..c058ce2a70 100644 --- a/src/Umbraco.Core/UdiTypeConverter.cs +++ b/src/Umbraco.Core/UdiTypeConverter.cs @@ -9,7 +9,7 @@ namespace Umbraco.Cms.Core; /// /// Primarily this is used so that WebApi can auto-bind a string parameter to a UDI instance /// -internal class UdiTypeConverter : TypeConverter +internal sealed class UdiTypeConverter : TypeConverter { public override bool CanConvertFrom(ITypeDescriptorContext? context, Type sourceType) { diff --git a/src/Umbraco.Core/Xml/XmlNodeListFactory.cs b/src/Umbraco.Core/Xml/XmlNodeListFactory.cs index 87b9bbc795..74c0861d66 100644 --- a/src/Umbraco.Core/Xml/XmlNodeListFactory.cs +++ b/src/Umbraco.Core/Xml/XmlNodeListFactory.cs @@ -13,7 +13,7 @@ public class XmlNodeListFactory #region XmlNodeListIterator - private class XmlNodeListIterator : XmlNodeList + private sealed class XmlNodeListIterator : XmlNodeList { private readonly XPathNodeIterator? _iterator; private readonly IList _nodes = new List(); @@ -108,7 +108,7 @@ public class XmlNodeListFactory #region XmlNodeListEnumerator - private class XmlNodeListEnumerator : IEnumerator + private sealed class XmlNodeListEnumerator : IEnumerator { private readonly XmlNodeListIterator _iterator; private int _position = -1; diff --git a/src/Umbraco.Infrastructure/BackgroundJobs/RecurringBackgroundJobHostedServiceRunner.cs b/src/Umbraco.Infrastructure/BackgroundJobs/RecurringBackgroundJobHostedServiceRunner.cs index e86b8c64bd..a2cfed23c2 100644 --- a/src/Umbraco.Infrastructure/BackgroundJobs/RecurringBackgroundJobHostedServiceRunner.cs +++ b/src/Umbraco.Infrastructure/BackgroundJobs/RecurringBackgroundJobHostedServiceRunner.cs @@ -71,7 +71,7 @@ public class RecurringBackgroundJobHostedServiceRunner : IHostedService _logger.LogInformation("Completed stopping recurring background jobs hosted services"); } - private class NamedServiceJob + private sealed class NamedServiceJob { public NamedServiceJob(string name, IHostedService hostedService) { diff --git a/src/Umbraco.Infrastructure/Cache/FullDataSetRepositoryCachePolicy.cs b/src/Umbraco.Infrastructure/Cache/FullDataSetRepositoryCachePolicy.cs index 91ae85c84f..f57319d122 100644 --- a/src/Umbraco.Infrastructure/Cache/FullDataSetRepositoryCachePolicy.cs +++ b/src/Umbraco.Infrastructure/Cache/FullDataSetRepositoryCachePolicy.cs @@ -21,7 +21,7 @@ namespace Umbraco.Cms.Core.Cache; /// keep as a whole in memory. /// /// -internal class FullDataSetRepositoryCachePolicy : RepositoryCachePolicyBase +internal sealed class FullDataSetRepositoryCachePolicy : RepositoryCachePolicyBase where TEntity : class, IEntity { protected static readonly TId[] EmptyIds = new TId[0]; // const diff --git a/src/Umbraco.Infrastructure/Cache/SingleItemsOnlyRepositoryCachePolicy.cs b/src/Umbraco.Infrastructure/Cache/SingleItemsOnlyRepositoryCachePolicy.cs index 16079d059a..d8b0e9bb04 100644 --- a/src/Umbraco.Infrastructure/Cache/SingleItemsOnlyRepositoryCachePolicy.cs +++ b/src/Umbraco.Infrastructure/Cache/SingleItemsOnlyRepositoryCachePolicy.cs @@ -18,7 +18,7 @@ namespace Umbraco.Cms.Core.Cache; /// /// Used by DictionaryRepository. /// -internal class SingleItemsOnlyRepositoryCachePolicy : DefaultRepositoryCachePolicy +internal sealed class SingleItemsOnlyRepositoryCachePolicy : DefaultRepositoryCachePolicy where TEntity : class, IEntity { public SingleItemsOnlyRepositoryCachePolicy(IAppPolicyCache cache, IScopeAccessor scopeAccessor, RepositoryCachePolicyOptions options) diff --git a/src/Umbraco.Infrastructure/Configuration/JsonConfigManipulator.cs b/src/Umbraco.Infrastructure/Configuration/JsonConfigManipulator.cs index 1978d554dd..1800954848 100644 --- a/src/Umbraco.Infrastructure/Configuration/JsonConfigManipulator.cs +++ b/src/Umbraco.Infrastructure/Configuration/JsonConfigManipulator.cs @@ -10,7 +10,7 @@ using Umbraco.Cms.Core.Configuration.Models; namespace Umbraco.Cms.Infrastructure.Configuration; -internal class JsonConfigManipulator : IConfigManipulator +internal sealed class JsonConfigManipulator : IConfigManipulator { private const string ConnectionStringObjectName = "ConnectionStrings"; private const string UmbracoConnectionStringPath = $"{ConnectionStringObjectName}:{Constants.System.UmbracoConnectionName}"; diff --git a/src/Umbraco.Infrastructure/Examine/Deferred/DeliveryApiContentIndexHandleContentChanges.cs b/src/Umbraco.Infrastructure/Examine/Deferred/DeliveryApiContentIndexHandleContentChanges.cs index 0b4310c4b4..fb0d2c9219 100644 --- a/src/Umbraco.Infrastructure/Examine/Deferred/DeliveryApiContentIndexHandleContentChanges.cs +++ b/src/Umbraco.Infrastructure/Examine/Deferred/DeliveryApiContentIndexHandleContentChanges.cs @@ -136,7 +136,7 @@ internal sealed class DeliveryApiContentIndexHandleContentChanges : DeliveryApiC } }); - private class CulturePublishStatus : IEquatable + private sealed class CulturePublishStatus : IEquatable { public required string Culture { get; set; } diff --git a/src/Umbraco.Infrastructure/Examine/DeferredActions.cs b/src/Umbraco.Infrastructure/Examine/DeferredActions.cs index 495c12e7a7..7c417c3f92 100644 --- a/src/Umbraco.Infrastructure/Examine/DeferredActions.cs +++ b/src/Umbraco.Infrastructure/Examine/DeferredActions.cs @@ -2,7 +2,7 @@ using Umbraco.Cms.Core.Scoping; namespace Umbraco.Cms.Infrastructure.Examine; -internal class DeferredActions +internal sealed class DeferredActions { // the default enlist priority is 100 // enlist with a lower priority to ensure that anything "default" runs after us diff --git a/src/Umbraco.Infrastructure/Examine/ExamineIndexingMainDomHandler.cs b/src/Umbraco.Infrastructure/Examine/ExamineIndexingMainDomHandler.cs index fa4d184dbd..e430ba3851 100644 --- a/src/Umbraco.Infrastructure/Examine/ExamineIndexingMainDomHandler.cs +++ b/src/Umbraco.Infrastructure/Examine/ExamineIndexingMainDomHandler.cs @@ -5,7 +5,7 @@ using Umbraco.Cms.Core.Runtime; namespace Umbraco.Cms.Infrastructure.Examine; -internal class ExamineIndexingMainDomHandler +internal sealed class ExamineIndexingMainDomHandler { private readonly IMainDom _mainDom; private readonly IProfilingLogger _profilingLogger; diff --git a/src/Umbraco.Infrastructure/Examine/ExamineUmbracoIndexingHandler.cs b/src/Umbraco.Infrastructure/Examine/ExamineUmbracoIndexingHandler.cs index 2ca1bc8f79..6a24337989 100644 --- a/src/Umbraco.Infrastructure/Examine/ExamineUmbracoIndexingHandler.cs +++ b/src/Umbraco.Infrastructure/Examine/ExamineUmbracoIndexingHandler.cs @@ -14,7 +14,7 @@ namespace Umbraco.Cms.Infrastructure.Examine; /// /// Indexing handler for Examine indexes /// -internal class ExamineUmbracoIndexingHandler : IUmbracoIndexingHandler +internal sealed class ExamineUmbracoIndexingHandler : IUmbracoIndexingHandler { private readonly IBackgroundTaskQueue _backgroundTaskQueue; private readonly IContentValueSetBuilder _contentValueSetBuilder; @@ -208,7 +208,7 @@ internal class ExamineUmbracoIndexingHandler : IUmbracoIndexingHandler /// /// Re-indexes an item on a background thread /// - private class DeferredReIndexForContent : IDeferredAction + private sealed class DeferredReIndexForContent : IDeferredAction { private readonly IBackgroundTaskQueue _backgroundTaskQueue; private readonly IContent _content; @@ -271,7 +271,7 @@ internal class ExamineUmbracoIndexingHandler : IUmbracoIndexingHandler /// /// Re-indexes an item on a background thread /// - private class DeferredReIndexForMedia : IDeferredAction + private sealed class DeferredReIndexForMedia : IDeferredAction { private readonly IBackgroundTaskQueue _backgroundTaskQueue; private readonly ExamineUmbracoIndexingHandler _examineUmbracoIndexingHandler; @@ -323,7 +323,7 @@ internal class ExamineUmbracoIndexingHandler : IUmbracoIndexingHandler /// /// Re-indexes an item on a background thread /// - private class DeferredReIndexForMember : IDeferredAction + private sealed class DeferredReIndexForMember : IDeferredAction { private readonly IBackgroundTaskQueue _backgroundTaskQueue; private readonly ExamineUmbracoIndexingHandler _examineUmbracoIndexingHandler; @@ -366,7 +366,7 @@ internal class ExamineUmbracoIndexingHandler : IUmbracoIndexingHandler }); } - private class DeferredDeleteIndex : IDeferredAction + private sealed class DeferredDeleteIndex : IDeferredAction { private readonly ExamineUmbracoIndexingHandler _examineUmbracoIndexingHandler; private readonly int _id; @@ -435,7 +435,7 @@ internal class ExamineUmbracoIndexingHandler : IUmbracoIndexingHandler /// /// Removes all protected content from applicable indexes on a background thread /// - private class DeferredRemoveProtectedContent : IDeferredAction + private sealed class DeferredRemoveProtectedContent : IDeferredAction { private readonly IBackgroundTaskQueue _backgroundTaskQueue; private readonly ExamineUmbracoIndexingHandler _examineUmbracoIndexingHandler; diff --git a/src/Umbraco.Infrastructure/Logging/Serilog/Enrichers/Log4NetLevelMapperEnricher.cs b/src/Umbraco.Infrastructure/Logging/Serilog/Enrichers/Log4NetLevelMapperEnricher.cs index a8a0610d2c..eaf89aff04 100644 --- a/src/Umbraco.Infrastructure/Logging/Serilog/Enrichers/Log4NetLevelMapperEnricher.cs +++ b/src/Umbraco.Infrastructure/Logging/Serilog/Enrichers/Log4NetLevelMapperEnricher.cs @@ -7,7 +7,7 @@ namespace Umbraco.Cms.Core.Logging.Serilog.Enrichers; /// This is used to create a new property in Logs called 'Log4NetLevel' /// So that we can map Serilog levels to Log4Net levels - so log files stay consistent /// -internal class Log4NetLevelMapperEnricher : ILogEventEnricher +internal sealed class Log4NetLevelMapperEnricher : ILogEventEnricher { public void Enrich(LogEvent logEvent, ILogEventPropertyFactory propertyFactory) { diff --git a/src/Umbraco.Infrastructure/Logging/Viewer/CountingFilter.cs b/src/Umbraco.Infrastructure/Logging/Viewer/CountingFilter.cs index c5692384f6..3746f1aeab 100644 --- a/src/Umbraco.Infrastructure/Logging/Viewer/CountingFilter.cs +++ b/src/Umbraco.Infrastructure/Logging/Viewer/CountingFilter.cs @@ -2,7 +2,7 @@ using Serilog.Events; namespace Umbraco.Cms.Core.Logging.Viewer; -internal class CountingFilter : ILogFilter +internal sealed class CountingFilter : ILogFilter { public CountingFilter() => Counts = new LogLevelCounts(); diff --git a/src/Umbraco.Infrastructure/Logging/Viewer/ErrorCounterFilter.cs b/src/Umbraco.Infrastructure/Logging/Viewer/ErrorCounterFilter.cs index 834da2952e..0517550b73 100644 --- a/src/Umbraco.Infrastructure/Logging/Viewer/ErrorCounterFilter.cs +++ b/src/Umbraco.Infrastructure/Logging/Viewer/ErrorCounterFilter.cs @@ -2,7 +2,7 @@ using Serilog.Events; namespace Umbraco.Cms.Core.Logging.Viewer; -internal class ErrorCounterFilter : ILogFilter +internal sealed class ErrorCounterFilter : ILogFilter { public int Count { get; private set; } diff --git a/src/Umbraco.Infrastructure/Logging/Viewer/ExpressionFilter.cs b/src/Umbraco.Infrastructure/Logging/Viewer/ExpressionFilter.cs index 5e2130b5d3..23499f2fb0 100644 --- a/src/Umbraco.Infrastructure/Logging/Viewer/ExpressionFilter.cs +++ b/src/Umbraco.Infrastructure/Logging/Viewer/ExpressionFilter.cs @@ -6,7 +6,7 @@ using Umbraco.Extensions; namespace Umbraco.Cms.Core.Logging.Viewer; // Log Expression Filters (pass in filter exp string) -internal class ExpressionFilter : ILogFilter +internal sealed class ExpressionFilter : ILogFilter { private const string ExpressionOperators = "()+=*<>%-"; private readonly Func? _filter; @@ -57,7 +57,7 @@ internal class ExpressionFilter : ILogFilter public bool TakeLogEvent(LogEvent e) => _filter == null || _filter(e); - private Func? PerformMessageLikeFilter(string filterExpression, SerilogLegacyNameResolver serilogLegacyNameResolver) + private static Func? PerformMessageLikeFilter(string filterExpression, SerilogLegacyNameResolver serilogLegacyNameResolver) { var filterSearch = $"@Message like '%{SerilogExpression.EscapeLikeExpressionContent(filterExpression)}%'"; if (SerilogExpression.TryCompile(filterSearch, null, serilogLegacyNameResolver, out CompiledExpression? compiled, out var error)) diff --git a/src/Umbraco.Infrastructure/Logging/Viewer/MessageTemplateFilter.cs b/src/Umbraco.Infrastructure/Logging/Viewer/MessageTemplateFilter.cs index 62b040f5f1..75069d764b 100644 --- a/src/Umbraco.Infrastructure/Logging/Viewer/MessageTemplateFilter.cs +++ b/src/Umbraco.Infrastructure/Logging/Viewer/MessageTemplateFilter.cs @@ -2,7 +2,7 @@ using Serilog.Events; namespace Umbraco.Cms.Core.Logging.Viewer; -internal class MessageTemplateFilter : ILogFilter +internal sealed class MessageTemplateFilter : ILogFilter { public readonly Dictionary Counts = new(); diff --git a/src/Umbraco.Infrastructure/Logging/Viewer/SerilogJsonLogViewer.cs b/src/Umbraco.Infrastructure/Logging/Viewer/SerilogJsonLogViewer.cs index 3cf2768259..9c8dace1cf 100644 --- a/src/Umbraco.Infrastructure/Logging/Viewer/SerilogJsonLogViewer.cs +++ b/src/Umbraco.Infrastructure/Logging/Viewer/SerilogJsonLogViewer.cs @@ -5,7 +5,7 @@ using ILogger = Serilog.ILogger; namespace Umbraco.Cms.Core.Logging.Viewer; -internal class SerilogJsonLogViewer : SerilogLogViewerSourceBase +internal sealed class SerilogJsonLogViewer : SerilogLogViewerSourceBase { private const int FileSizeCap = 100; private readonly ILogger _logger; @@ -112,7 +112,7 @@ internal class SerilogJsonLogViewer : SerilogLogViewerSourceBase return logs; } - private string GetSearchPattern(DateTime day) => $"*{day:yyyyMMdd}*.json"; + private static string GetSearchPattern(DateTime day) => $"*{day:yyyyMMdd}*.json"; private bool TryRead(LogEventReader reader, out LogEvent? evt) { diff --git a/src/Umbraco.Infrastructure/Migrations/Install/DatabaseDataCreator.cs b/src/Umbraco.Infrastructure/Migrations/Install/DatabaseDataCreator.cs index 4d01ca95d9..b30423be99 100644 --- a/src/Umbraco.Infrastructure/Migrations/Install/DatabaseDataCreator.cs +++ b/src/Umbraco.Infrastructure/Migrations/Install/DatabaseDataCreator.cs @@ -17,7 +17,7 @@ namespace Umbraco.Cms.Infrastructure.Migrations.Install; /// /// Creates the initial database data during install. /// -internal class DatabaseDataCreator +internal sealed class DatabaseDataCreator { internal const string EditorGroupAlias = "editor"; diff --git a/src/Umbraco.Infrastructure/Migrations/MigrationContext.cs b/src/Umbraco.Infrastructure/Migrations/MigrationContext.cs index 173ee942c4..d73dbbee17 100644 --- a/src/Umbraco.Infrastructure/Migrations/MigrationContext.cs +++ b/src/Umbraco.Infrastructure/Migrations/MigrationContext.cs @@ -8,10 +8,9 @@ namespace Umbraco.Cms.Infrastructure.Migrations; /// /// Implements . /// -internal class MigrationContext : IMigrationContext +internal sealed class MigrationContext : IMigrationContext { private readonly Action? _onCompleteAction; - private readonly List _postMigrations = new(); /// /// Initializes a new instance of the class. diff --git a/src/Umbraco.Infrastructure/Migrations/Notifications/DatabaseSchemaCreatedNotification.cs b/src/Umbraco.Infrastructure/Migrations/Notifications/DatabaseSchemaCreatedNotification.cs index 75875b9384..8d671a8f2f 100644 --- a/src/Umbraco.Infrastructure/Migrations/Notifications/DatabaseSchemaCreatedNotification.cs +++ b/src/Umbraco.Infrastructure/Migrations/Notifications/DatabaseSchemaCreatedNotification.cs @@ -3,7 +3,7 @@ using Umbraco.Cms.Core.Notifications; namespace Umbraco.Cms.Infrastructure.Migrations.Notifications; -internal class DatabaseSchemaCreatedNotification : StatefulNotification +internal sealed class DatabaseSchemaCreatedNotification : StatefulNotification { public DatabaseSchemaCreatedNotification(EventMessages eventMessages) => EventMessages = eventMessages; diff --git a/src/Umbraco.Infrastructure/Migrations/Notifications/DatabaseSchemaCreatingNotification.cs b/src/Umbraco.Infrastructure/Migrations/Notifications/DatabaseSchemaCreatingNotification.cs index d4dfb35df7..33c6736aa5 100644 --- a/src/Umbraco.Infrastructure/Migrations/Notifications/DatabaseSchemaCreatingNotification.cs +++ b/src/Umbraco.Infrastructure/Migrations/Notifications/DatabaseSchemaCreatingNotification.cs @@ -3,7 +3,7 @@ using Umbraco.Cms.Core.Notifications; namespace Umbraco.Cms.Infrastructure.Migrations.Notifications; -internal class DatabaseSchemaCreatingNotification : CancelableNotification +internal sealed class DatabaseSchemaCreatingNotification : CancelableNotification { public DatabaseSchemaCreatingNotification(EventMessages messages) : base(messages) diff --git a/src/Umbraco.Infrastructure/Packaging/ImportPackageBuilder.cs b/src/Umbraco.Infrastructure/Packaging/ImportPackageBuilder.cs index e557181a51..ae8e525c30 100644 --- a/src/Umbraco.Infrastructure/Packaging/ImportPackageBuilder.cs +++ b/src/Umbraco.Infrastructure/Packaging/ImportPackageBuilder.cs @@ -11,7 +11,7 @@ using Umbraco.Cms.Infrastructure.Migrations.Expressions.Common; namespace Umbraco.Cms.Infrastructure.Packaging; -internal class ImportPackageBuilder : ExpressionBuilderBase, IImportPackageBuilder, +internal sealed class ImportPackageBuilder : ExpressionBuilderBase, IImportPackageBuilder, IExecutableBuilder { public ImportPackageBuilder( diff --git a/src/Umbraco.Infrastructure/Packaging/ImportPackageBuilderExpression.cs b/src/Umbraco.Infrastructure/Packaging/ImportPackageBuilderExpression.cs index 0e4bf757e8..d8303a2d67 100644 --- a/src/Umbraco.Infrastructure/Packaging/ImportPackageBuilderExpression.cs +++ b/src/Umbraco.Infrastructure/Packaging/ImportPackageBuilderExpression.cs @@ -16,7 +16,7 @@ using Umbraco.Extensions; namespace Umbraco.Cms.Infrastructure.Packaging; -internal class ImportPackageBuilderExpression : MigrationExpressionBase +internal sealed class ImportPackageBuilderExpression : MigrationExpressionBase { private readonly IContentTypeBaseServiceProvider _contentTypeBaseServiceProvider; private readonly MediaFileManager _mediaFileManager; diff --git a/src/Umbraco.Infrastructure/Persistence/DatabaseModelDefinitions/DbIndexDefinition.cs b/src/Umbraco.Infrastructure/Persistence/DatabaseModelDefinitions/DbIndexDefinition.cs index 4c2cf0a69f..0143926751 100644 --- a/src/Umbraco.Infrastructure/Persistence/DatabaseModelDefinitions/DbIndexDefinition.cs +++ b/src/Umbraco.Infrastructure/Persistence/DatabaseModelDefinitions/DbIndexDefinition.cs @@ -3,7 +3,7 @@ namespace Umbraco.Cms.Infrastructure.Persistence.DatabaseModelDefinitions; /// /// Represents a database index definition retrieved by querying the database /// -internal class DbIndexDefinition +internal sealed class DbIndexDefinition { public DbIndexDefinition(Tuple data) { diff --git a/src/Umbraco.Infrastructure/Persistence/Dtos/AccessDto.cs b/src/Umbraco.Infrastructure/Persistence/Dtos/AccessDto.cs index c5bfbc8c01..dcd62d54d3 100644 --- a/src/Umbraco.Infrastructure/Persistence/Dtos/AccessDto.cs +++ b/src/Umbraco.Infrastructure/Persistence/Dtos/AccessDto.cs @@ -8,7 +8,7 @@ namespace Umbraco.Cms.Infrastructure.Persistence.Dtos; [TableName(Constants.DatabaseSchema.Tables.Access)] [PrimaryKey("id", AutoIncrement = false)] [ExplicitColumns] -internal class AccessDto +internal sealed class AccessDto { [Column("id")] [PrimaryKeyColumn(Name = "PK_umbracoAccess", AutoIncrement = false)] diff --git a/src/Umbraco.Infrastructure/Persistence/Dtos/AccessRuleDto.cs b/src/Umbraco.Infrastructure/Persistence/Dtos/AccessRuleDto.cs index ec843c1c54..bc8c92addf 100644 --- a/src/Umbraco.Infrastructure/Persistence/Dtos/AccessRuleDto.cs +++ b/src/Umbraco.Infrastructure/Persistence/Dtos/AccessRuleDto.cs @@ -8,7 +8,7 @@ namespace Umbraco.Cms.Infrastructure.Persistence.Dtos; [TableName(Constants.DatabaseSchema.Tables.AccessRule)] [PrimaryKey("id", AutoIncrement = false)] [ExplicitColumns] -internal class AccessRuleDto +internal sealed class AccessRuleDto { [Column("id")] [PrimaryKeyColumn(Name = "PK_umbracoAccessRule", AutoIncrement = false)] diff --git a/src/Umbraco.Infrastructure/Persistence/Dtos/AuditEntryDto.cs b/src/Umbraco.Infrastructure/Persistence/Dtos/AuditEntryDto.cs index c94a680a1f..35e5121935 100644 --- a/src/Umbraco.Infrastructure/Persistence/Dtos/AuditEntryDto.cs +++ b/src/Umbraco.Infrastructure/Persistence/Dtos/AuditEntryDto.cs @@ -8,7 +8,7 @@ namespace Umbraco.Cms.Infrastructure.Persistence.Dtos; [TableName(Constants.DatabaseSchema.Tables.AuditEntry)] [PrimaryKey("id")] [ExplicitColumns] -internal class AuditEntryDto +internal sealed class AuditEntryDto { [Column("id")] [PrimaryKeyColumn] diff --git a/src/Umbraco.Infrastructure/Persistence/Dtos/AxisDefintionDto.cs b/src/Umbraco.Infrastructure/Persistence/Dtos/AxisDefintionDto.cs index 2c1c68c1f0..760fe6ccdc 100644 --- a/src/Umbraco.Infrastructure/Persistence/Dtos/AxisDefintionDto.cs +++ b/src/Umbraco.Infrastructure/Persistence/Dtos/AxisDefintionDto.cs @@ -2,7 +2,7 @@ using NPoco; namespace Umbraco.Cms.Infrastructure.Persistence.Dtos; -internal class AxisDefintionDto +internal sealed class AxisDefintionDto { [Column("nodeId")] public int NodeId { get; set; } diff --git a/src/Umbraco.Infrastructure/Persistence/Dtos/ContentScheduleDto.cs b/src/Umbraco.Infrastructure/Persistence/Dtos/ContentScheduleDto.cs index 8194448ce4..5f575b77ef 100644 --- a/src/Umbraco.Infrastructure/Persistence/Dtos/ContentScheduleDto.cs +++ b/src/Umbraco.Infrastructure/Persistence/Dtos/ContentScheduleDto.cs @@ -7,7 +7,7 @@ namespace Umbraco.Cms.Infrastructure.Persistence.Dtos; [TableName(TableName)] [PrimaryKey("id", AutoIncrement = false)] [ExplicitColumns] -internal class ContentScheduleDto +internal sealed class ContentScheduleDto { public const string TableName = Constants.DatabaseSchema.Tables.ContentSchedule; diff --git a/src/Umbraco.Infrastructure/Persistence/Dtos/ContentType2ContentTypeDto.cs b/src/Umbraco.Infrastructure/Persistence/Dtos/ContentType2ContentTypeDto.cs index 3931f2c5e5..19a3922161 100644 --- a/src/Umbraco.Infrastructure/Persistence/Dtos/ContentType2ContentTypeDto.cs +++ b/src/Umbraco.Infrastructure/Persistence/Dtos/ContentType2ContentTypeDto.cs @@ -6,7 +6,7 @@ namespace Umbraco.Cms.Infrastructure.Persistence.Dtos; [TableName(Constants.DatabaseSchema.Tables.ElementTypeTree)] [ExplicitColumns] -internal class ContentType2ContentTypeDto +internal sealed class ContentType2ContentTypeDto { [Column("parentContentTypeId")] [PrimaryKeyColumn(AutoIncrement = false, Clustered = true, Name = "PK_cmsContentType2ContentType", OnColumns = "parentContentTypeId, childContentTypeId")] diff --git a/src/Umbraco.Infrastructure/Persistence/Dtos/ContentTypeAllowedContentTypeDto.cs b/src/Umbraco.Infrastructure/Persistence/Dtos/ContentTypeAllowedContentTypeDto.cs index fec7983d1f..5f0bf8f608 100644 --- a/src/Umbraco.Infrastructure/Persistence/Dtos/ContentTypeAllowedContentTypeDto.cs +++ b/src/Umbraco.Infrastructure/Persistence/Dtos/ContentTypeAllowedContentTypeDto.cs @@ -7,7 +7,7 @@ namespace Umbraco.Cms.Infrastructure.Persistence.Dtos; [TableName(Constants.DatabaseSchema.Tables.ContentChildType)] [PrimaryKey("Id", AutoIncrement = false)] [ExplicitColumns] -internal class ContentTypeAllowedContentTypeDto +internal sealed class ContentTypeAllowedContentTypeDto { [Column("Id")] [ForeignKey(typeof(ContentTypeDto), Name = "FK_cmsContentTypeAllowedContentType_cmsContentType", Column = "nodeId")] diff --git a/src/Umbraco.Infrastructure/Persistence/Dtos/ContentTypeTemplateDto.cs b/src/Umbraco.Infrastructure/Persistence/Dtos/ContentTypeTemplateDto.cs index ad653f2759..4239937d21 100644 --- a/src/Umbraco.Infrastructure/Persistence/Dtos/ContentTypeTemplateDto.cs +++ b/src/Umbraco.Infrastructure/Persistence/Dtos/ContentTypeTemplateDto.cs @@ -7,7 +7,7 @@ namespace Umbraco.Cms.Infrastructure.Persistence.Dtos; [TableName(Constants.DatabaseSchema.Tables.DocumentType)] [PrimaryKey("contentTypeNodeId", AutoIncrement = false)] [ExplicitColumns] -internal class ContentTypeTemplateDto +internal sealed class ContentTypeTemplateDto { [Column("contentTypeNodeId")] [PrimaryKeyColumn(AutoIncrement = false, Name = "PK_cmsDocumentType", OnColumns = "contentTypeNodeId, templateNodeId")] diff --git a/src/Umbraco.Infrastructure/Persistence/Dtos/ContentVersionCleanupPolicyDto.cs b/src/Umbraco.Infrastructure/Persistence/Dtos/ContentVersionCleanupPolicyDto.cs index cdc36ad077..2e024541a7 100644 --- a/src/Umbraco.Infrastructure/Persistence/Dtos/ContentVersionCleanupPolicyDto.cs +++ b/src/Umbraco.Infrastructure/Persistence/Dtos/ContentVersionCleanupPolicyDto.cs @@ -7,7 +7,7 @@ namespace Umbraco.Cms.Infrastructure.Persistence.Dtos; [TableName(TableName)] [PrimaryKey("contentTypeId", AutoIncrement = false)] [ExplicitColumns] -internal class ContentVersionCleanupPolicyDto +internal sealed class ContentVersionCleanupPolicyDto { public const string TableName = Constants.DatabaseSchema.Tables.ContentVersionCleanupPolicy; diff --git a/src/Umbraco.Infrastructure/Persistence/Dtos/ContentVersionCultureVariationDto.cs b/src/Umbraco.Infrastructure/Persistence/Dtos/ContentVersionCultureVariationDto.cs index d77872ae20..c868ba4afb 100644 --- a/src/Umbraco.Infrastructure/Persistence/Dtos/ContentVersionCultureVariationDto.cs +++ b/src/Umbraco.Infrastructure/Persistence/Dtos/ContentVersionCultureVariationDto.cs @@ -7,7 +7,7 @@ namespace Umbraco.Cms.Infrastructure.Persistence.Dtos; [TableName(TableName)] [PrimaryKey("id")] [ExplicitColumns] -internal class ContentVersionCultureVariationDto +internal sealed class ContentVersionCultureVariationDto { public const string TableName = Constants.DatabaseSchema.Tables.ContentVersionCultureVariation; private int? _updateUserId; diff --git a/src/Umbraco.Infrastructure/Persistence/Dtos/DocumentCultureVariationDto.cs b/src/Umbraco.Infrastructure/Persistence/Dtos/DocumentCultureVariationDto.cs index e89d9cae63..e093a6ac54 100644 --- a/src/Umbraco.Infrastructure/Persistence/Dtos/DocumentCultureVariationDto.cs +++ b/src/Umbraco.Infrastructure/Persistence/Dtos/DocumentCultureVariationDto.cs @@ -7,7 +7,7 @@ namespace Umbraco.Cms.Infrastructure.Persistence.Dtos; [TableName(TableName)] [PrimaryKey("id")] [ExplicitColumns] -internal class DocumentCultureVariationDto +internal sealed class DocumentCultureVariationDto { public const string TableName = Constants.DatabaseSchema.Tables.DocumentCultureVariation; diff --git a/src/Umbraco.Infrastructure/Persistence/Dtos/DocumentPublishedReadOnlyDto.cs b/src/Umbraco.Infrastructure/Persistence/Dtos/DocumentPublishedReadOnlyDto.cs index 0087298645..04fb1017e8 100644 --- a/src/Umbraco.Infrastructure/Persistence/Dtos/DocumentPublishedReadOnlyDto.cs +++ b/src/Umbraco.Infrastructure/Persistence/Dtos/DocumentPublishedReadOnlyDto.cs @@ -6,7 +6,7 @@ namespace Umbraco.Cms.Infrastructure.Persistence.Dtos; [TableName(Constants.DatabaseSchema.Tables.Document)] [PrimaryKey("versionId", AutoIncrement = false)] [ExplicitColumns] -internal class DocumentPublishedReadOnlyDto +internal sealed class DocumentPublishedReadOnlyDto { [Column("nodeId")] public int NodeId { get; set; } diff --git a/src/Umbraco.Infrastructure/Persistence/Dtos/DomainDto.cs b/src/Umbraco.Infrastructure/Persistence/Dtos/DomainDto.cs index da5a8ad665..0d05268902 100644 --- a/src/Umbraco.Infrastructure/Persistence/Dtos/DomainDto.cs +++ b/src/Umbraco.Infrastructure/Persistence/Dtos/DomainDto.cs @@ -7,7 +7,7 @@ namespace Umbraco.Cms.Infrastructure.Persistence.Dtos; [TableName(TableName)] [PrimaryKey("id")] [ExplicitColumns] -internal class DomainDto +internal sealed class DomainDto { public const string TableName = Constants.DatabaseSchema.Tables.Domain; diff --git a/src/Umbraco.Infrastructure/Persistence/Dtos/ExternalLoginDto.cs b/src/Umbraco.Infrastructure/Persistence/Dtos/ExternalLoginDto.cs index a34c1100a2..3d84dbafe6 100644 --- a/src/Umbraco.Infrastructure/Persistence/Dtos/ExternalLoginDto.cs +++ b/src/Umbraco.Infrastructure/Persistence/Dtos/ExternalLoginDto.cs @@ -8,7 +8,7 @@ namespace Umbraco.Cms.Infrastructure.Persistence.Dtos; [TableName(TableName)] [ExplicitColumns] [PrimaryKey("Id")] -internal class ExternalLoginDto +internal sealed class ExternalLoginDto { public const string TableName = Constants.DatabaseSchema.Tables.ExternalLogin; diff --git a/src/Umbraco.Infrastructure/Persistence/Dtos/ExternalLoginTokenDto.cs b/src/Umbraco.Infrastructure/Persistence/Dtos/ExternalLoginTokenDto.cs index 9699a6ef13..7ff2622960 100644 --- a/src/Umbraco.Infrastructure/Persistence/Dtos/ExternalLoginTokenDto.cs +++ b/src/Umbraco.Infrastructure/Persistence/Dtos/ExternalLoginTokenDto.cs @@ -8,7 +8,7 @@ namespace Umbraco.Cms.Infrastructure.Persistence.Dtos; [TableName(TableName)] [ExplicitColumns] [PrimaryKey("Id")] -internal class ExternalLoginTokenDto +internal sealed class ExternalLoginTokenDto { public const string TableName = Constants.DatabaseSchema.Tables.ExternalLoginToken; diff --git a/src/Umbraco.Infrastructure/Persistence/Dtos/KeyValueDto.cs b/src/Umbraco.Infrastructure/Persistence/Dtos/KeyValueDto.cs index 6bab9b91be..51d2a74121 100644 --- a/src/Umbraco.Infrastructure/Persistence/Dtos/KeyValueDto.cs +++ b/src/Umbraco.Infrastructure/Persistence/Dtos/KeyValueDto.cs @@ -9,7 +9,7 @@ namespace Umbraco.Cms.Infrastructure.Persistence.Dtos; [TableName(Constants.DatabaseSchema.Tables.KeyValue)] [PrimaryKey("key", AutoIncrement = false)] [ExplicitColumns] -internal class KeyValueDto +internal sealed class KeyValueDto { public const string TableName = Constants.DatabaseSchema.Tables.KeyValue; diff --git a/src/Umbraco.Infrastructure/Persistence/Dtos/LanguageDto.cs b/src/Umbraco.Infrastructure/Persistence/Dtos/LanguageDto.cs index 3fe65f8322..ac63485a05 100644 --- a/src/Umbraco.Infrastructure/Persistence/Dtos/LanguageDto.cs +++ b/src/Umbraco.Infrastructure/Persistence/Dtos/LanguageDto.cs @@ -7,7 +7,7 @@ namespace Umbraco.Cms.Infrastructure.Persistence.Dtos; [TableName(TableName)] [PrimaryKey("id")] [ExplicitColumns] -internal class LanguageDto +internal sealed class LanguageDto { public const string TableName = Constants.DatabaseSchema.Tables.Language; diff --git a/src/Umbraco.Infrastructure/Persistence/Dtos/LockDto.cs b/src/Umbraco.Infrastructure/Persistence/Dtos/LockDto.cs index 5b1fce4623..c3015bfe8c 100644 --- a/src/Umbraco.Infrastructure/Persistence/Dtos/LockDto.cs +++ b/src/Umbraco.Infrastructure/Persistence/Dtos/LockDto.cs @@ -7,7 +7,7 @@ namespace Umbraco.Cms.Infrastructure.Persistence.Dtos; [TableName(Constants.DatabaseSchema.Tables.Lock)] [PrimaryKey("id", AutoIncrement = false)] [ExplicitColumns] -internal class LockDto +internal sealed class LockDto { [Column("id")] [PrimaryKeyColumn(Name = "PK_umbracoLock", AutoIncrement = false)] diff --git a/src/Umbraco.Infrastructure/Persistence/Dtos/LogDto.cs b/src/Umbraco.Infrastructure/Persistence/Dtos/LogDto.cs index 36f637fef3..20c2733bfe 100644 --- a/src/Umbraco.Infrastructure/Persistence/Dtos/LogDto.cs +++ b/src/Umbraco.Infrastructure/Persistence/Dtos/LogDto.cs @@ -8,7 +8,7 @@ namespace Umbraco.Cms.Infrastructure.Persistence.Dtos; [TableName(TableName)] [PrimaryKey("id")] [ExplicitColumns] -internal class LogDto +internal sealed class LogDto { public const string TableName = Constants.DatabaseSchema.Tables.Log; diff --git a/src/Umbraco.Infrastructure/Persistence/Dtos/LogViewerQueryDto.cs b/src/Umbraco.Infrastructure/Persistence/Dtos/LogViewerQueryDto.cs index 6de89b1c64..c71cb9b6b3 100644 --- a/src/Umbraco.Infrastructure/Persistence/Dtos/LogViewerQueryDto.cs +++ b/src/Umbraco.Infrastructure/Persistence/Dtos/LogViewerQueryDto.cs @@ -7,7 +7,7 @@ namespace Umbraco.Cms.Infrastructure.Persistence.Dtos; [TableName(Constants.DatabaseSchema.Tables.LogViewerQuery)] [PrimaryKey("id")] [ExplicitColumns] -internal class LogViewerQueryDto +internal sealed class LogViewerQueryDto { [Column("id")] [PrimaryKeyColumn] diff --git a/src/Umbraco.Infrastructure/Persistence/Dtos/MediaDto.cs b/src/Umbraco.Infrastructure/Persistence/Dtos/MediaDto.cs index bb6c672f32..6eedeca27e 100644 --- a/src/Umbraco.Infrastructure/Persistence/Dtos/MediaDto.cs +++ b/src/Umbraco.Infrastructure/Persistence/Dtos/MediaDto.cs @@ -5,7 +5,7 @@ namespace Umbraco.Cms.Infrastructure.Persistence.Dtos; // this is a special Dto that does not have a corresponding table // and is only used in our code to represent a media item, similar // to document items. -internal class MediaDto +internal sealed class MediaDto { public int NodeId { get; set; } diff --git a/src/Umbraco.Infrastructure/Persistence/Dtos/MediaVersionDto.cs b/src/Umbraco.Infrastructure/Persistence/Dtos/MediaVersionDto.cs index 223414a976..fd47f17696 100644 --- a/src/Umbraco.Infrastructure/Persistence/Dtos/MediaVersionDto.cs +++ b/src/Umbraco.Infrastructure/Persistence/Dtos/MediaVersionDto.cs @@ -7,7 +7,7 @@ namespace Umbraco.Cms.Infrastructure.Persistence.Dtos; [TableName(TableName)] [PrimaryKey("id", AutoIncrement = false)] [ExplicitColumns] -internal class MediaVersionDto +internal sealed class MediaVersionDto { public const string TableName = Constants.DatabaseSchema.Tables.MediaVersion; diff --git a/src/Umbraco.Infrastructure/Persistence/Dtos/Member2MemberGroupDto.cs b/src/Umbraco.Infrastructure/Persistence/Dtos/Member2MemberGroupDto.cs index 3fa9d3980a..99cb8d2a39 100644 --- a/src/Umbraco.Infrastructure/Persistence/Dtos/Member2MemberGroupDto.cs +++ b/src/Umbraco.Infrastructure/Persistence/Dtos/Member2MemberGroupDto.cs @@ -7,7 +7,7 @@ namespace Umbraco.Cms.Infrastructure.Persistence.Dtos; [TableName(Constants.DatabaseSchema.Tables.Member2MemberGroup)] [PrimaryKey("Member", AutoIncrement = false)] [ExplicitColumns] -internal class Member2MemberGroupDto +internal sealed class Member2MemberGroupDto { [Column("Member")] [PrimaryKeyColumn(AutoIncrement = false, Name = "PK_cmsMember2MemberGroup", OnColumns = "Member, MemberGroup")] diff --git a/src/Umbraco.Infrastructure/Persistence/Dtos/MemberDto.cs b/src/Umbraco.Infrastructure/Persistence/Dtos/MemberDto.cs index 5a025c412e..99d07e2276 100644 --- a/src/Umbraco.Infrastructure/Persistence/Dtos/MemberDto.cs +++ b/src/Umbraco.Infrastructure/Persistence/Dtos/MemberDto.cs @@ -7,7 +7,7 @@ namespace Umbraco.Cms.Infrastructure.Persistence.Dtos; [TableName(TableName)] [PrimaryKey("nodeId", AutoIncrement = false)] [ExplicitColumns] -internal class MemberDto +internal sealed class MemberDto { private const string TableName = Constants.DatabaseSchema.Tables.Member; diff --git a/src/Umbraco.Infrastructure/Persistence/Dtos/MemberPropertyTypeDto.cs b/src/Umbraco.Infrastructure/Persistence/Dtos/MemberPropertyTypeDto.cs index 5b27863c8a..e0487661ae 100644 --- a/src/Umbraco.Infrastructure/Persistence/Dtos/MemberPropertyTypeDto.cs +++ b/src/Umbraco.Infrastructure/Persistence/Dtos/MemberPropertyTypeDto.cs @@ -7,7 +7,7 @@ namespace Umbraco.Cms.Infrastructure.Persistence.Dtos; [TableName(Constants.DatabaseSchema.Tables.MemberPropertyType)] [PrimaryKey("pk")] [ExplicitColumns] -internal class MemberPropertyTypeDto +internal sealed class MemberPropertyTypeDto { [Column("pk")] [PrimaryKeyColumn] diff --git a/src/Umbraco.Infrastructure/Persistence/Dtos/NavigationDto.cs b/src/Umbraco.Infrastructure/Persistence/Dtos/NavigationDto.cs index eada4a97a4..617212c83d 100644 --- a/src/Umbraco.Infrastructure/Persistence/Dtos/NavigationDto.cs +++ b/src/Umbraco.Infrastructure/Persistence/Dtos/NavigationDto.cs @@ -5,7 +5,7 @@ namespace Umbraco.Cms.Infrastructure.Persistence.Dtos; // Used internally for representing the data needed for constructing the in-memory navigation structure. [TableName(NodeDto.TableName)] -internal class NavigationDto : INavigationModel +internal sealed class NavigationDto : INavigationModel { // Public constants to bind properties between DTOs public const string ContentTypeKeyColumnName = "contentTypeKey"; diff --git a/src/Umbraco.Infrastructure/Persistence/Dtos/PropertyDataDto.cs b/src/Umbraco.Infrastructure/Persistence/Dtos/PropertyDataDto.cs index 2158f6c586..ef7d2e85e9 100644 --- a/src/Umbraco.Infrastructure/Persistence/Dtos/PropertyDataDto.cs +++ b/src/Umbraco.Infrastructure/Persistence/Dtos/PropertyDataDto.cs @@ -8,7 +8,7 @@ namespace Umbraco.Cms.Infrastructure.Persistence.Dtos; [TableName(TableName)] [PrimaryKey("id")] [ExplicitColumns] -internal class PropertyDataDto +internal sealed class PropertyDataDto { public const string TableName = Constants.DatabaseSchema.Tables.PropertyData; public const int VarcharLength = 512; diff --git a/src/Umbraco.Infrastructure/Persistence/Dtos/PropertyTypeCommonDto.cs b/src/Umbraco.Infrastructure/Persistence/Dtos/PropertyTypeCommonDto.cs index 2645735b82..74f547646c 100644 --- a/src/Umbraco.Infrastructure/Persistence/Dtos/PropertyTypeCommonDto.cs +++ b/src/Umbraco.Infrastructure/Persistence/Dtos/PropertyTypeCommonDto.cs @@ -4,7 +4,7 @@ namespace Umbraco.Cms.Infrastructure.Persistence.Dtos; // this is PropertyTypeDto + the special property type fields for members // it is used for querying everything needed for a property type, at once -internal class PropertyTypeCommonDto : PropertyTypeDto +internal sealed class PropertyTypeCommonDto : PropertyTypeDto { [Column("memberCanEdit")] public bool CanEdit { get; set; } diff --git a/src/Umbraco.Infrastructure/Persistence/Dtos/PropertyTypeGroupDto.cs b/src/Umbraco.Infrastructure/Persistence/Dtos/PropertyTypeGroupDto.cs index 9910caaa7b..6e3bd0b70c 100644 --- a/src/Umbraco.Infrastructure/Persistence/Dtos/PropertyTypeGroupDto.cs +++ b/src/Umbraco.Infrastructure/Persistence/Dtos/PropertyTypeGroupDto.cs @@ -8,7 +8,7 @@ namespace Umbraco.Cms.Infrastructure.Persistence.Dtos; [TableName(TableName)] [PrimaryKey("id", AutoIncrement = true)] [ExplicitColumns] -internal class PropertyTypeGroupDto +internal sealed class PropertyTypeGroupDto { public const string TableName = Constants.DatabaseSchema.Tables.PropertyTypeGroup; diff --git a/src/Umbraco.Infrastructure/Persistence/Dtos/PropertyTypeGroupReadOnlyDto.cs b/src/Umbraco.Infrastructure/Persistence/Dtos/PropertyTypeGroupReadOnlyDto.cs index 9829604193..effe2acdf7 100644 --- a/src/Umbraco.Infrastructure/Persistence/Dtos/PropertyTypeGroupReadOnlyDto.cs +++ b/src/Umbraco.Infrastructure/Persistence/Dtos/PropertyTypeGroupReadOnlyDto.cs @@ -6,7 +6,7 @@ namespace Umbraco.Cms.Infrastructure.Persistence.Dtos; [TableName(Constants.DatabaseSchema.Tables.PropertyTypeGroup)] [PrimaryKey("id", AutoIncrement = true)] [ExplicitColumns] -internal class PropertyTypeGroupReadOnlyDto +internal sealed class PropertyTypeGroupReadOnlyDto { [Column("PropertyTypeGroupId")] public int? Id { get; set; } diff --git a/src/Umbraco.Infrastructure/Persistence/Dtos/PropertyTypeReadOnlyDto.cs b/src/Umbraco.Infrastructure/Persistence/Dtos/PropertyTypeReadOnlyDto.cs index 94d8436401..14c24499e6 100644 --- a/src/Umbraco.Infrastructure/Persistence/Dtos/PropertyTypeReadOnlyDto.cs +++ b/src/Umbraco.Infrastructure/Persistence/Dtos/PropertyTypeReadOnlyDto.cs @@ -6,7 +6,7 @@ namespace Umbraco.Cms.Infrastructure.Persistence.Dtos; [TableName(Constants.DatabaseSchema.Tables.PropertyType)] [PrimaryKey("id")] [ExplicitColumns] -internal class PropertyTypeReadOnlyDto +internal sealed class PropertyTypeReadOnlyDto { [Column("PropertyTypeId")] public int? Id { get; set; } diff --git a/src/Umbraco.Infrastructure/Persistence/Dtos/RedirectUrlDto.cs b/src/Umbraco.Infrastructure/Persistence/Dtos/RedirectUrlDto.cs index 3582a7eee5..49ab6c8aa4 100644 --- a/src/Umbraco.Infrastructure/Persistence/Dtos/RedirectUrlDto.cs +++ b/src/Umbraco.Infrastructure/Persistence/Dtos/RedirectUrlDto.cs @@ -7,7 +7,7 @@ namespace Umbraco.Cms.Infrastructure.Persistence.Dtos; [TableName(Constants.DatabaseSchema.Tables.RedirectUrl)] [PrimaryKey("id", AutoIncrement = false)] [ExplicitColumns] -internal class RedirectUrlDto +internal sealed class RedirectUrlDto { public const string TableName = Constants.DatabaseSchema.Tables.RedirectUrl; diff --git a/src/Umbraco.Infrastructure/Persistence/Dtos/RelationDto.cs b/src/Umbraco.Infrastructure/Persistence/Dtos/RelationDto.cs index 51c36126d5..a05fc94cd6 100644 --- a/src/Umbraco.Infrastructure/Persistence/Dtos/RelationDto.cs +++ b/src/Umbraco.Infrastructure/Persistence/Dtos/RelationDto.cs @@ -8,7 +8,7 @@ namespace Umbraco.Cms.Infrastructure.Persistence.Dtos; [TableName(Constants.DatabaseSchema.Tables.Relation)] [PrimaryKey("id")] [ExplicitColumns] -internal class RelationDto +internal sealed class RelationDto { [Column("id")] [PrimaryKeyColumn] diff --git a/src/Umbraco.Infrastructure/Persistence/Dtos/RelationTypeDto.cs b/src/Umbraco.Infrastructure/Persistence/Dtos/RelationTypeDto.cs index adefd7ae38..3856d24ce2 100644 --- a/src/Umbraco.Infrastructure/Persistence/Dtos/RelationTypeDto.cs +++ b/src/Umbraco.Infrastructure/Persistence/Dtos/RelationTypeDto.cs @@ -7,7 +7,7 @@ namespace Umbraco.Cms.Infrastructure.Persistence.Dtos; [TableName(Constants.DatabaseSchema.Tables.RelationType)] [PrimaryKey("id")] [ExplicitColumns] -internal class RelationTypeDto +internal sealed class RelationTypeDto { public const int NodeIdSeed = 10; diff --git a/src/Umbraco.Infrastructure/Persistence/Dtos/ServerRegistrationDto.cs b/src/Umbraco.Infrastructure/Persistence/Dtos/ServerRegistrationDto.cs index a91bfc6bd5..bc08d9a4a1 100644 --- a/src/Umbraco.Infrastructure/Persistence/Dtos/ServerRegistrationDto.cs +++ b/src/Umbraco.Infrastructure/Persistence/Dtos/ServerRegistrationDto.cs @@ -8,7 +8,7 @@ namespace Umbraco.Cms.Infrastructure.Persistence.Dtos; [TableName(Constants.DatabaseSchema.Tables.Server)] [PrimaryKey("id")] [ExplicitColumns] -internal class ServerRegistrationDto +internal sealed class ServerRegistrationDto { [Column("id")] [PrimaryKeyColumn(AutoIncrement = true)] diff --git a/src/Umbraco.Infrastructure/Persistence/Dtos/TagDto.cs b/src/Umbraco.Infrastructure/Persistence/Dtos/TagDto.cs index d2a68cf971..628b08974c 100644 --- a/src/Umbraco.Infrastructure/Persistence/Dtos/TagDto.cs +++ b/src/Umbraco.Infrastructure/Persistence/Dtos/TagDto.cs @@ -7,7 +7,7 @@ namespace Umbraco.Cms.Infrastructure.Persistence.Dtos; [TableName(TableName)] [PrimaryKey("id")] [ExplicitColumns] -internal class TagDto +internal sealed class TagDto { public const string TableName = Constants.DatabaseSchema.Tables.Tag; diff --git a/src/Umbraco.Infrastructure/Persistence/Dtos/TagRelationshipDto.cs b/src/Umbraco.Infrastructure/Persistence/Dtos/TagRelationshipDto.cs index f5f9fd0b38..627435b963 100644 --- a/src/Umbraco.Infrastructure/Persistence/Dtos/TagRelationshipDto.cs +++ b/src/Umbraco.Infrastructure/Persistence/Dtos/TagRelationshipDto.cs @@ -7,7 +7,7 @@ namespace Umbraco.Cms.Infrastructure.Persistence.Dtos; [TableName(TableName)] [PrimaryKey("nodeId", AutoIncrement = false)] [ExplicitColumns] -internal class TagRelationshipDto +internal sealed class TagRelationshipDto { public const string TableName = Constants.DatabaseSchema.Tables.TagRelationship; diff --git a/src/Umbraco.Infrastructure/Persistence/Dtos/TemplateDto.cs b/src/Umbraco.Infrastructure/Persistence/Dtos/TemplateDto.cs index 4355a3c983..636e152bed 100644 --- a/src/Umbraco.Infrastructure/Persistence/Dtos/TemplateDto.cs +++ b/src/Umbraco.Infrastructure/Persistence/Dtos/TemplateDto.cs @@ -7,7 +7,7 @@ namespace Umbraco.Cms.Infrastructure.Persistence.Dtos; [TableName(Constants.DatabaseSchema.Tables.Template)] [PrimaryKey("pk")] [ExplicitColumns] -internal class TemplateDto +internal sealed class TemplateDto { [Column("pk")] [PrimaryKeyColumn] diff --git a/src/Umbraco.Infrastructure/Persistence/Dtos/TwoFactorLoginDto.cs b/src/Umbraco.Infrastructure/Persistence/Dtos/TwoFactorLoginDto.cs index 760419a307..f40231cb6d 100644 --- a/src/Umbraco.Infrastructure/Persistence/Dtos/TwoFactorLoginDto.cs +++ b/src/Umbraco.Infrastructure/Persistence/Dtos/TwoFactorLoginDto.cs @@ -7,7 +7,7 @@ namespace Umbraco.Cms.Infrastructure.Persistence.Dtos; [TableName(TableName)] [ExplicitColumns] [PrimaryKey("Id")] -internal class TwoFactorLoginDto +internal sealed class TwoFactorLoginDto { public const string TableName = Constants.DatabaseSchema.Tables.TwoFactorLogin; diff --git a/src/Umbraco.Infrastructure/Persistence/Dtos/User2NodeNotifyDto.cs b/src/Umbraco.Infrastructure/Persistence/Dtos/User2NodeNotifyDto.cs index a6aaba41ea..e25bad1f55 100644 --- a/src/Umbraco.Infrastructure/Persistence/Dtos/User2NodeNotifyDto.cs +++ b/src/Umbraco.Infrastructure/Persistence/Dtos/User2NodeNotifyDto.cs @@ -7,7 +7,7 @@ namespace Umbraco.Cms.Infrastructure.Persistence.Dtos; [TableName(Constants.DatabaseSchema.Tables.User2NodeNotify)] [PrimaryKey("userId", AutoIncrement = false)] [ExplicitColumns] -internal class User2NodeNotifyDto +internal sealed class User2NodeNotifyDto { [Column("userId")] [PrimaryKeyColumn(AutoIncrement = false, Name = "PK_umbracoUser2NodeNotify", OnColumns = "userId, nodeId, action")] diff --git a/src/Umbraco.Infrastructure/Persistence/Dtos/UserGroup2GranularPermissionDto.cs b/src/Umbraco.Infrastructure/Persistence/Dtos/UserGroup2GranularPermissionDto.cs index 9a6ebe294c..68f2e35bcb 100644 --- a/src/Umbraco.Infrastructure/Persistence/Dtos/UserGroup2GranularPermissionDto.cs +++ b/src/Umbraco.Infrastructure/Persistence/Dtos/UserGroup2GranularPermissionDto.cs @@ -35,7 +35,7 @@ public class UserGroup2GranularPermissionDto // this is UserGroup2GranularPermissionDto + int ids // it is used for handling legacy cases where we use int Ids -internal class UserGroup2GranularPermissionWithIdsDto : UserGroup2GranularPermissionDto +internal sealed class UserGroup2GranularPermissionWithIdsDto : UserGroup2GranularPermissionDto { [Column("entityId")] public int EntityId { get; set; } diff --git a/src/Umbraco.Infrastructure/Persistence/Dtos/UserGroup2NodeDto.cs b/src/Umbraco.Infrastructure/Persistence/Dtos/UserGroup2NodeDto.cs index 3c26abea76..afc21fb6f0 100644 --- a/src/Umbraco.Infrastructure/Persistence/Dtos/UserGroup2NodeDto.cs +++ b/src/Umbraco.Infrastructure/Persistence/Dtos/UserGroup2NodeDto.cs @@ -7,7 +7,7 @@ namespace Umbraco.Cms.Infrastructure.Persistence.Dtos; [Obsolete("Will be removed in Umbraco 18.")] [TableName(TableName)] [ExplicitColumns] -internal class UserGroup2NodeDto +internal sealed class UserGroup2NodeDto { public const string TableName = Constants.DatabaseSchema.Tables.UserGroup2Node; diff --git a/src/Umbraco.Infrastructure/Persistence/Dtos/UserLoginDto.cs b/src/Umbraco.Infrastructure/Persistence/Dtos/UserLoginDto.cs index bf52e3fd9c..1c6d2d3464 100644 --- a/src/Umbraco.Infrastructure/Persistence/Dtos/UserLoginDto.cs +++ b/src/Umbraco.Infrastructure/Persistence/Dtos/UserLoginDto.cs @@ -7,7 +7,7 @@ namespace Umbraco.Cms.Infrastructure.Persistence.Dtos; [TableName(TableName)] [PrimaryKey("sessionId", AutoIncrement = false)] [ExplicitColumns] -internal class UserLoginDto +internal sealed class UserLoginDto { public const string TableName = Constants.DatabaseSchema.Tables.UserLogin; diff --git a/src/Umbraco.Infrastructure/Persistence/Dtos/UserNotificationDto.cs b/src/Umbraco.Infrastructure/Persistence/Dtos/UserNotificationDto.cs index 327bb69b63..53242be6cb 100644 --- a/src/Umbraco.Infrastructure/Persistence/Dtos/UserNotificationDto.cs +++ b/src/Umbraco.Infrastructure/Persistence/Dtos/UserNotificationDto.cs @@ -2,7 +2,7 @@ using NPoco; namespace Umbraco.Cms.Infrastructure.Persistence.Dtos; -internal class UserNotificationDto +internal sealed class UserNotificationDto { [Column("nodeId")] public int NodeId { get; set; } diff --git a/src/Umbraco.Infrastructure/Persistence/Dtos/WebhookDto.cs b/src/Umbraco.Infrastructure/Persistence/Dtos/WebhookDto.cs index dac753fb06..0851d40aad 100644 --- a/src/Umbraco.Infrastructure/Persistence/Dtos/WebhookDto.cs +++ b/src/Umbraco.Infrastructure/Persistence/Dtos/WebhookDto.cs @@ -8,7 +8,7 @@ namespace Umbraco.Cms.Infrastructure.Persistence.Dtos; [TableName(Constants.DatabaseSchema.Tables.Webhook)] [PrimaryKey("id")] [ExplicitColumns] -internal class WebhookDto +internal sealed class WebhookDto { [Column("id")] [PrimaryKeyColumn(AutoIncrement = true)] diff --git a/src/Umbraco.Infrastructure/Persistence/Dtos/WebhookLogDto.cs b/src/Umbraco.Infrastructure/Persistence/Dtos/WebhookLogDto.cs index d5de4bd008..fe02955e07 100644 --- a/src/Umbraco.Infrastructure/Persistence/Dtos/WebhookLogDto.cs +++ b/src/Umbraco.Infrastructure/Persistence/Dtos/WebhookLogDto.cs @@ -7,7 +7,7 @@ namespace Umbraco.Cms.Infrastructure.Persistence.Dtos; [TableName(Constants.DatabaseSchema.Tables.WebhookLog)] [PrimaryKey("id")] [ExplicitColumns] -internal class WebhookLogDto +internal sealed class WebhookLogDto { [Column("id")] [PrimaryKeyColumn(AutoIncrement = true)] diff --git a/src/Umbraco.Infrastructure/Persistence/Factories/ContentBaseFactory.cs b/src/Umbraco.Infrastructure/Persistence/Factories/ContentBaseFactory.cs index ffcc6447eb..01817252dc 100644 --- a/src/Umbraco.Infrastructure/Persistence/Factories/ContentBaseFactory.cs +++ b/src/Umbraco.Infrastructure/Persistence/Factories/ContentBaseFactory.cs @@ -6,7 +6,7 @@ using Umbraco.Cms.Infrastructure.Persistence.Dtos; namespace Umbraco.Cms.Infrastructure.Persistence.Factories; -internal class ContentBaseFactory +internal sealed class ContentBaseFactory { /// /// Builds an IContent item from a dto and content type. diff --git a/src/Umbraco.Infrastructure/Persistence/FaultHandling/RetryDbConnection.cs b/src/Umbraco.Infrastructure/Persistence/FaultHandling/RetryDbConnection.cs index c6a3976637..8e0820c833 100644 --- a/src/Umbraco.Infrastructure/Persistence/FaultHandling/RetryDbConnection.cs +++ b/src/Umbraco.Infrastructure/Persistence/FaultHandling/RetryDbConnection.cs @@ -87,7 +87,7 @@ public class RetryDbConnection : DbConnection OnStateChange(stateChangeEventArguments); } -internal class FaultHandlingDbCommand : DbCommand +internal sealed class FaultHandlingDbCommand : DbCommand { private readonly RetryPolicy _cmdRetryPolicy; private RetryDbConnection _connection; diff --git a/src/Umbraco.Infrastructure/Persistence/Querying/CachedExpression.cs b/src/Umbraco.Infrastructure/Persistence/Querying/CachedExpression.cs index 2f3041fb33..da50695064 100644 --- a/src/Umbraco.Infrastructure/Persistence/Querying/CachedExpression.cs +++ b/src/Umbraco.Infrastructure/Persistence/Querying/CachedExpression.cs @@ -5,7 +5,7 @@ namespace Umbraco.Cms.Infrastructure.Persistence.Querying; /// /// Represents an expression which caches the visitor's result. /// -internal class CachedExpression : Expression +internal sealed class CachedExpression : Expression { private string _visitResult = null!; diff --git a/src/Umbraco.Infrastructure/Persistence/Querying/ModelToSqlExpressionVisitor.cs b/src/Umbraco.Infrastructure/Persistence/Querying/ModelToSqlExpressionVisitor.cs index 4c1044a411..42eb5e265c 100644 --- a/src/Umbraco.Infrastructure/Persistence/Querying/ModelToSqlExpressionVisitor.cs +++ b/src/Umbraco.Infrastructure/Persistence/Querying/ModelToSqlExpressionVisitor.cs @@ -10,7 +10,7 @@ namespace Umbraco.Cms.Infrastructure.Persistence.Querying; /// based on Umbraco's business logic models. /// /// This object is stateful and cannot be re-used to parse an expression. -internal class ModelToSqlExpressionVisitor : ExpressionVisitorBase +internal sealed class ModelToSqlExpressionVisitor : ExpressionVisitorBase { private readonly BaseMapper? _mapper; private readonly IMapperCollection? _mappers; diff --git a/src/Umbraco.Infrastructure/Persistence/Querying/PocoToSqlExpressionVisitor.cs b/src/Umbraco.Infrastructure/Persistence/Querying/PocoToSqlExpressionVisitor.cs index f7aba72bf0..8ed39c6c10 100644 --- a/src/Umbraco.Infrastructure/Persistence/Querying/PocoToSqlExpressionVisitor.cs +++ b/src/Umbraco.Infrastructure/Persistence/Querying/PocoToSqlExpressionVisitor.cs @@ -9,7 +9,7 @@ namespace Umbraco.Cms.Infrastructure.Persistence.Querying; /// /// The type of the DTO. /// This visitor is stateful and cannot be reused. -internal class PocoToSqlExpressionVisitor : ExpressionVisitorBase +internal sealed class PocoToSqlExpressionVisitor : ExpressionVisitorBase { private readonly string? _alias; private readonly PocoData _pd; @@ -96,7 +96,7 @@ internal class PocoToSqlExpressionVisitor : ExpressionVisitorBase return Visited ? string.Empty : "@" + (SqlParameters.Count - 1); } - protected virtual string GetFieldName(PocoData pocoData, string name, string? alias) + private string GetFieldName(PocoData pocoData, string name, string? alias) { KeyValuePair column = pocoData.Columns.FirstOrDefault(x => x.Value.MemberInfoData.Name == name); @@ -113,7 +113,7 @@ internal class PocoToSqlExpressionVisitor : ExpressionVisitorBase /// The type of DTO 1. /// The type of DTO 2. /// This visitor is stateful and cannot be reused. -internal class PocoToSqlExpressionVisitor : ExpressionVisitorBase +internal sealed class PocoToSqlExpressionVisitor : ExpressionVisitorBase { private readonly string? _alias1; private readonly string? _alias2; @@ -194,7 +194,7 @@ internal class PocoToSqlExpressionVisitor : ExpressionVisitorBase return Visited ? string.Empty : "@" + (SqlParameters.Count - 1); } - protected virtual string GetFieldName(PocoData pocoData, string name, string? alias) + private string GetFieldName(PocoData pocoData, string name, string? alias) { KeyValuePair column = pocoData.Columns.FirstOrDefault(x => x.Value.MemberInfoData.Name == name); @@ -212,7 +212,7 @@ internal class PocoToSqlExpressionVisitor : ExpressionVisitorBase /// The type of DTO 2. /// The type of DTO 3. /// This visitor is stateful and cannot be reused. -internal class PocoToSqlExpressionVisitor : ExpressionVisitorBase +internal sealed class PocoToSqlExpressionVisitor : ExpressionVisitorBase { private readonly string? _alias1; private readonly string? _alias2; @@ -309,7 +309,7 @@ internal class PocoToSqlExpressionVisitor : ExpressionVisit return Visited ? string.Empty : "@" + (SqlParameters.Count - 1); } - protected virtual string GetFieldName(PocoData pocoData, string name, string? alias) + private string GetFieldName(PocoData pocoData, string name, string? alias) { KeyValuePair column = pocoData.Columns.FirstOrDefault(x => x.Value.MemberInfoData.Name == name); diff --git a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/AuditEntryRepository.cs b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/AuditEntryRepository.cs index eab408823e..acaa37ba1b 100644 --- a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/AuditEntryRepository.cs +++ b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/AuditEntryRepository.cs @@ -16,7 +16,7 @@ namespace Umbraco.Cms.Infrastructure.Persistence.Repositories.Implement; /// /// Represents the NPoco implementation of . /// -internal class AuditEntryRepository : EntityRepositoryBase, IAuditEntryRepository +internal sealed class AuditEntryRepository : EntityRepositoryBase, IAuditEntryRepository { /// /// Initializes a new instance of the class. diff --git a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/AuditRepository.cs b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/AuditRepository.cs index e112e360d0..35aa220880 100644 --- a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/AuditRepository.cs +++ b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/AuditRepository.cs @@ -12,7 +12,7 @@ using Umbraco.Extensions; namespace Umbraco.Cms.Infrastructure.Persistence.Repositories.Implement; -internal class AuditRepository : EntityRepositoryBase, IAuditRepository +internal sealed class AuditRepository : EntityRepositoryBase, IAuditRepository { public AuditRepository(IScopeAccessor scopeAccessor, ILogger logger) : base(scopeAccessor, AppCaches.NoCache, logger) diff --git a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/CacheInstructionRepository.cs b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/CacheInstructionRepository.cs index 208d0928a3..9356ee1a7d 100644 --- a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/CacheInstructionRepository.cs +++ b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/CacheInstructionRepository.cs @@ -11,7 +11,7 @@ namespace Umbraco.Cms.Infrastructure.Persistence.Repositories.Implement; /// /// Represents the NPoco implementation of . /// -internal class CacheInstructionRepository : ICacheInstructionRepository +internal sealed class CacheInstructionRepository : ICacheInstructionRepository { private readonly IScopeAccessor _scopeAccessor; diff --git a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/ConsentRepository.cs b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/ConsentRepository.cs index 74f3a419e5..c211bc590d 100644 --- a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/ConsentRepository.cs +++ b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/ConsentRepository.cs @@ -15,7 +15,7 @@ namespace Umbraco.Cms.Infrastructure.Persistence.Repositories.Implement; /// /// Represents the NPoco implementation of . /// -internal class ConsentRepository : EntityRepositoryBase, IConsentRepository +internal sealed class ConsentRepository : EntityRepositoryBase, IConsentRepository { /// /// Initializes a new instance of the class. diff --git a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/ContentRepositoryBase.cs b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/ContentRepositoryBase.cs index ce30372d35..bc5b2c7954 100644 --- a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/ContentRepositoryBase.cs +++ b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/ContentRepositoryBase.cs @@ -1231,7 +1231,7 @@ namespace Umbraco.Cms.Infrastructure.Persistence.Repositories.Implement } } - private class NodeIdKey + private sealed class NodeIdKey { [Column("id")] public int NodeId { get; set; } diff --git a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/ContentTypeCommonRepository.cs b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/ContentTypeCommonRepository.cs index edb5d9e617..f4b041b629 100644 --- a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/ContentTypeCommonRepository.cs +++ b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/ContentTypeCommonRepository.cs @@ -16,7 +16,7 @@ namespace Umbraco.Cms.Infrastructure.Persistence.Repositories.Implement; /// /// Implements . /// -internal class ContentTypeCommonRepository : IContentTypeCommonRepository +internal sealed class ContentTypeCommonRepository : IContentTypeCommonRepository { private const string CacheKey = "Umbraco.Core.Persistence.Repositories.Implement.ContentTypeCommonRepository::AllTypes"; @@ -369,7 +369,7 @@ internal class ContentTypeCommonRepository : IContentTypeCommonRepository } } - private PropertyGroup MapPropertyGroup(PropertyTypeGroupDto dto, bool isPublishing) => + private static PropertyGroup MapPropertyGroup(PropertyTypeGroupDto dto, bool isPublishing) => new(new PropertyTypeCollection(isPublishing)) { Id = dto.Id, diff --git a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/ContentTypeRepository.cs b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/ContentTypeRepository.cs index e1672beda9..eece5ab48f 100644 --- a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/ContentTypeRepository.cs +++ b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/ContentTypeRepository.cs @@ -18,7 +18,7 @@ namespace Umbraco.Cms.Infrastructure.Persistence.Repositories.Implement; /// /// Represents a repository for doing CRUD operations for /// -internal class ContentTypeRepository : ContentTypeRepositoryBase, IContentTypeRepository +internal sealed class ContentTypeRepository : ContentTypeRepositoryBase, IContentTypeRepository { public ContentTypeRepository( IScopeAccessor scopeAccessor, diff --git a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/ContentTypeRepositoryBase.cs b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/ContentTypeRepositoryBase.cs index ae843ddfad..d9dc0434be 100644 --- a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/ContentTypeRepositoryBase.cs +++ b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/ContentTypeRepositoryBase.cs @@ -1593,7 +1593,7 @@ WHERE {Constants.DatabaseSchema.Tables.Content}.nodeId IN (@ids) AND cmsContentT ?? Array.Empty<(TEntity, int)>(); } - private class NameCompareDto + private sealed class NameCompareDto { public int NodeId { get; set; } @@ -1612,7 +1612,7 @@ WHERE {Constants.DatabaseSchema.Tables.Content}.nodeId IN (@ids) AND cmsContentT public bool Edited { get; set; } } - private class PropertyValueVersionDto + private sealed class PropertyValueVersionDto { private decimal? _decimalValue; diff --git a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/DataTypeContainerRepository.cs b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/DataTypeContainerRepository.cs index c7321063ad..33d7201b31 100644 --- a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/DataTypeContainerRepository.cs +++ b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/DataTypeContainerRepository.cs @@ -6,7 +6,7 @@ using Umbraco.Cms.Infrastructure.Scoping; namespace Umbraco.Cms.Infrastructure.Persistence.Repositories.Implement; -internal class DataTypeContainerRepository : EntityContainerRepository, IDataTypeContainerRepository +internal sealed class DataTypeContainerRepository : EntityContainerRepository, IDataTypeContainerRepository { public DataTypeContainerRepository( IScopeAccessor scopeAccessor, @@ -15,5 +15,4 @@ internal class DataTypeContainerRepository : EntityContainerRepository, IDataTyp : base(scopeAccessor, cache, logger, Constants.ObjectTypes.DataTypeContainer) { } - } diff --git a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/DataTypeRepository.cs b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/DataTypeRepository.cs index a8f6031ca8..6dc12aa658 100644 --- a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/DataTypeRepository.cs +++ b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/DataTypeRepository.cs @@ -1,7 +1,5 @@ using System.Data; using System.Globalization; -using System.Linq.Expressions; -using System.Reflection; using Microsoft.Extensions.Logging; using NPoco; using Umbraco.Cms.Core; @@ -16,7 +14,6 @@ using Umbraco.Cms.Core.Serialization; using Umbraco.Cms.Core.Services; using Umbraco.Cms.Infrastructure.Persistence.Dtos; using Umbraco.Cms.Infrastructure.Persistence.Factories; -using Umbraco.Cms.Infrastructure.Persistence.Mappers; using Umbraco.Cms.Infrastructure.Persistence.Querying; using Umbraco.Cms.Infrastructure.Scoping; using Umbraco.Extensions; @@ -27,7 +24,7 @@ namespace Umbraco.Cms.Infrastructure.Persistence.Repositories.Implement; /// /// Represents a repository for doing CRUD operations for /// -internal class DataTypeRepository : EntityRepositoryBase, IDataTypeRepository +internal sealed class DataTypeRepository : EntityRepositoryBase, IDataTypeRepository { private readonly ILogger _dataTypeLogger; private readonly PropertyEditorCollection _editors; @@ -234,7 +231,7 @@ internal class DataTypeRepository : EntityRepositoryBase, IDataT } [TableName(Constants.DatabaseSchema.Tables.ContentType)] - private class ContentTypeReferenceDto : ContentTypeDto + private sealed class ContentTypeReferenceDto : ContentTypeDto { [ResultColumn] [Reference(ReferenceType.Many)] @@ -242,7 +239,7 @@ internal class DataTypeRepository : EntityRepositoryBase, IDataT } [TableName(Constants.DatabaseSchema.Tables.PropertyType)] - private class PropertyTypeReferenceDto + private sealed class PropertyTypeReferenceDto { [Column("ptAlias")] public string? Alias { get; set; } diff --git a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/DictionaryRepository.cs b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/DictionaryRepository.cs index fc6c380dac..b8215b40ed 100644 --- a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/DictionaryRepository.cs +++ b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/DictionaryRepository.cs @@ -17,7 +17,7 @@ namespace Umbraco.Cms.Infrastructure.Persistence.Repositories.Implement; /// /// Represents a repository for doing CRUD operations for /// -internal class DictionaryRepository : EntityRepositoryBase, IDictionaryRepository +internal sealed class DictionaryRepository : EntityRepositoryBase, IDictionaryRepository { private readonly ILoggerFactory _loggerFactory; private readonly ILanguageRepository _languageRepository; @@ -128,7 +128,7 @@ internal class DictionaryRepository : EntityRepositoryBase return new SingleItemsOnlyRepositoryCachePolicy(GlobalIsolatedCache, ScopeAccessor, options); } - private IDictionaryItem ConvertFromDto(DictionaryDto dto, IDictionary languagesById) + private static IDictionaryItem ConvertFromDto(DictionaryDto dto, IDictionary languagesById) { IDictionaryItem entity = DictionaryItemFactory.BuildEntity(dto); @@ -174,14 +174,14 @@ internal class DictionaryRepository : EntityRepositoryBase return Get(query); } - private class DictionaryItemKeyIdDto + private sealed class DictionaryItemKeyIdDto { public string Key { get; } = null!; public Guid Id { get; set; } } - private class DictionaryByUniqueIdRepository : SimpleGetRepository + private sealed class DictionaryByUniqueIdRepository : SimpleGetRepository { private readonly DictionaryRepository _dictionaryRepository; private readonly IDictionary _languagesById; @@ -204,7 +204,7 @@ internal class DictionaryRepository : EntityRepositoryBase "cmsDictionary." + SqlSyntax.GetQuotedColumnName("id") + " = @id"; protected override IDictionaryItem ConvertToEntity(DictionaryDto dto) => - _dictionaryRepository.ConvertFromDto(dto, _languagesById); + ConvertFromDto(dto, _languagesById); protected override object GetBaseWhereClauseArguments(Guid id) => new { id }; @@ -236,7 +236,7 @@ internal class DictionaryRepository : EntityRepositoryBase } } - private class DictionaryByKeyRepository : SimpleGetRepository + private sealed class DictionaryByKeyRepository : SimpleGetRepository { private readonly DictionaryRepository _dictionaryRepository; private readonly IDictionary _languagesById; @@ -259,7 +259,7 @@ internal class DictionaryRepository : EntityRepositoryBase "cmsDictionary." + SqlSyntax.GetQuotedColumnName("key") + " = @id"; protected override IDictionaryItem ConvertToEntity(DictionaryDto dto) => - _dictionaryRepository.ConvertFromDto(dto, _languagesById); + ConvertFromDto(dto, _languagesById); protected override object GetBaseWhereClauseArguments(string? id) => new { id }; diff --git a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/DocumentBlueprintContainerRepository.cs b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/DocumentBlueprintContainerRepository.cs index 720f94d04e..fd66e01ec0 100644 --- a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/DocumentBlueprintContainerRepository.cs +++ b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/DocumentBlueprintContainerRepository.cs @@ -6,7 +6,7 @@ using Umbraco.Cms.Infrastructure.Scoping; namespace Umbraco.Cms.Infrastructure.Persistence.Repositories.Implement; -internal class DocumentBlueprintContainerRepository : EntityContainerRepository, IDocumentBlueprintContainerRepository +internal sealed class DocumentBlueprintContainerRepository : EntityContainerRepository, IDocumentBlueprintContainerRepository { public DocumentBlueprintContainerRepository( IScopeAccessor scopeAccessor, diff --git a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/DocumentBlueprintRepository.cs b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/DocumentBlueprintRepository.cs index 5bd2844405..87509a1cf4 100644 --- a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/DocumentBlueprintRepository.cs +++ b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/DocumentBlueprintRepository.cs @@ -20,7 +20,7 @@ namespace Umbraco.Cms.Infrastructure.Persistence.Repositories.Implement; /// perform a lot of the underlying logic. /// TODO: Create a helper method to contain most of the underlying logic for the ContentRepository /// -internal class DocumentBlueprintRepository : DocumentRepository, IDocumentBlueprintRepository +internal sealed class DocumentBlueprintRepository : DocumentRepository, IDocumentBlueprintRepository { public DocumentBlueprintRepository( IScopeAccessor scopeAccessor, diff --git a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/DocumentRepository.cs b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/DocumentRepository.cs index 1b4f2b1efd..687a878c83 100644 --- a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/DocumentRepository.cs +++ b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/DocumentRepository.cs @@ -576,14 +576,14 @@ public class DocumentRepository : ContentRepositoryBase IRepository -> IReadRepository which should all be separate things! // This sub-repository pattern is super old and totally unecessary anymore, caching can be handled in much nicer ways without this - private class ContentByGuidReadRepository : EntityRepositoryBase + private sealed class ContentByGuidReadRepository : EntityRepositoryBase { private readonly DocumentRepository _outerRepo; @@ -1821,7 +1821,7 @@ public class DocumentRepository : ContentRepositoryBase logger) : base(scopeAccessor, cache, logger, Constants.ObjectTypes.DocumentTypeContainer) diff --git a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/DocumentVersionRepository.cs b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/DocumentVersionRepository.cs index ef9dd67520..2f2ac7b368 100644 --- a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/DocumentVersionRepository.cs +++ b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/DocumentVersionRepository.cs @@ -9,7 +9,7 @@ using Umbraco.Extensions; namespace Umbraco.Cms.Infrastructure.Persistence.Repositories.Implement; -internal class DocumentVersionRepository : IDocumentVersionRepository +internal sealed class DocumentVersionRepository : IDocumentVersionRepository { private readonly IScopeAccessor _scopeAccessor; diff --git a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/DomainRepository.cs b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/DomainRepository.cs index b1ab5f9437..810dd5fe38 100644 --- a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/DomainRepository.cs +++ b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/DomainRepository.cs @@ -13,7 +13,7 @@ using Umbraco.Extensions; namespace Umbraco.Cms.Infrastructure.Persistence.Repositories.Implement; -internal class DomainRepository : EntityRepositoryBase, IDomainRepository +internal sealed class DomainRepository : EntityRepositoryBase, IDomainRepository { public DomainRepository(IScopeAccessor scopeAccessor, AppCaches cache, ILogger logger) : base(scopeAccessor, cache, logger) diff --git a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/EntityRepository.cs b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/EntityRepository.cs index 5e107bd71d..c39545f6be 100644 --- a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/EntityRepository.cs +++ b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/EntityRepository.cs @@ -21,7 +21,7 @@ namespace Umbraco.Cms.Infrastructure.Persistence.Repositories.Implement; /// Limited to objects that have a corresponding node (in umbracoNode table). /// Returns objects, i.e. lightweight representation of entities. /// -internal class EntityRepository : RepositoryBase, IEntityRepositoryExtended +internal sealed class EntityRepository : RepositoryBase, IEntityRepositoryExtended { public EntityRepository(IScopeAccessor scopeAccessor, AppCaches appCaches) : base(scopeAccessor, appCaches) @@ -782,7 +782,7 @@ internal class EntityRepository : RepositoryBase, IEntityRepositoryExtended /// /// The DTO used to fetch results for a generic content item which could be either a document, media or a member /// - private class GenericContentEntityDto : DocumentEntityDto + private sealed class GenericContentEntityDto : DocumentEntityDto { public string? MediaPath { get; set; } } @@ -801,7 +801,7 @@ internal class EntityRepository : RepositoryBase, IEntityRepositoryExtended /// /// The DTO used to fetch results for a media item with its media path info /// - private class MediaEntityDto : BaseDto + private sealed class MediaEntityDto : BaseDto { public string? MediaPath { get; set; } } @@ -809,7 +809,7 @@ internal class EntityRepository : RepositoryBase, IEntityRepositoryExtended /// /// The DTO used to fetch results for a member item /// - private class MemberEntityDto : BaseDto + private sealed class MemberEntityDto : BaseDto { } @@ -917,7 +917,7 @@ internal class EntityRepository : RepositoryBase, IEntityRepositoryExtended entity.ListViewKey = dto.ListView; } - private MediaEntitySlim BuildMediaEntity(BaseDto dto) + private static MediaEntitySlim BuildMediaEntity(BaseDto dto) { // EntitySlim does not track changes var entity = new MediaEntitySlim(); @@ -936,7 +936,7 @@ internal class EntityRepository : RepositoryBase, IEntityRepositoryExtended return entity; } - private DocumentEntitySlim BuildDocumentEntity(BaseDto dto) + private static DocumentEntitySlim BuildDocumentEntity(BaseDto dto) { // EntitySlim does not track changes var entity = new DocumentEntitySlim(); @@ -953,7 +953,7 @@ internal class EntityRepository : RepositoryBase, IEntityRepositoryExtended return entity; } - private MemberEntitySlim BuildMemberEntity(BaseDto dto) + private static MemberEntitySlim BuildMemberEntity(BaseDto dto) { // EntitySlim does not track changes var entity = new MemberEntitySlim(); diff --git a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/ExternalLoginRepository.cs b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/ExternalLoginRepository.cs index 1ba91ab3e1..fd64293b7a 100644 --- a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/ExternalLoginRepository.cs +++ b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/ExternalLoginRepository.cs @@ -14,7 +14,7 @@ using Umbraco.Extensions; namespace Umbraco.Cms.Infrastructure.Persistence.Repositories.Implement; -internal class ExternalLoginRepository : EntityRepositoryBase, IExternalLoginWithKeyRepository +internal sealed class ExternalLoginRepository : EntityRepositoryBase, IExternalLoginWithKeyRepository { public ExternalLoginRepository(IScopeAccessor scopeAccessor, AppCaches cache, ILogger logger) @@ -263,7 +263,7 @@ internal class ExternalLoginRepository : EntityRepositoryBase ConvertFromDtos(IEnumerable dtos) + private static IEnumerable ConvertFromDtos(IEnumerable dtos) { foreach (IIdentityUserLogin entity in dtos.Select(ExternalLoginFactory.BuildEntity)) { diff --git a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/KeyValueRepository.cs b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/KeyValueRepository.cs index c7259df863..1d1a07802a 100644 --- a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/KeyValueRepository.cs +++ b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/KeyValueRepository.cs @@ -12,7 +12,7 @@ using Umbraco.Extensions; namespace Umbraco.Cms.Infrastructure.Persistence.Repositories.Implement; -internal class KeyValueRepository : EntityRepositoryBase, IKeyValueRepository +internal sealed class KeyValueRepository : EntityRepositoryBase, IKeyValueRepository { public KeyValueRepository(IScopeAccessor scopeAccessor, ILogger logger) : base(scopeAccessor, AppCaches.NoCache, logger) diff --git a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/LanguageRepository.cs b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/LanguageRepository.cs index 5097c99fa4..cc78a4f648 100644 --- a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/LanguageRepository.cs +++ b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/LanguageRepository.cs @@ -16,7 +16,7 @@ namespace Umbraco.Cms.Infrastructure.Persistence.Repositories.Implement; /// /// Represents a repository for doing CRUD operations for /// -internal class LanguageRepository : EntityRepositoryBase, ILanguageRepository +internal sealed class LanguageRepository : EntityRepositoryBase, ILanguageRepository { // We need to lock this dictionary every time we do an operation on it as the languageRepository is registered as a unique implementation // It is used to quickly get isoCodes by Id, or the reverse by avoiding (deep)cloning dtos diff --git a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/LocalFileSystemTemporaryFileRepository.cs b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/LocalFileSystemTemporaryFileRepository.cs index 94cb6a9bf0..0190cd2034 100644 --- a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/LocalFileSystemTemporaryFileRepository.cs +++ b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/LocalFileSystemTemporaryFileRepository.cs @@ -158,7 +158,7 @@ internal sealed class LocalFileSystemTemporaryFileRepository : ITemporaryFileRep throw new InvalidOperationException("Unexpected content"); } - private class FileMetaData + private sealed class FileMetaData { public DateTime AvailableUntil { get; init; } } diff --git a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/LogViewerQueryRepository.cs b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/LogViewerQueryRepository.cs index a00c35de6d..cd2cb7631e 100644 --- a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/LogViewerQueryRepository.cs +++ b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/LogViewerQueryRepository.cs @@ -12,7 +12,7 @@ using Umbraco.Extensions; namespace Umbraco.Cms.Infrastructure.Persistence.Repositories.Implement; -internal class LogViewerQueryRepository : EntityRepositoryBase, ILogViewerQueryRepository +internal sealed class LogViewerQueryRepository : EntityRepositoryBase, ILogViewerQueryRepository { public LogViewerQueryRepository(IScopeAccessor scopeAccessor, AppCaches cache, ILogger logger) : base(scopeAccessor, cache, logger) @@ -101,14 +101,14 @@ internal class LogViewerQueryRepository : EntityRepositoryBase x.Id == id); - private ILogViewerQuery ConvertFromDto(LogViewerQueryDto dto) + private static ILogViewerQuery ConvertFromDto(LogViewerQueryDto dto) { var factory = new LogViewerQueryModelFactory(); ILogViewerQuery entity = factory.BuildEntity(dto); return entity; } - internal class LogViewerQueryModelFactory + internal sealed class LogViewerQueryModelFactory { public ILogViewerQuery BuildEntity(LogViewerQueryDto dto) { diff --git a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/MediaRepository.cs b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/MediaRepository.cs index 2f037653a7..1b4dd2d8a9 100644 --- a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/MediaRepository.cs +++ b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/MediaRepository.cs @@ -522,7 +522,7 @@ public class MediaRepository : ContentRepositoryBase IRepository -> IReadRepository which should all be separate things! // This sub-repository pattern is super old and totally unecessary anymore, caching can be handled in much nicer ways without this - private class MediaByGuidReadRepository : EntityRepositoryBase + private sealed class MediaByGuidReadRepository : EntityRepositoryBase { private readonly MediaRepository _outerRepo; diff --git a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/MediaTypeContainerRepository.cs b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/MediaTypeContainerRepository.cs index 260cebef9f..9efd67f3aa 100644 --- a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/MediaTypeContainerRepository.cs +++ b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/MediaTypeContainerRepository.cs @@ -6,7 +6,7 @@ using Umbraco.Cms.Infrastructure.Scoping; namespace Umbraco.Cms.Infrastructure.Persistence.Repositories.Implement; -internal class MediaTypeContainerRepository : EntityContainerRepository, IMediaTypeContainerRepository +internal sealed class MediaTypeContainerRepository : EntityContainerRepository, IMediaTypeContainerRepository { public MediaTypeContainerRepository(IScopeAccessor scopeAccessor, AppCaches cache, ILogger logger) : base(scopeAccessor, cache, logger, Constants.ObjectTypes.MediaTypeContainer) diff --git a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/MediaTypeRepository.cs b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/MediaTypeRepository.cs index 792e984387..9c7e22fa4d 100644 --- a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/MediaTypeRepository.cs +++ b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/MediaTypeRepository.cs @@ -17,7 +17,7 @@ namespace Umbraco.Cms.Infrastructure.Persistence.Repositories.Implement; /// /// Represents a repository for doing CRUD operations for /// -internal class MediaTypeRepository : ContentTypeRepositoryBase, IMediaTypeRepository +internal sealed class MediaTypeRepository : ContentTypeRepositoryBase, IMediaTypeRepository { public MediaTypeRepository( IScopeAccessor scopeAccessor, diff --git a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/MemberGroupRepository.cs b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/MemberGroupRepository.cs index 96d797b057..9ae8df942a 100644 --- a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/MemberGroupRepository.cs +++ b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/MemberGroupRepository.cs @@ -15,7 +15,7 @@ using Umbraco.Extensions; namespace Umbraco.Cms.Infrastructure.Persistence.Repositories.Implement; -internal class MemberGroupRepository : EntityRepositoryBase, IMemberGroupRepository +internal sealed class MemberGroupRepository : EntityRepositoryBase, IMemberGroupRepository { private readonly IEventMessagesFactory _eventMessagesFactory; @@ -302,7 +302,7 @@ internal class MemberGroupRepository : EntityRepositoryBase, }); } - private class AssignedRolesDto + private sealed class AssignedRolesDto { [Column("text")] public string? RoleName { get; set; } diff --git a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/MemberTypeContainerRepository.cs b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/MemberTypeContainerRepository.cs index e781521a77..15c99d879b 100644 --- a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/MemberTypeContainerRepository.cs +++ b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/MemberTypeContainerRepository.cs @@ -9,7 +9,7 @@ namespace Umbraco.Cms.Infrastructure.Persistence.Repositories.Implement /// /// Introduced to avoid inconsistencies with nullability of dependencies for type repositories for content, media and members. /// - internal class MemberTypeContainerRepository : IMemberTypeContainerRepository + internal sealed class MemberTypeContainerRepository : IMemberTypeContainerRepository { public void Delete(EntityContainer entity) { diff --git a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/MemberTypeRepository.cs b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/MemberTypeRepository.cs index e764f54090..ffbe444f81 100644 --- a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/MemberTypeRepository.cs +++ b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/MemberTypeRepository.cs @@ -18,7 +18,7 @@ namespace Umbraco.Cms.Infrastructure.Persistence.Repositories.Implement; /// /// Represents a repository for doing CRUD operations for /// -internal class MemberTypeRepository : ContentTypeRepositoryBase, IMemberTypeRepository +internal sealed class MemberTypeRepository : ContentTypeRepositoryBase, IMemberTypeRepository { private readonly IShortStringHelper _shortStringHelper; diff --git a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/PartialViewRepository.cs b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/PartialViewRepository.cs index 7e4d5d6817..35b1b0e8ef 100644 --- a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/PartialViewRepository.cs +++ b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/PartialViewRepository.cs @@ -6,7 +6,7 @@ using Umbraco.Extensions; namespace Umbraco.Cms.Infrastructure.Persistence.Repositories.Implement; -internal class PartialViewRepository : FileRepository, IPartialViewRepository +internal sealed class PartialViewRepository : FileRepository, IPartialViewRepository { public PartialViewRepository(FileSystems fileSystems) : base(fileSystems.PartialViewsFileSystem) diff --git a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/PermissionRepository.cs b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/PermissionRepository.cs index c99ac14fce..5a3de2ab14 100644 --- a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/PermissionRepository.cs +++ b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/PermissionRepository.cs @@ -23,7 +23,7 @@ namespace Umbraco.Cms.Infrastructure.Persistence.Repositories.Implement; /// like the normal repository pattern but the standard repository Get commands don't apply and will throw /// /// -internal class PermissionRepository : EntityRepositoryBase +internal sealed class PermissionRepository : EntityRepositoryBase where TEntity : class, IEntity { public PermissionRepository(IScopeAccessor scopeAccessor, AppCaches cache, ILogger> logger) diff --git a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/PropertyTypeUsageRepository.cs b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/PropertyTypeUsageRepository.cs index e2dcbf77c7..ab9a03bcef 100644 --- a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/PropertyTypeUsageRepository.cs +++ b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/PropertyTypeUsageRepository.cs @@ -8,7 +8,7 @@ using Umbraco.Extensions; namespace Umbraco.Cms.Infrastructure.Persistence.Repositories.Implement; -internal class PropertyTypeUsageRepository : IPropertyTypeUsageRepository +internal sealed class PropertyTypeUsageRepository : IPropertyTypeUsageRepository { private static readonly Guid?[] NodeObjectTypes = new Guid?[] { diff --git a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/PublicAccessRepository.cs b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/PublicAccessRepository.cs index 2716df9315..aaeba86db6 100644 --- a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/PublicAccessRepository.cs +++ b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/PublicAccessRepository.cs @@ -13,7 +13,7 @@ using Umbraco.Extensions; namespace Umbraco.Cms.Infrastructure.Persistence.Repositories.Implement; -internal class PublicAccessRepository : EntityRepositoryBase, IPublicAccessRepository +internal sealed class PublicAccessRepository : EntityRepositoryBase, IPublicAccessRepository { public PublicAccessRepository(IScopeAccessor scopeAccessor, AppCaches cache, ILogger logger) : base(scopeAccessor, cache, logger) diff --git a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/RedirectUrlRepository.cs b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/RedirectUrlRepository.cs index f598df7168..2a78775c77 100644 --- a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/RedirectUrlRepository.cs +++ b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/RedirectUrlRepository.cs @@ -12,7 +12,7 @@ using Umbraco.Extensions; namespace Umbraco.Cms.Infrastructure.Persistence.Repositories.Implement; -internal class RedirectUrlRepository : EntityRepositoryBase, IRedirectUrlRepository +internal sealed class RedirectUrlRepository : EntityRepositoryBase, IRedirectUrlRepository { public RedirectUrlRepository(IScopeAccessor scopeAccessor, AppCaches cache, ILogger logger) : base(scopeAccessor, cache, logger) diff --git a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/RelationRepository.cs b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/RelationRepository.cs index 5c403445e0..8b3dc4a891 100644 --- a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/RelationRepository.cs +++ b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/RelationRepository.cs @@ -21,7 +21,7 @@ namespace Umbraco.Cms.Infrastructure.Persistence.Repositories.Implement; /// /// Represents a repository for doing CRUD operations for /// -internal class RelationRepository : EntityRepositoryBase, IRelationRepository +internal sealed class RelationRepository : EntityRepositoryBase, IRelationRepository { private readonly IEntityRepositoryExtended _entityRepository; private readonly IRelationTypeRepository _relationTypeRepository; @@ -227,7 +227,7 @@ internal class RelationRepository : EntityRepositoryBase, IRelat /// Used for joining the entity query with relations for the paging methods /// /// - private void SqlJoinRelations(Sql sql) + private static void SqlJoinRelations(Sql sql) { // add left joins for relation tables (this joins on both child or parent, so beware that this will normally return entities for // both sides of the relation type unless the IUmbracoEntity query passed in filters one side out). @@ -304,7 +304,7 @@ internal class RelationRepository : EntityRepositoryBase, IRelat } } - private void ApplyOrdering(ref Sql sql, Ordering ordering) + private static void ApplyOrdering(ref Sql sql, Ordering ordering) { if (sql == null) { @@ -458,7 +458,7 @@ internal class RelationRepository : EntityRepositoryBase, IRelat #endregion } -internal class RelationItemDto +internal sealed class RelationItemDto { [Column(Name = "nodeId")] public int ChildNodeId { get; set; } diff --git a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/ScriptRepository.cs b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/ScriptRepository.cs index 3094d0d04e..0065c7ee30 100644 --- a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/ScriptRepository.cs +++ b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/ScriptRepository.cs @@ -8,7 +8,7 @@ namespace Umbraco.Cms.Infrastructure.Persistence.Repositories.Implement; /// /// Represents the Script Repository /// -internal class ScriptRepository : FileRepository, IScriptRepository +internal sealed class ScriptRepository : FileRepository, IScriptRepository { public ScriptRepository(FileSystems fileSystems) : base(fileSystems.ScriptsFileSystem) diff --git a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/ServerRegistrationRepository.cs b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/ServerRegistrationRepository.cs index b758150de1..80a19793cf 100644 --- a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/ServerRegistrationRepository.cs +++ b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/ServerRegistrationRepository.cs @@ -11,7 +11,7 @@ using Umbraco.Extensions; namespace Umbraco.Cms.Infrastructure.Persistence.Repositories.Implement; -internal class ServerRegistrationRepository : EntityRepositoryBase, +internal sealed class ServerRegistrationRepository : EntityRepositoryBase, IServerRegistrationRepository { public ServerRegistrationRepository(IScopeAccessor scopeAccessor, ILogger logger) diff --git a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/SimilarNodeName.cs b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/SimilarNodeName.cs index 9f4bc451c9..0139a52bb7 100644 --- a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/SimilarNodeName.cs +++ b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/SimilarNodeName.cs @@ -17,7 +17,7 @@ internal static class ListExtensions items.Any(x => x.Suffix.HasValue); } -internal class SimilarNodeName +internal sealed class SimilarNodeName { public int Id { get; set; } @@ -181,7 +181,7 @@ internal class SimilarNodeName return current; } - internal class StructuredName + internal sealed class StructuredName { internal const uint Initialsuffix = 1; private const string Spacecharacter = " "; diff --git a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/StylesheetRepository.cs b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/StylesheetRepository.cs index ca1f995e2b..51de577152 100644 --- a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/StylesheetRepository.cs +++ b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/StylesheetRepository.cs @@ -8,7 +8,7 @@ namespace Umbraco.Cms.Infrastructure.Persistence.Repositories.Implement; /// /// Represents the Stylesheet Repository /// -internal class StylesheetRepository : FileRepository, IStylesheetRepository +internal sealed class StylesheetRepository : FileRepository, IStylesheetRepository { public StylesheetRepository(FileSystems fileSystems) : base(fileSystems.StylesheetsFileSystem) diff --git a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/TagRepository.cs b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/TagRepository.cs index d0d688d332..8107abc3ef 100644 --- a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/TagRepository.cs +++ b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/TagRepository.cs @@ -15,7 +15,7 @@ using static Umbraco.Cms.Core.Persistence.SqlExtensionsStatics; namespace Umbraco.Cms.Infrastructure.Persistence.Repositories.Implement; -internal class TagRepository : EntityRepositoryBase, ITagRepository +internal sealed class TagRepository : EntityRepositoryBase, ITagRepository { public TagRepository(IScopeAccessor scopeAccessor, AppCaches cache, ILogger logger) : base(scopeAccessor, cache, logger) @@ -245,7 +245,7 @@ WHERE r.tagId IS NULL"; } // used to run Distinct() on tags - private class TagComparer : IEqualityComparer + private sealed class TagComparer : IEqualityComparer { public bool Equals(ITag? x, ITag? y) => ReferenceEquals(x, y) // takes care of both being null @@ -276,7 +276,7 @@ WHERE r.tagId IS NULL"; // ReSharper disable once ClassNeverInstantiated.Local // ReSharper disable UnusedAutoPropertyAccessor.Local - private class TaggedEntityDto + private sealed class TaggedEntityDto { public int NodeId { get; set; } public string? PropertyTypeAlias { get; set; } @@ -538,7 +538,7 @@ WHERE r.tagId IS NULL"; return sql; } - private Sql AddTagsSqlWhere(Sql sql, string? culture) + private static Sql AddTagsSqlWhere(Sql sql, string? culture) { if (culture == null) { @@ -557,7 +557,7 @@ WHERE r.tagId IS NULL"; private IEnumerable ExecuteTagsQuery(Sql sql) => Database.Fetch(sql).Select(TagFactory.BuildEntity); - private Guid GetNodeObjectType(TaggableObjectTypes type) + private static Guid GetNodeObjectType(TaggableObjectTypes type) { switch (type) { diff --git a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/TemplateRepository.cs b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/TemplateRepository.cs index 94f184c92d..f3433a564d 100644 --- a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/TemplateRepository.cs +++ b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/TemplateRepository.cs @@ -22,9 +22,8 @@ namespace Umbraco.Cms.Infrastructure.Persistence.Repositories.Implement; /// /// Represents the Template Repository /// -internal class TemplateRepository : EntityRepositoryBase, ITemplateRepository +internal sealed class TemplateRepository : EntityRepositoryBase, ITemplateRepository { - private readonly IIOHelper _ioHelper; private readonly IShortStringHelper _shortStringHelper; private readonly IFileSystem? _viewsFileSystem; private readonly IViewHelper _viewHelper; @@ -35,13 +34,11 @@ internal class TemplateRepository : EntityRepositoryBase, ITempl AppCaches cache, ILogger logger, FileSystems fileSystems, - IIOHelper ioHelper, IShortStringHelper shortStringHelper, IViewHelper viewHelper, IOptionsMonitor runtimeSettings) : base(scopeAccessor, cache, logger) { - _ioHelper = ioHelper; _shortStringHelper = shortStringHelper; _viewsFileSystem = fileSystems.MvcViewsFileSystem; _viewHelper = viewHelper; @@ -208,7 +205,7 @@ internal class TemplateRepository : EntityRepositoryBase, ITempl return string.Empty; } - private string? GetFileContent(ITemplate template, IFileSystem? fs, string filename, bool init) + private static string? GetFileContent(ITemplate template, IFileSystem? fs, string filename, bool init) { // do not update .UpdateDate as that would make it dirty (side-effect) // unless initializing, because we have to do it once @@ -229,7 +226,7 @@ internal class TemplateRepository : EntityRepositoryBase, ITempl return init ? null : GetFileContent(fs, filename); } - private string? GetFileContent(IFileSystem? fs, string filename) + private static string? GetFileContent(IFileSystem? fs, string filename) { if (fs is null) { @@ -627,7 +624,7 @@ internal class TemplateRepository : EntityRepositoryBase, ITempl return descendants; } - private void AddChildren(ITemplate[]? all, List descendants, string masterAlias) + private static void AddChildren(ITemplate[]? all, List descendants, string masterAlias) { ITemplate[]? c = all?.Where(x => x.MasterTemplateAlias.InvariantEquals(masterAlias)).ToArray(); if (c is null || c.Any() == false) diff --git a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/TrackedReferencesRepository.cs b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/TrackedReferencesRepository.cs index c3ccb06e4f..34b74ae3f4 100644 --- a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/TrackedReferencesRepository.cs +++ b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/TrackedReferencesRepository.cs @@ -12,7 +12,7 @@ namespace Umbraco.Cms.Infrastructure.Persistence.Repositories.Implement /// /// Implements to provide database access for tracked references." /// - internal class TrackedReferencesRepository : ITrackedReferencesRepository + internal sealed class TrackedReferencesRepository : ITrackedReferencesRepository { private readonly IScopeAccessor _scopeAccessor; private readonly IUmbracoMapper _umbracoMapper; @@ -402,7 +402,7 @@ namespace Umbraco.Cms.Infrastructure.Persistence.Repositories.Implement return innerUnionSql; } - private class UnionHelperDto + private sealed class UnionHelperDto { [Column("id")] public int Id { get; set; } diff --git a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/TwoFactorLoginRepository.cs b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/TwoFactorLoginRepository.cs index 9467ec9be4..b5a049f0f4 100644 --- a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/TwoFactorLoginRepository.cs +++ b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/TwoFactorLoginRepository.cs @@ -12,7 +12,7 @@ using Umbraco.Extensions; namespace Umbraco.Cms.Infrastructure.Persistence.Repositories.Implement; -internal class TwoFactorLoginRepository : EntityRepositoryBase, ITwoFactorLoginRepository +internal sealed class TwoFactorLoginRepository : EntityRepositoryBase, ITwoFactorLoginRepository { public TwoFactorLoginRepository(IScopeAccessor scopeAccessor, AppCaches cache, ILogger logger) diff --git a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/UserDataRepository.cs b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/UserDataRepository.cs index 85bcceb698..024a10dc12 100644 --- a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/UserDataRepository.cs +++ b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/UserDataRepository.cs @@ -9,7 +9,7 @@ using Umbraco.Extensions; namespace Umbraco.Cms.Infrastructure.Persistence.Repositories.Implement; -internal class UserDataRepository : IUserDataRepository +internal sealed class UserDataRepository : IUserDataRepository { private readonly IScopeAccessor _scopeAccessor; @@ -75,7 +75,7 @@ internal class UserDataRepository : IUserDataRepository await _scopeAccessor.AmbientScope?.Database.ExecuteAsync(sql)!; } - private Sql ApplyFilter(Sql sql, IUserDataFilter filter) + private static Sql ApplyFilter(Sql sql, IUserDataFilter filter) { if (filter.Groups?.Count > 0) { @@ -95,10 +95,10 @@ internal class UserDataRepository : IUserDataRepository return sql; } - private IEnumerable DtosToModels(IEnumerable dtos) + private static IEnumerable DtosToModels(IEnumerable dtos) => dtos.Select(Map); - private IUserData Map(UserDataDto dto) + private static IUserData Map(UserDataDto dto) => new UserData { Key = dto.Key, @@ -108,7 +108,7 @@ internal class UserDataRepository : IUserDataRepository UserKey = dto.UserKey, }; - private UserDataDto Map(IUserData userData) + private static UserDataDto Map(IUserData userData) => new() { Key = userData.Key, diff --git a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/UserGroupRepository.cs b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/UserGroupRepository.cs index 1eb3fa47a7..8168e6d142 100644 --- a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/UserGroupRepository.cs +++ b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/UserGroupRepository.cs @@ -183,7 +183,7 @@ public class UserGroupRepository : EntityRepositoryBase, IUserG /// /// used to persist a user group with associated users at once /// - private class UserGroupWithUsers : EntityBase + private sealed class UserGroupWithUsers : EntityBase { public UserGroupWithUsers(IUserGroup userGroup, int[]? userIds) { @@ -201,7 +201,7 @@ public class UserGroupRepository : EntityRepositoryBase, IUserG /// /// used to persist a user group with associated users at once /// - private class UserGroupWithUsersRepository : EntityRepositoryBase + private sealed class UserGroupWithUsersRepository : EntityRepositoryBase { private readonly UserGroupRepository _userGroupRepo; diff --git a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/UserRepository.cs b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/UserRepository.cs index 187d5c5ce2..c56c40e02e 100644 --- a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/UserRepository.cs +++ b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/UserRepository.cs @@ -25,7 +25,7 @@ namespace Umbraco.Cms.Infrastructure.Persistence.Repositories.Implement; /// /// Represents the UserRepository for doing CRUD operations for /// -internal class UserRepository : EntityRepositoryBase, IUserRepository +internal sealed class UserRepository : EntityRepositoryBase, IUserRepository { private readonly IMapperCollection _mapperCollection; private readonly GlobalSettings _globalSettings; @@ -36,8 +36,6 @@ internal class UserRepository : EntityRepositoryBase, IUserReposito private bool _passwordConfigInitialized; private readonly Lock _sqliteValidateSessionLock = new(); private readonly IDictionary _permissionMappers; - private readonly IAppPolicyCache _globalCache; - private readonly IScopeAccessor _scopeAccessor; /// /// Initializes a new instance of the class. @@ -54,7 +52,6 @@ internal class UserRepository : EntityRepositoryBase, IUserReposito /// The JSON serializer. /// State of the runtime. /// The permission mappers. - /// The app policy cache. /// /// mapperCollection /// or @@ -71,18 +68,15 @@ internal class UserRepository : EntityRepositoryBase, IUserReposito IOptions passwordConfiguration, IJsonSerializer jsonSerializer, IRuntimeState runtimeState, - IEnumerable permissionMappers, - IAppPolicyCache globalCache) + IEnumerable permissionMappers) : base(scopeAccessor, appCaches, logger) { - _scopeAccessor = scopeAccessor; _mapperCollection = mapperCollection ?? throw new ArgumentNullException(nameof(mapperCollection)); _globalSettings = globalSettings.Value ?? throw new ArgumentNullException(nameof(globalSettings)); _passwordConfiguration = passwordConfiguration.Value ?? throw new ArgumentNullException(nameof(passwordConfiguration)); _jsonSerializer = jsonSerializer; _runtimeState = runtimeState; - _globalCache = globalCache; _permissionMappers = permissionMappers.ToDictionary(x => x.Context); } diff --git a/src/Umbraco.Infrastructure/Persistence/SqlSyntax/DbTypesFactory.cs b/src/Umbraco.Infrastructure/Persistence/SqlSyntax/DbTypesFactory.cs index 343e42d9c5..b1cfc9628c 100644 --- a/src/Umbraco.Infrastructure/Persistence/SqlSyntax/DbTypesFactory.cs +++ b/src/Umbraco.Infrastructure/Persistence/SqlSyntax/DbTypesFactory.cs @@ -2,7 +2,7 @@ using System.Data; namespace Umbraco.Cms.Infrastructure.Persistence.SqlSyntax; -internal class DbTypesFactory +internal sealed class DbTypesFactory { private readonly Dictionary _columnDbTypeMap = new(); private readonly Dictionary _columnTypeMap = new(); diff --git a/src/Umbraco.Infrastructure/Persistence/UmbracoPocoDataBuilder.cs b/src/Umbraco.Infrastructure/Persistence/UmbracoPocoDataBuilder.cs index 7b62c212e3..a8e47306dc 100644 --- a/src/Umbraco.Infrastructure/Persistence/UmbracoPocoDataBuilder.cs +++ b/src/Umbraco.Infrastructure/Persistence/UmbracoPocoDataBuilder.cs @@ -23,7 +23,7 @@ namespace Umbraco.Cms.Infrastructure.Persistence; /// Beware, the application MUST restart when this class behavior changes. /// You can override the GetColmunnInfo method to control which columns this includes /// -internal class UmbracoPocoDataBuilder : PocoDataBuilder +internal sealed class UmbracoPocoDataBuilder : PocoDataBuilder { private readonly bool _upgrading; diff --git a/src/Umbraco.Infrastructure/PropertyEditors/BlockGridConfigurationEditor.cs b/src/Umbraco.Infrastructure/PropertyEditors/BlockGridConfigurationEditor.cs index c89bdd6ca7..8da525ab8e 100644 --- a/src/Umbraco.Infrastructure/PropertyEditors/BlockGridConfigurationEditor.cs +++ b/src/Umbraco.Infrastructure/PropertyEditors/BlockGridConfigurationEditor.cs @@ -5,7 +5,7 @@ using Umbraco.Cms.Core.IO; namespace Umbraco.Cms.Core.PropertyEditors; -internal class BlockGridConfigurationEditor : ConfigurationEditor +internal sealed class BlockGridConfigurationEditor : ConfigurationEditor { public BlockGridConfigurationEditor(IIOHelper ioHelper) : base(ioHelper) { diff --git a/src/Umbraco.Infrastructure/PropertyEditors/BlockGridPropertyEditorBase.cs b/src/Umbraco.Infrastructure/PropertyEditors/BlockGridPropertyEditorBase.cs index 1975faabc2..0f0a48e992 100644 --- a/src/Umbraco.Infrastructure/PropertyEditors/BlockGridPropertyEditorBase.cs +++ b/src/Umbraco.Infrastructure/PropertyEditors/BlockGridPropertyEditorBase.cs @@ -40,7 +40,7 @@ public abstract class BlockGridPropertyEditorBase : DataEditor protected override IDataValueEditor CreateValueEditor() => DataValueEditorFactory.Create(Attribute!); - internal class BlockGridEditorPropertyValueEditor : BlockEditorPropertyValueEditor + internal sealed class BlockGridEditorPropertyValueEditor : BlockEditorPropertyValueEditor { public BlockGridEditorPropertyValueEditor( DataEditorAttribute attribute, @@ -65,7 +65,7 @@ public abstract class BlockGridPropertyEditorBase : DataEditor protected override BlockGridValue CreateWithLayout(IEnumerable layout) => new(layout); - private class MinMaxValidator : BlockEditorMinMaxValidatorBase + private sealed class MinMaxValidator : BlockEditorMinMaxValidatorBase { private readonly BlockEditorValues _blockEditorValues; diff --git a/src/Umbraco.Infrastructure/PropertyEditors/BlockListConfigurationEditor.cs b/src/Umbraco.Infrastructure/PropertyEditors/BlockListConfigurationEditor.cs index d20cffa933..f883820833 100644 --- a/src/Umbraco.Infrastructure/PropertyEditors/BlockListConfigurationEditor.cs +++ b/src/Umbraco.Infrastructure/PropertyEditors/BlockListConfigurationEditor.cs @@ -6,7 +6,7 @@ using Umbraco.Cms.Core.Services; namespace Umbraco.Cms.Core.PropertyEditors; -internal class BlockListConfigurationEditor : ConfigurationEditor +internal sealed class BlockListConfigurationEditor : ConfigurationEditor { public BlockListConfigurationEditor(IIOHelper ioHelper) : base(ioHelper) diff --git a/src/Umbraco.Infrastructure/PropertyEditors/BlockListPropertyEditorBase.cs b/src/Umbraco.Infrastructure/PropertyEditors/BlockListPropertyEditorBase.cs index 8c3e54ce12..9deb400923 100644 --- a/src/Umbraco.Infrastructure/PropertyEditors/BlockListPropertyEditorBase.cs +++ b/src/Umbraco.Infrastructure/PropertyEditors/BlockListPropertyEditorBase.cs @@ -49,7 +49,7 @@ public abstract class BlockListPropertyEditorBase : DataEditor /// /// Defines the value editor for the block list property editors. /// - internal class BlockListEditorPropertyValueEditor : BlockEditorPropertyValueEditor + internal sealed class BlockListEditorPropertyValueEditor : BlockEditorPropertyValueEditor { /// /// Initializes a new instance of the class. @@ -85,7 +85,7 @@ public abstract class BlockListPropertyEditorBase : DataEditor /// /// Validates the min/max configuration for block list property editors. /// - private class MinMaxValidator : BlockEditorMinMaxValidatorBase + private sealed class MinMaxValidator : BlockEditorMinMaxValidatorBase { private readonly BlockEditorValues _blockEditorValues; diff --git a/src/Umbraco.Infrastructure/PropertyEditors/BlockValuePropertyIndexValueFactory.cs b/src/Umbraco.Infrastructure/PropertyEditors/BlockValuePropertyIndexValueFactory.cs index 27f9d9b40a..d6b91d8a73 100644 --- a/src/Umbraco.Infrastructure/PropertyEditors/BlockValuePropertyIndexValueFactory.cs +++ b/src/Umbraco.Infrastructure/PropertyEditors/BlockValuePropertyIndexValueFactory.cs @@ -8,7 +8,7 @@ using Umbraco.Cms.Core.Serialization; namespace Umbraco.Cms.Core.PropertyEditors; -internal class BlockValuePropertyIndexValueFactory : +internal sealed class BlockValuePropertyIndexValueFactory : BlockValuePropertyIndexValueFactoryBase, IBlockValuePropertyIndexValueFactory { @@ -24,7 +24,7 @@ internal class BlockValuePropertyIndexValueFactory : => GetDataItems(input.ContentData, input.Expose, published); // we only care about the content data when extracting values for indexing - not the layouts nor the settings - internal class IndexValueFactoryBlockValue + internal sealed class IndexValueFactoryBlockValue { public List ContentData { get; set; } = new(); diff --git a/src/Umbraco.Infrastructure/PropertyEditors/ColorPickerConfigurationEditor.cs b/src/Umbraco.Infrastructure/PropertyEditors/ColorPickerConfigurationEditor.cs index 0ce5f4bfdf..fe419a6566 100644 --- a/src/Umbraco.Infrastructure/PropertyEditors/ColorPickerConfigurationEditor.cs +++ b/src/Umbraco.Infrastructure/PropertyEditors/ColorPickerConfigurationEditor.cs @@ -10,7 +10,7 @@ using Umbraco.Extensions; namespace Umbraco.Cms.Core.PropertyEditors; -internal class ColorPickerConfigurationEditor : ConfigurationEditor +internal sealed class ColorPickerConfigurationEditor : ConfigurationEditor { public ColorPickerConfigurationEditor(IIOHelper ioHelper, IConfigurationEditorJsonSerializer configurationEditorJsonSerializer) : base(ioHelper) @@ -19,7 +19,7 @@ internal class ColorPickerConfigurationEditor : ConfigurationEditor /// Defines the value editor for the color picker property editor. /// - internal class ColorPickerPropertyValueEditor : DataValueEditor + internal sealed class ColorPickerPropertyValueEditor : DataValueEditor { /// /// Initializes a new instance of the class. @@ -68,7 +68,7 @@ public class ColorPickerPropertyEditor : DataEditor /// /// Validates the color selection for the color picker property editor. /// - internal class ConfiguredColorValidator : IValueValidator + internal sealed class ConfiguredColorValidator : IValueValidator { private readonly ILocalizedTextService _localizedTextService; diff --git a/src/Umbraco.Infrastructure/PropertyEditors/DropDownFlexibleConfigurationEditor.cs b/src/Umbraco.Infrastructure/PropertyEditors/DropDownFlexibleConfigurationEditor.cs index ef6e6c7808..4b7533eb86 100644 --- a/src/Umbraco.Infrastructure/PropertyEditors/DropDownFlexibleConfigurationEditor.cs +++ b/src/Umbraco.Infrastructure/PropertyEditors/DropDownFlexibleConfigurationEditor.cs @@ -6,7 +6,7 @@ using Umbraco.Cms.Core.Serialization; namespace Umbraco.Cms.Core.PropertyEditors; -internal class DropDownFlexibleConfigurationEditor : ConfigurationEditor +internal sealed class DropDownFlexibleConfigurationEditor : ConfigurationEditor { public DropDownFlexibleConfigurationEditor(IIOHelper ioHelper, IConfigurationEditorJsonSerializer configurationEditorJsonSerializer) : base(ioHelper) diff --git a/src/Umbraco.Infrastructure/PropertyEditors/FileUploadPropertyValueEditor.cs b/src/Umbraco.Infrastructure/PropertyEditors/FileUploadPropertyValueEditor.cs index 241c817cec..d839aefd3b 100644 --- a/src/Umbraco.Infrastructure/PropertyEditors/FileUploadPropertyValueEditor.cs +++ b/src/Umbraco.Infrastructure/PropertyEditors/FileUploadPropertyValueEditor.cs @@ -21,7 +21,7 @@ namespace Umbraco.Cms.Core.PropertyEditors; /// /// The value editor for the file upload property editor. /// -internal class FileUploadPropertyValueEditor : DataValueEditor +internal sealed class FileUploadPropertyValueEditor : DataValueEditor { private readonly MediaFileManager _mediaFileManager; private readonly ITemporaryFileService _temporaryFileService; @@ -159,7 +159,7 @@ internal class FileUploadPropertyValueEditor : DataValueEditor private TemporaryFileModel? TryGetTemporaryFile(Guid temporaryFileKey) => _temporaryFileService.GetAsync(temporaryFileKey).GetAwaiter().GetResult(); - private bool IsAllowedInDataTypeConfiguration(string extension, object? dataTypeConfiguration) + private static bool IsAllowedInDataTypeConfiguration(string extension, object? dataTypeConfiguration) { if (dataTypeConfiguration is FileUploadConfiguration fileUploadConfiguration) { @@ -207,7 +207,7 @@ internal class FileUploadPropertyValueEditor : DataValueEditor /// Provides media path. /// /// File system relative path - protected virtual string GetMediaPath(TemporaryFileModel file, object? dataTypeConfiguration, Guid contentKey, Guid propertyTypeKey) + private string GetMediaPath(TemporaryFileModel file, object? dataTypeConfiguration, Guid contentKey, Guid propertyTypeKey) { // in case we are using the old path scheme, try to re-use numbers (bah...) return _mediaFileManager.GetMediaPath(file.FileName, contentKey, propertyTypeKey); diff --git a/src/Umbraco.Infrastructure/PropertyEditors/ImageCropperConfigurationEditor.cs b/src/Umbraco.Infrastructure/PropertyEditors/ImageCropperConfigurationEditor.cs index 27c52f48b0..4dcee03929 100644 --- a/src/Umbraco.Infrastructure/PropertyEditors/ImageCropperConfigurationEditor.cs +++ b/src/Umbraco.Infrastructure/PropertyEditors/ImageCropperConfigurationEditor.cs @@ -8,7 +8,7 @@ namespace Umbraco.Cms.Core.PropertyEditors; /// /// Represents the configuration editor for the image cropper value editor. /// -internal class ImageCropperConfigurationEditor : ConfigurationEditor +internal sealed class ImageCropperConfigurationEditor : ConfigurationEditor { public ImageCropperConfigurationEditor(IIOHelper ioHelper) : base(ioHelper) diff --git a/src/Umbraco.Infrastructure/PropertyEditors/ImageCropperPropertyEditor.cs b/src/Umbraco.Infrastructure/PropertyEditors/ImageCropperPropertyEditor.cs index 46f02863a9..fe978283c4 100644 --- a/src/Umbraco.Infrastructure/PropertyEditors/ImageCropperPropertyEditor.cs +++ b/src/Umbraco.Infrastructure/PropertyEditors/ImageCropperPropertyEditor.cs @@ -290,7 +290,7 @@ public class ImageCropperPropertyEditor : DataEditor, IMediaUrlGenerator, } // for efficient value deserialization, we don't want to deserialize more than we need to (we don't need crops, focal point etc.) - private class LightWeightImageCropperValue + private sealed class LightWeightImageCropperValue { public string? Src { get; set; } = string.Empty; } diff --git a/src/Umbraco.Infrastructure/PropertyEditors/ImageCropperPropertyValueEditor.cs b/src/Umbraco.Infrastructure/PropertyEditors/ImageCropperPropertyValueEditor.cs index 28a3ec87bc..869f10eac7 100644 --- a/src/Umbraco.Infrastructure/PropertyEditors/ImageCropperPropertyValueEditor.cs +++ b/src/Umbraco.Infrastructure/PropertyEditors/ImageCropperPropertyValueEditor.cs @@ -22,7 +22,7 @@ namespace Umbraco.Cms.Core.PropertyEditors; /// /// The value editor for the image cropper property editor. /// -internal class ImageCropperPropertyValueEditor : DataValueEditor // TODO: core vs web? +internal sealed class ImageCropperPropertyValueEditor : DataValueEditor // TODO: core vs web? { private readonly IDataTypeConfigurationCache _dataTypeConfigurationCache; private readonly IFileStreamSecurityValidator _fileStreamSecurityValidator; diff --git a/src/Umbraco.Infrastructure/PropertyEditors/MediaPicker3PropertyEditor.cs b/src/Umbraco.Infrastructure/PropertyEditors/MediaPicker3PropertyEditor.cs index f23ce49fe7..ae43c493ef 100644 --- a/src/Umbraco.Infrastructure/PropertyEditors/MediaPicker3PropertyEditor.cs +++ b/src/Umbraco.Infrastructure/PropertyEditors/MediaPicker3PropertyEditor.cs @@ -52,7 +52,7 @@ public class MediaPicker3PropertyEditor : DataEditor /// /// Defines the value editor for the media picker property editor. /// - internal class MediaPicker3PropertyValueEditor : DataValueEditor, IDataValueReference + internal sealed class MediaPicker3PropertyValueEditor : DataValueEditor, IDataValueReference { private readonly IDataTypeConfigurationCache _dataTypeReadCache; private readonly IJsonSerializer _jsonSerializer; @@ -257,7 +257,7 @@ public class MediaPicker3PropertyEditor : DataEditor /// /// Model/DTO that represents the JSON that the MediaPicker3 stores. /// - internal class MediaWithCropsDto + internal sealed class MediaWithCropsDto { /// /// Gets or sets the key. @@ -338,7 +338,7 @@ public class MediaPicker3PropertyEditor : DataEditor /// /// Validates the min/max configuration for the media picker property editor. /// - internal class MinMaxValidator : ITypedJsonValidator, MediaPicker3Configuration> + internal sealed class MinMaxValidator : ITypedJsonValidator, MediaPicker3Configuration> { private readonly ILocalizedTextService _localizedTextService; @@ -399,7 +399,7 @@ public class MediaPicker3PropertyEditor : DataEditor /// /// Validates the allowed type configuration for the media picker property editor. /// - internal class AllowedTypeValidator : ITypedJsonValidator, MediaPicker3Configuration> + internal sealed class AllowedTypeValidator : ITypedJsonValidator, MediaPicker3Configuration> { private readonly ILocalizedTextService _localizedTextService; private readonly IMediaTypeService _mediaTypeService; @@ -472,7 +472,7 @@ public class MediaPicker3PropertyEditor : DataEditor /// /// Validates the start node configuration for the media picker property editor. /// - internal class StartNodeValidator : ITypedJsonValidator, MediaPicker3Configuration> + internal sealed class StartNodeValidator : ITypedJsonValidator, MediaPicker3Configuration> { private readonly ILocalizedTextService _localizedTextService; private readonly IMediaNavigationQueryService _mediaNavigationQueryService; diff --git a/src/Umbraco.Infrastructure/PropertyEditors/MultiNodeTreePickerPropertyEditor.cs b/src/Umbraco.Infrastructure/PropertyEditors/MultiNodeTreePickerPropertyEditor.cs index c69f55f187..75c9b045d8 100644 --- a/src/Umbraco.Infrastructure/PropertyEditors/MultiNodeTreePickerPropertyEditor.cs +++ b/src/Umbraco.Infrastructure/PropertyEditors/MultiNodeTreePickerPropertyEditor.cs @@ -189,7 +189,7 @@ public class MultiNodeTreePickerPropertyEditor : DataEditor /// /// Validates the min/max configuration for the multi-node tree picker property editor. /// - internal class MinMaxValidator : ITypedJsonValidator + internal sealed class MinMaxValidator : ITypedJsonValidator { private readonly ILocalizedTextService _localizedTextService; @@ -247,7 +247,7 @@ public class MultiNodeTreePickerPropertyEditor : DataEditor /// /// Validates the selected object type for the multi-node tree picker property editor. /// - internal class ObjectTypeValidator : ITypedJsonValidator + internal sealed class ObjectTypeValidator : ITypedJsonValidator { private readonly ILocalizedTextService _localizedTextService; private readonly ICoreScopeProvider _coreScopeProvider; @@ -335,7 +335,7 @@ public class MultiNodeTreePickerPropertyEditor : DataEditor /// /// Validates the selected content type for the multi-node tree picker property editor. /// - internal class ContentTypeValidator : ITypedJsonValidator + internal sealed class ContentTypeValidator : ITypedJsonValidator { private readonly ILocalizedTextService _localizedTextService; private readonly ICoreScopeProvider _coreScopeProvider; diff --git a/src/Umbraco.Infrastructure/PropertyEditors/MultiUrlPickerValueEditor.cs b/src/Umbraco.Infrastructure/PropertyEditors/MultiUrlPickerValueEditor.cs index 37697701c8..2f0a2b279b 100644 --- a/src/Umbraco.Infrastructure/PropertyEditors/MultiUrlPickerValueEditor.cs +++ b/src/Umbraco.Infrastructure/PropertyEditors/MultiUrlPickerValueEditor.cs @@ -217,7 +217,7 @@ public class MultiUrlPickerValueEditor : DataValueEditor, IDataValueReference public string? QueryString { get; set; } } - internal class MinMaxValidator : ITypedJsonValidator + internal sealed class MinMaxValidator : ITypedJsonValidator { private readonly ILocalizedTextService _localizedTextService; diff --git a/src/Umbraco.Infrastructure/PropertyEditors/MultipleTextStringConfigurationEditor.cs b/src/Umbraco.Infrastructure/PropertyEditors/MultipleTextStringConfigurationEditor.cs index 7b6eebff33..a6ab562b78 100644 --- a/src/Umbraco.Infrastructure/PropertyEditors/MultipleTextStringConfigurationEditor.cs +++ b/src/Umbraco.Infrastructure/PropertyEditors/MultipleTextStringConfigurationEditor.cs @@ -9,7 +9,7 @@ namespace Umbraco.Cms.Core.PropertyEditors; /// /// Represents the configuration editor for a multiple textstring value editor. /// -internal class MultipleTextStringConfigurationEditor : ConfigurationEditor +internal sealed class MultipleTextStringConfigurationEditor : ConfigurationEditor { public MultipleTextStringConfigurationEditor(IIOHelper ioHelper) : base(ioHelper) diff --git a/src/Umbraco.Infrastructure/PropertyEditors/MultipleTextStringPropertyEditor.cs b/src/Umbraco.Infrastructure/PropertyEditors/MultipleTextStringPropertyEditor.cs index 714d1e624b..9c6daeb63f 100644 --- a/src/Umbraco.Infrastructure/PropertyEditors/MultipleTextStringPropertyEditor.cs +++ b/src/Umbraco.Infrastructure/PropertyEditors/MultipleTextStringPropertyEditor.cs @@ -47,7 +47,7 @@ public class MultipleTextStringPropertyEditor : DataEditor /// /// Defines the value editor for the multiple text string property editor. /// - internal class MultipleTextStringPropertyValueEditor : DataValueEditor + internal sealed class MultipleTextStringPropertyValueEditor : DataValueEditor { private static readonly string _newLine = "\n"; private static readonly string[] _newLineDelimiters = { "\r\n", "\r", "\n" }; @@ -110,7 +110,7 @@ public class MultipleTextStringPropertyEditor : DataEditor /// /// A custom to check each string against the configured format. /// - internal class MultipleTextStringFormatValidator : IValueFormatValidator + internal sealed class MultipleTextStringFormatValidator : IValueFormatValidator { /// public IEnumerable ValidateFormat(object? value, string valueType, string format) @@ -137,7 +137,7 @@ public class MultipleTextStringPropertyEditor : DataEditor /// /// Validates the min/max configuration for the multiple text strings property editor. /// - internal class MinMaxValidator : IValueValidator + internal sealed class MinMaxValidator : IValueValidator { private readonly ILocalizedTextService _localizedTextService; diff --git a/src/Umbraco.Infrastructure/PropertyEditors/RadioButtonsPropertyEditor.cs b/src/Umbraco.Infrastructure/PropertyEditors/RadioButtonsPropertyEditor.cs index 248457153e..cf2c4ad3fa 100644 --- a/src/Umbraco.Infrastructure/PropertyEditors/RadioButtonsPropertyEditor.cs +++ b/src/Umbraco.Infrastructure/PropertyEditors/RadioButtonsPropertyEditor.cs @@ -48,7 +48,7 @@ public class RadioButtonsPropertyEditor : DataEditor /// /// Defines the value editor for the radio buttons property editor. /// - internal class RadioButtonsPropertyValueEditor : DataValueEditor + internal sealed class RadioButtonsPropertyValueEditor : DataValueEditor { /// /// Initializes a new instance of the class. @@ -66,7 +66,7 @@ public class RadioButtonsPropertyEditor : DataEditor /// /// Validates the prevalue configuration for the radio buttons property editor. /// - internal class RadioButtonValueValidator : IValueValidator + internal sealed class RadioButtonValueValidator : IValueValidator { private readonly ILocalizedTextService _localizedTextService; diff --git a/src/Umbraco.Infrastructure/PropertyEditors/RichTextEditorBlockValidator.cs b/src/Umbraco.Infrastructure/PropertyEditors/RichTextEditorBlockValidator.cs index a11a11e703..f48a18c698 100644 --- a/src/Umbraco.Infrastructure/PropertyEditors/RichTextEditorBlockValidator.cs +++ b/src/Umbraco.Infrastructure/PropertyEditors/RichTextEditorBlockValidator.cs @@ -8,7 +8,7 @@ using Umbraco.Extensions; namespace Umbraco.Cms.Core.PropertyEditors; -internal class RichTextEditorBlockValidator: BlockEditorValidatorBase +internal sealed class RichTextEditorBlockValidator: BlockEditorValidatorBase { private readonly BlockEditorValues _blockEditorValues; private readonly IJsonSerializer _jsonSerializer; diff --git a/src/Umbraco.Infrastructure/PropertyEditors/RichTextPropertyEditor.cs b/src/Umbraco.Infrastructure/PropertyEditors/RichTextPropertyEditor.cs index 7c9b26f343..f9be27e551 100644 --- a/src/Umbraco.Infrastructure/PropertyEditors/RichTextPropertyEditor.cs +++ b/src/Umbraco.Infrastructure/PropertyEditors/RichTextPropertyEditor.cs @@ -89,7 +89,7 @@ public class RichTextPropertyEditor : DataEditor /// A custom value editor to ensure that images and blocks are parsed when being persisted and formatted correctly for /// display in the editor /// - internal class RichTextPropertyValueEditor : BlockValuePropertyValueEditorBase + internal sealed class RichTextPropertyValueEditor : BlockValuePropertyValueEditorBase { private readonly IBackOfficeSecurityAccessor _backOfficeSecurityAccessor; private readonly IHtmlSanitizer _htmlSanitizer; @@ -320,7 +320,7 @@ public class RichTextPropertyEditor : DataEditor return RichTextPropertyEditorHelper.SerializeRichTextEditorValue(mergedEditorValue, _jsonSerializer); } - private string MergeMarkupValue( + private static string MergeMarkupValue( string source, string target, RichTextBlockValue? mergedBlockValue, diff --git a/src/Umbraco.Infrastructure/PropertyEditors/RichTextPropertyIndexValueFactory.cs b/src/Umbraco.Infrastructure/PropertyEditors/RichTextPropertyIndexValueFactory.cs index 6013e6c4c2..8df3466e35 100644 --- a/src/Umbraco.Infrastructure/PropertyEditors/RichTextPropertyIndexValueFactory.cs +++ b/src/Umbraco.Infrastructure/PropertyEditors/RichTextPropertyIndexValueFactory.cs @@ -9,7 +9,7 @@ using Umbraco.Extensions; namespace Umbraco.Cms.Core.PropertyEditors; -internal class RichTextPropertyIndexValueFactory : BlockValuePropertyIndexValueFactoryBase, IRichTextPropertyIndexValueFactory +internal sealed class RichTextPropertyIndexValueFactory : BlockValuePropertyIndexValueFactoryBase, IRichTextPropertyIndexValueFactory { private readonly IJsonSerializer _jsonSerializer; private readonly ILogger _logger; diff --git a/src/Umbraco.Infrastructure/PropertyEditors/SliderPropertyEditor.cs b/src/Umbraco.Infrastructure/PropertyEditors/SliderPropertyEditor.cs index 02e96d075a..7f38484f58 100644 --- a/src/Umbraco.Infrastructure/PropertyEditors/SliderPropertyEditor.cs +++ b/src/Umbraco.Infrastructure/PropertyEditors/SliderPropertyEditor.cs @@ -48,7 +48,7 @@ public class SliderPropertyEditor : DataEditor /// /// Defines the value editor for the slider property editor. /// - internal class SliderPropertyValueEditor : DataValueEditor + internal sealed class SliderPropertyValueEditor : DataValueEditor { private readonly IJsonSerializer _jsonSerializer; @@ -99,7 +99,7 @@ public class SliderPropertyEditor : DataEditor /// /// Represents a slider value. /// - internal class SliderRange + internal sealed class SliderRange { /// /// Gets or sets the slider range from value. @@ -156,7 +156,7 @@ public class SliderPropertyEditor : DataEditor /// /// Parses a from the provided value. /// - protected bool TryParsePropertyValue(object? value, [NotNullWhen(true)] out SliderRange? parsedValue) + protected static bool TryParsePropertyValue(object? value, [NotNullWhen(true)] out SliderRange? parsedValue) { if (value is null || value is not JsonObject valueAsJsonObject) { @@ -188,7 +188,7 @@ public class SliderPropertyEditor : DataEditor /// /// Validates the range configuration for the slider property editor. /// - internal class RangeValidator : SliderPropertyConfigurationValidatorBase, IValueValidator + internal sealed class RangeValidator : SliderPropertyConfigurationValidatorBase, IValueValidator { /// /// Initializes a new instance of the class. @@ -230,7 +230,7 @@ public class SliderPropertyEditor : DataEditor /// /// Validates the min/max configuration for the slider property editor. /// - internal class MinMaxValidator : SliderPropertyConfigurationValidatorBase, IValueValidator + internal sealed class MinMaxValidator : SliderPropertyConfigurationValidatorBase, IValueValidator { /// /// Initializes a new instance of the class. @@ -272,7 +272,7 @@ public class SliderPropertyEditor : DataEditor /// /// Validates the step configuration for the slider property editor. /// - internal class StepValidator : SliderPropertyConfigurationValidatorBase, IValueValidator + internal sealed class StepValidator : SliderPropertyConfigurationValidatorBase, IValueValidator { /// /// Initializes a new instance of the class. diff --git a/src/Umbraco.Infrastructure/PropertyEditors/TagsPropertyEditor.cs b/src/Umbraco.Infrastructure/PropertyEditors/TagsPropertyEditor.cs index 086e698f1a..ab56bc14ee 100644 --- a/src/Umbraco.Infrastructure/PropertyEditors/TagsPropertyEditor.cs +++ b/src/Umbraco.Infrastructure/PropertyEditors/TagsPropertyEditor.cs @@ -46,7 +46,7 @@ public class TagsPropertyEditor : DataEditor protected override IConfigurationEditor CreateConfigurationEditor() => new TagConfigurationEditor(_ioHelper); - internal class TagPropertyValueEditor : DataValueEditor, IDataValueTags + internal sealed class TagPropertyValueEditor : DataValueEditor, IDataValueTags { private readonly IJsonSerializer _jsonSerializer; private readonly IDataTypeService _dataTypeService; @@ -183,7 +183,7 @@ public class TagsPropertyEditor : DataEditor /// the underlying data is JSON. Yes, this makes little sense. /// /// - private class RequiredJsonValueValidator : IValueRequiredValidator + private sealed class RequiredJsonValueValidator : IValueRequiredValidator { /// public IEnumerable ValidateRequired(object? value, string valueType) diff --git a/src/Umbraco.Infrastructure/PropertyEditors/TrueFalsePropertyEditor.cs b/src/Umbraco.Infrastructure/PropertyEditors/TrueFalsePropertyEditor.cs index df63ee52d2..705b51befd 100644 --- a/src/Umbraco.Infrastructure/PropertyEditors/TrueFalsePropertyEditor.cs +++ b/src/Umbraco.Infrastructure/PropertyEditors/TrueFalsePropertyEditor.cs @@ -33,7 +33,7 @@ public class TrueFalsePropertyEditor : DataEditor /// /// Defines the value editor for the true/false (toggle) property editor. /// - internal class TrueFalsePropertyValueEditor : DataValueEditor + internal sealed class TrueFalsePropertyValueEditor : DataValueEditor { /// /// Initializes a new instance of the class. @@ -61,7 +61,7 @@ public class TrueFalsePropertyEditor : DataEditor public override object? FromEditor(ContentPropertyData editorValue, object? currentValue) => ParsePropertyValue(editorValue.Value) ? 1 : 0; - private bool ParsePropertyValue(object? value) + private static bool ParsePropertyValue(object? value) => value switch { bool booleanValue => booleanValue, diff --git a/src/Umbraco.Infrastructure/PropertyEditors/Validators/BlockListValueRequiredValidator.cs b/src/Umbraco.Infrastructure/PropertyEditors/Validators/BlockListValueRequiredValidator.cs index 40d67bb0d2..8cc23a5b2d 100644 --- a/src/Umbraco.Infrastructure/PropertyEditors/Validators/BlockListValueRequiredValidator.cs +++ b/src/Umbraco.Infrastructure/PropertyEditors/Validators/BlockListValueRequiredValidator.cs @@ -9,7 +9,7 @@ namespace Umbraco.Cms.Infrastructure.PropertyEditors.Validators; /// /// Custom validator for block value required validation. /// -internal class BlockListValueRequiredValidator : RequiredValidator +internal sealed class BlockListValueRequiredValidator : RequiredValidator { private readonly IJsonSerializer _jsonSerializer; diff --git a/src/Umbraco.Infrastructure/PropertyEditors/Validators/RichTextRegexValidator.cs b/src/Umbraco.Infrastructure/PropertyEditors/Validators/RichTextRegexValidator.cs index 4e6a5c049e..3bed75e946 100644 --- a/src/Umbraco.Infrastructure/PropertyEditors/Validators/RichTextRegexValidator.cs +++ b/src/Umbraco.Infrastructure/PropertyEditors/Validators/RichTextRegexValidator.cs @@ -4,7 +4,7 @@ using Umbraco.Cms.Core.Serialization; namespace Umbraco.Cms.Core.PropertyEditors.Validators; -internal class RichTextRegexValidator : IRichTextRegexValidator +internal sealed class RichTextRegexValidator : IRichTextRegexValidator { private readonly RegexValidator _regexValidator; private readonly IJsonSerializer _jsonSerializer; diff --git a/src/Umbraco.Infrastructure/PropertyEditors/Validators/RichTextRequiredValidator.cs b/src/Umbraco.Infrastructure/PropertyEditors/Validators/RichTextRequiredValidator.cs index 89f27f43ff..90d80c1e25 100644 --- a/src/Umbraco.Infrastructure/PropertyEditors/Validators/RichTextRequiredValidator.cs +++ b/src/Umbraco.Infrastructure/PropertyEditors/Validators/RichTextRequiredValidator.cs @@ -1,16 +1,15 @@ using System.ComponentModel.DataAnnotations; using Microsoft.Extensions.Logging; using Umbraco.Cms.Core.Serialization; -using Umbraco.Cms.Core.Services; namespace Umbraco.Cms.Core.PropertyEditors.Validators; -internal class RichTextRequiredValidator : RequiredValidator, IRichTextRequiredValidator +internal sealed class RichTextRequiredValidator : RequiredValidator, IRichTextRequiredValidator { private readonly IJsonSerializer _jsonSerializer; private readonly ILogger _logger; - public RichTextRequiredValidator(ILocalizedTextService textService, IJsonSerializer jsonSerializer, ILogger logger) : base() + public RichTextRequiredValidator(IJsonSerializer jsonSerializer, ILogger logger) : base() { _jsonSerializer = jsonSerializer; _logger = logger; diff --git a/src/Umbraco.Infrastructure/PropertyEditors/Validators/TrueFalseValueRequiredValidator.cs b/src/Umbraco.Infrastructure/PropertyEditors/Validators/TrueFalseValueRequiredValidator.cs index 3e1cdfd117..31200384ac 100644 --- a/src/Umbraco.Infrastructure/PropertyEditors/Validators/TrueFalseValueRequiredValidator.cs +++ b/src/Umbraco.Infrastructure/PropertyEditors/Validators/TrueFalseValueRequiredValidator.cs @@ -7,7 +7,7 @@ namespace Umbraco.Cms.Infrastructure.PropertyEditors.Validators; /// /// Custom validator for true/false (toggle) required validation. /// -internal class TrueFalseValueRequiredValidator : RequiredValidator +internal sealed class TrueFalseValueRequiredValidator : RequiredValidator { /// public override IEnumerable ValidateRequired(object? value, string? valueType) diff --git a/src/Umbraco.Infrastructure/PropertyEditors/ValueConverters/BlockGridPropertyValueCreator.cs b/src/Umbraco.Infrastructure/PropertyEditors/ValueConverters/BlockGridPropertyValueCreator.cs index 1cfef58b23..ea00423a7c 100644 --- a/src/Umbraco.Infrastructure/PropertyEditors/ValueConverters/BlockGridPropertyValueCreator.cs +++ b/src/Umbraco.Infrastructure/PropertyEditors/ValueConverters/BlockGridPropertyValueCreator.cs @@ -5,7 +5,7 @@ using Umbraco.Extensions; namespace Umbraco.Cms.Core.PropertyEditors.ValueConverters; -internal class BlockGridPropertyValueCreator : BlockPropertyValueCreatorBase +internal sealed class BlockGridPropertyValueCreator : BlockPropertyValueCreatorBase { private readonly IJsonSerializer _jsonSerializer; private readonly BlockGridPropertyValueConstructorCache _constructorCache; @@ -68,7 +68,7 @@ internal class BlockGridPropertyValueCreator : BlockPropertyValueCreatorBase CreateBlockItemActivator() => new BlockGridItemActivator(BlockEditorConverter, _constructorCache); - private class BlockGridItemActivator : BlockItemActivator + private sealed class BlockGridItemActivator : BlockItemActivator { public BlockGridItemActivator(BlockEditorConverter blockConverter, BlockGridPropertyValueConstructorCache constructorCache) : base(blockConverter, constructorCache) diff --git a/src/Umbraco.Infrastructure/PropertyEditors/ValueConverters/BlockListPropertyValueCreator.cs b/src/Umbraco.Infrastructure/PropertyEditors/ValueConverters/BlockListPropertyValueCreator.cs index 5714256759..8180781af1 100644 --- a/src/Umbraco.Infrastructure/PropertyEditors/ValueConverters/BlockListPropertyValueCreator.cs +++ b/src/Umbraco.Infrastructure/PropertyEditors/ValueConverters/BlockListPropertyValueCreator.cs @@ -4,7 +4,7 @@ using Umbraco.Cms.Core.Serialization; namespace Umbraco.Cms.Core.PropertyEditors.ValueConverters; -internal class BlockListPropertyValueCreator : BlockPropertyValueCreatorBase +internal sealed class BlockListPropertyValueCreator : BlockPropertyValueCreatorBase { private readonly IJsonSerializer _jsonSerializer; private readonly BlockListPropertyValueConstructorCache _constructorCache; @@ -36,7 +36,7 @@ internal class BlockListPropertyValueCreator : BlockPropertyValueCreatorBase CreateBlockItemActivator() => new BlockListItemActivator(BlockEditorConverter, _constructorCache); - private class BlockListItemActivator : BlockItemActivator + private sealed class BlockListItemActivator : BlockItemActivator { public BlockListItemActivator(BlockEditorConverter blockConverter, BlockListPropertyValueConstructorCache constructorCache) : base(blockConverter, constructorCache) diff --git a/src/Umbraco.Infrastructure/PropertyEditors/ValueConverters/RichTextBlockPropertyValueCreator.cs b/src/Umbraco.Infrastructure/PropertyEditors/ValueConverters/RichTextBlockPropertyValueCreator.cs index 241b5825e2..eb51bd0451 100644 --- a/src/Umbraco.Infrastructure/PropertyEditors/ValueConverters/RichTextBlockPropertyValueCreator.cs +++ b/src/Umbraco.Infrastructure/PropertyEditors/ValueConverters/RichTextBlockPropertyValueCreator.cs @@ -7,7 +7,7 @@ using Umbraco.Cms.Core.Serialization; namespace Umbraco.Cms.Core.PropertyEditors.ValueConverters; -internal class RichTextBlockPropertyValueCreator : BlockPropertyValueCreatorBase +internal sealed class RichTextBlockPropertyValueCreator : BlockPropertyValueCreatorBase { private readonly IJsonSerializer _jsonSerializer; private readonly RichTextBlockPropertyValueConstructorCache _constructorCache; @@ -39,7 +39,7 @@ internal class RichTextBlockPropertyValueCreator : BlockPropertyValueCreatorBase protected override BlockItemActivator CreateBlockItemActivator() => new RichTextBlockItemActivator(BlockEditorConverter, _constructorCache); - private class RichTextBlockItemActivator : BlockItemActivator + private sealed class RichTextBlockItemActivator : BlockItemActivator { public RichTextBlockItemActivator(BlockEditorConverter blockConverter, RichTextBlockPropertyValueConstructorCache constructorCache) : base(blockConverter, constructorCache) diff --git a/src/Umbraco.Infrastructure/PropertyEditors/ValueConverters/RteBlockRenderingValueConverter.cs b/src/Umbraco.Infrastructure/PropertyEditors/ValueConverters/RteBlockRenderingValueConverter.cs index 2c3f061b80..b2c47fc3cb 100644 --- a/src/Umbraco.Infrastructure/PropertyEditors/ValueConverters/RteBlockRenderingValueConverter.cs +++ b/src/Umbraco.Infrastructure/PropertyEditors/ValueConverters/RteBlockRenderingValueConverter.cs @@ -231,7 +231,7 @@ public class RteBlockRenderingValueConverter : SimpleRichTextValueConverter, IDe }; } - private class RichTextEditorIntermediateValue : IRichTextEditorIntermediateValue + private sealed class RichTextEditorIntermediateValue : IRichTextEditorIntermediateValue { public required string Markup { get; set; } diff --git a/src/Umbraco.Infrastructure/PublishedCache/ReservedFieldNamesService.cs b/src/Umbraco.Infrastructure/PublishedCache/ReservedFieldNamesService.cs index c4d981ef10..1125c15de3 100644 --- a/src/Umbraco.Infrastructure/PublishedCache/ReservedFieldNamesService.cs +++ b/src/Umbraco.Infrastructure/PublishedCache/ReservedFieldNamesService.cs @@ -4,7 +4,7 @@ using Umbraco.Cms.Core.Services; namespace Umbraco.Cms.Infrastructure.PublishedCache; -internal class ReservedFieldNamesService : IReservedFieldNamesService +internal sealed class ReservedFieldNamesService : IReservedFieldNamesService { private readonly ContentPropertySettings _contentPropertySettings; private readonly MemberPropertySettings _memberPropertySettings; diff --git a/src/Umbraco.Infrastructure/PublishedContentQuery.cs b/src/Umbraco.Infrastructure/PublishedContentQuery.cs index 4bf0868b10..221a7545ba 100644 --- a/src/Umbraco.Infrastructure/PublishedContentQuery.cs +++ b/src/Umbraco.Infrastructure/PublishedContentQuery.cs @@ -330,7 +330,7 @@ public class PublishedContentQuery : IPublishedContentQuery /// This is used to contextualize the values in the search results when enumerating over them, so that the correct /// culture values are used. /// - private class CultureContextualSearchResults : IEnumerable + private sealed class CultureContextualSearchResults : IEnumerable { private readonly string _culture; private readonly IVariationContextAccessor _variationContextAccessor; @@ -365,7 +365,7 @@ public class PublishedContentQuery : IPublishedContentQuery /// /// Resets the variation context when this is disposed. /// - private class CultureContextualSearchResultsEnumerator : IEnumerator + private sealed class CultureContextualSearchResultsEnumerator : IEnumerator { private readonly VariationContext? _originalContext; private readonly IVariationContextAccessor _variationContextAccessor; diff --git a/src/Umbraco.Infrastructure/Routing/NotFoundHandlerHelper.cs b/src/Umbraco.Infrastructure/Routing/NotFoundHandlerHelper.cs index 818ecc50ca..39cc120a6c 100644 --- a/src/Umbraco.Infrastructure/Routing/NotFoundHandlerHelper.cs +++ b/src/Umbraco.Infrastructure/Routing/NotFoundHandlerHelper.cs @@ -9,7 +9,7 @@ namespace Umbraco.Cms.Core.Routing; /// Used to determine the node to display when content is not found based on the configured error404 elements in /// umbracoSettings.config /// -internal class NotFoundHandlerHelper +internal sealed class NotFoundHandlerHelper { internal static int? GetCurrentNotFoundPageId( ContentErrorPage[] error404Collection, diff --git a/src/Umbraco.Infrastructure/Routing/RedirectTracker.cs b/src/Umbraco.Infrastructure/Routing/RedirectTracker.cs index 9a84a6ee56..7cbf91ae8d 100644 --- a/src/Umbraco.Infrastructure/Routing/RedirectTracker.cs +++ b/src/Umbraco.Infrastructure/Routing/RedirectTracker.cs @@ -13,7 +13,7 @@ using Umbraco.Extensions; namespace Umbraco.Cms.Infrastructure.Routing { - internal class RedirectTracker : IRedirectTracker + internal sealed class RedirectTracker : IRedirectTracker { private readonly ILocalizationService _localizationService; private readonly IRedirectUrlService _redirectUrlService; diff --git a/src/Umbraco.Infrastructure/Runtime/DefaultMainDomKeyGenerator.cs b/src/Umbraco.Infrastructure/Runtime/DefaultMainDomKeyGenerator.cs index a32b77eeac..64b1a70f12 100644 --- a/src/Umbraco.Infrastructure/Runtime/DefaultMainDomKeyGenerator.cs +++ b/src/Umbraco.Infrastructure/Runtime/DefaultMainDomKeyGenerator.cs @@ -7,7 +7,7 @@ using Umbraco.Extensions; namespace Umbraco.Cms.Infrastructure.Runtime; -internal class DefaultMainDomKeyGenerator : IMainDomKeyGenerator +internal sealed class DefaultMainDomKeyGenerator : IMainDomKeyGenerator { private readonly IOptionsMonitor _globalSettings; private readonly IHostingEnvironment _hostingEnvironment; diff --git a/src/Umbraco.Infrastructure/Runtime/FileSystemMainDomLock.cs b/src/Umbraco.Infrastructure/Runtime/FileSystemMainDomLock.cs index 403bde229a..a69d936efa 100644 --- a/src/Umbraco.Infrastructure/Runtime/FileSystemMainDomLock.cs +++ b/src/Umbraco.Infrastructure/Runtime/FileSystemMainDomLock.cs @@ -7,7 +7,7 @@ using Umbraco.Cms.Core.Runtime; namespace Umbraco.Cms.Infrastructure.Runtime; -internal class FileSystemMainDomLock : IMainDomLock +internal sealed class FileSystemMainDomLock : IMainDomLock { private readonly CancellationTokenSource _cancellationTokenSource = new(); private readonly IHostingEnvironment _hostingEnvironment; @@ -109,7 +109,7 @@ internal class FileSystemMainDomLock : IMainDomLock /// Releases the resources used by this . /// true to release both managed resources. - protected virtual void Dispose(bool disposing) + private void Dispose(bool disposing) { if (disposing && !_disposed) { diff --git a/src/Umbraco.Infrastructure/Runtime/RuntimeModeValidationService.cs b/src/Umbraco.Infrastructure/Runtime/RuntimeModeValidationService.cs index c4bbeb6902..0784a51d59 100644 --- a/src/Umbraco.Infrastructure/Runtime/RuntimeModeValidationService.cs +++ b/src/Umbraco.Infrastructure/Runtime/RuntimeModeValidationService.cs @@ -6,7 +6,7 @@ using Umbraco.Cms.Core.Configuration.Models; namespace Umbraco.Cms.Infrastructure.Runtime; /// -internal class RuntimeModeValidationService : IRuntimeModeValidationService +internal sealed class RuntimeModeValidationService : IRuntimeModeValidationService { private readonly IOptionsMonitor _runtimeSettings; private readonly IServiceProvider _serviceProvider; diff --git a/src/Umbraco.Infrastructure/Scoping/AmbientScopeContextStack.cs b/src/Umbraco.Infrastructure/Scoping/AmbientScopeContextStack.cs index 1d2a947ff7..b69fe31fee 100644 --- a/src/Umbraco.Infrastructure/Scoping/AmbientScopeContextStack.cs +++ b/src/Umbraco.Infrastructure/Scoping/AmbientScopeContextStack.cs @@ -3,7 +3,7 @@ using Umbraco.Cms.Core.Scoping; namespace Umbraco.Cms.Infrastructure.Scoping; -internal class AmbientScopeContextStack : IAmbientScopeContextStack +internal sealed class AmbientScopeContextStack : IAmbientScopeContextStack { private static Lock _lock = new(); private static AsyncLocal> _stack = new(); diff --git a/src/Umbraco.Infrastructure/Scoping/AmbientScopeStack.cs b/src/Umbraco.Infrastructure/Scoping/AmbientScopeStack.cs index efb5ea27ac..4ab55f0254 100644 --- a/src/Umbraco.Infrastructure/Scoping/AmbientScopeStack.cs +++ b/src/Umbraco.Infrastructure/Scoping/AmbientScopeStack.cs @@ -2,7 +2,7 @@ using System.Collections.Concurrent; namespace Umbraco.Cms.Infrastructure.Scoping { - internal class AmbientScopeStack : IAmbientScopeStack + internal sealed class AmbientScopeStack : IAmbientScopeStack { private static Lock _lock = new(); private static AsyncLocal> _stack = new (); diff --git a/src/Umbraco.Infrastructure/Scoping/HttpScopeReference.cs b/src/Umbraco.Infrastructure/Scoping/HttpScopeReference.cs index 0ccd8c6efe..31f4b1a965 100644 --- a/src/Umbraco.Infrastructure/Scoping/HttpScopeReference.cs +++ b/src/Umbraco.Infrastructure/Scoping/HttpScopeReference.cs @@ -9,7 +9,7 @@ namespace Umbraco.Cms.Core.Scoping; /// Disposed at the end of the request to cleanup any orphaned Scopes. /// /// Registered as Scoped in DI (per request) -internal class HttpScopeReference : IHttpScopeReference +internal sealed class HttpScopeReference : IHttpScopeReference { private readonly ScopeProvider _scopeProvider; private bool _disposedValue; @@ -24,7 +24,7 @@ internal class HttpScopeReference : IHttpScopeReference public void Register() => _registered = true; - protected virtual void Dispose(bool disposing) + private void Dispose(bool disposing) { if (!_disposedValue) { diff --git a/src/Umbraco.Infrastructure/Scoping/Scope.cs b/src/Umbraco.Infrastructure/Scoping/Scope.cs index 55c45bd881..93429ad650 100644 --- a/src/Umbraco.Infrastructure/Scoping/Scope.cs +++ b/src/Umbraco.Infrastructure/Scoping/Scope.cs @@ -15,7 +15,7 @@ namespace Umbraco.Cms.Infrastructure.Scoping /// Implements . /// /// Not thread-safe obviously. - internal class Scope : CoreScope, ICoreScope, IScope, Core.Scoping.IScope + internal sealed class Scope : CoreScope, ICoreScope, IScope, Core.Scoping.IScope { private readonly bool _autoComplete; private readonly CoreDebugSettings _coreDebugSettings; diff --git a/src/Umbraco.Infrastructure/Scoping/ScopeContext.cs b/src/Umbraco.Infrastructure/Scoping/ScopeContext.cs index fbaad205a2..6159b2f743 100644 --- a/src/Umbraco.Infrastructure/Scoping/ScopeContext.cs +++ b/src/Umbraco.Infrastructure/Scoping/ScopeContext.cs @@ -104,7 +104,7 @@ _enlisted ??= new Dictionary(); return enlistedAs.Item; } - private class EnlistedObject : IEnlistedObject + private sealed class EnlistedObject : IEnlistedObject { private readonly Action? _action; diff --git a/src/Umbraco.Infrastructure/Scoping/ScopeProvider.cs b/src/Umbraco.Infrastructure/Scoping/ScopeProvider.cs index 6a30bd21ac..5940790ab6 100644 --- a/src/Umbraco.Infrastructure/Scoping/ScopeProvider.cs +++ b/src/Umbraco.Infrastructure/Scoping/ScopeProvider.cs @@ -19,7 +19,7 @@ namespace Umbraco.Cms.Infrastructure.Scoping /// /// Implements . /// - internal class ScopeProvider : + internal sealed class ScopeProvider : ICoreScopeProvider, IScopeProvider, Core.Scoping.IScopeProvider, diff --git a/src/Umbraco.Infrastructure/Security/PasswordChanger.cs b/src/Umbraco.Infrastructure/Security/PasswordChanger.cs index b3de060b42..e5c00ec143 100644 --- a/src/Umbraco.Infrastructure/Security/PasswordChanger.cs +++ b/src/Umbraco.Infrastructure/Security/PasswordChanger.cs @@ -10,7 +10,7 @@ namespace Umbraco.Cms.Core.Security; /// /// Changes the password for an identity user /// -internal class PasswordChanger : IPasswordChanger where TUser : UmbracoIdentityUser +internal sealed class PasswordChanger : IPasswordChanger where TUser : UmbracoIdentityUser { private readonly ILogger> _logger; diff --git a/src/Umbraco.Infrastructure/Telemetry/Providers/SystemTroubleshootingInformationTelemetryProvider.cs b/src/Umbraco.Infrastructure/Telemetry/Providers/SystemTroubleshootingInformationTelemetryProvider.cs index 8acf2dd7e9..a718185740 100644 --- a/src/Umbraco.Infrastructure/Telemetry/Providers/SystemTroubleshootingInformationTelemetryProvider.cs +++ b/src/Umbraco.Infrastructure/Telemetry/Providers/SystemTroubleshootingInformationTelemetryProvider.cs @@ -14,7 +14,7 @@ using Umbraco.Extensions; namespace Umbraco.Cms.Infrastructure.Telemetry.Providers; -internal class SystemTroubleshootingInformationTelemetryProvider : IDetailedTelemetryProvider, ISystemTroubleshootingInformationService +internal sealed class SystemTroubleshootingInformationTelemetryProvider : IDetailedTelemetryProvider, ISystemTroubleshootingInformationService { private readonly IHostEnvironment _hostEnvironment; private readonly HostingSettings _hostingSettings; @@ -45,21 +45,21 @@ internal class SystemTroubleshootingInformationTelemetryProvider : IDetailedTele _modelsBuilderSettings = modelsBuilderSettings.CurrentValue; } - private string CurrentWebServer => GetWebServerName(); + private static string CurrentWebServer => GetWebServerName(); - private string ServerFramework => RuntimeInformation.FrameworkDescription; + private static string ServerFramework => RuntimeInformation.FrameworkDescription; private string ModelsBuilderMode => _modelsBuilderSettings.ModelsMode.ToString(); private string RuntimeMode => _runtimeSettings.Mode.ToString(); - private string CurrentCulture => Thread.CurrentThread.CurrentCulture.ToString(); + private static string CurrentCulture => Thread.CurrentThread.CurrentCulture.ToString(); private bool IsDebug => _hostingSettings.Debug; private string AspEnvironment => _hostEnvironment.EnvironmentName; - private string ServerOs => RuntimeInformation.OSDescription; + private static string ServerOs => RuntimeInformation.OSDescription; private string DatabaseProvider => _umbracoDatabaseFactory.CreateDatabase().DatabaseType.GetProviderName(); @@ -96,7 +96,7 @@ internal class SystemTroubleshootingInformationTelemetryProvider : IDetailedTele { "Current Server Role", CurrentServerRole }, }; - private string GetWebServerName() + private static string GetWebServerName() { var processName = Path.GetFileNameWithoutExtension(Process.GetCurrentProcess().ProcessName); diff --git a/src/Umbraco.Infrastructure/Telemetry/Services/UsageInformationService.cs b/src/Umbraco.Infrastructure/Telemetry/Services/UsageInformationService.cs index c5d35ef08f..65af0856fd 100644 --- a/src/Umbraco.Infrastructure/Telemetry/Services/UsageInformationService.cs +++ b/src/Umbraco.Infrastructure/Telemetry/Services/UsageInformationService.cs @@ -3,7 +3,7 @@ using Umbraco.Cms.Infrastructure.Telemetry.Interfaces; namespace Umbraco.Cms.Core.Services; -internal class UsageInformationService : IUsageInformationService +internal sealed class UsageInformationService : IUsageInformationService { private readonly IMetricsConsentService _metricsConsentService; private readonly IEnumerable _providers; diff --git a/src/Umbraco.PublishedCache.HybridCache/DatabaseCacheRebuilder.cs b/src/Umbraco.PublishedCache.HybridCache/DatabaseCacheRebuilder.cs index 1823825a9f..40ad248728 100644 --- a/src/Umbraco.PublishedCache.HybridCache/DatabaseCacheRebuilder.cs +++ b/src/Umbraco.PublishedCache.HybridCache/DatabaseCacheRebuilder.cs @@ -14,7 +14,7 @@ namespace Umbraco.Cms.Infrastructure.HybridCache; /// /// Rebuilds the published content cache in the database. /// -internal class DatabaseCacheRebuilder : IDatabaseCacheRebuilder +internal sealed class DatabaseCacheRebuilder : IDatabaseCacheRebuilder { private const string NuCacheSerializerKey = "Umbraco.Web.PublishedCache.NuCache.Serializer"; private const string IsRebuildingDatabaseCacheRuntimeCacheKey = "temp_database_cache_rebuild_op"; diff --git a/src/Umbraco.PublishedCache.HybridCache/Factories/CacheNodeFactory.cs b/src/Umbraco.PublishedCache.HybridCache/Factories/CacheNodeFactory.cs index e2be9797a0..ba2b955afe 100644 --- a/src/Umbraco.PublishedCache.HybridCache/Factories/CacheNodeFactory.cs +++ b/src/Umbraco.PublishedCache.HybridCache/Factories/CacheNodeFactory.cs @@ -1,21 +1,18 @@ using Umbraco.Cms.Core.Models; -using Umbraco.Cms.Core.Services; using Umbraco.Cms.Core.Strings; using Umbraco.Extensions; namespace Umbraco.Cms.Infrastructure.HybridCache.Factories; -internal class CacheNodeFactory : ICacheNodeFactory +internal sealed class CacheNodeFactory : ICacheNodeFactory { private readonly IShortStringHelper _shortStringHelper; private readonly UrlSegmentProviderCollection _urlSegmentProviders; - private readonly IDocumentUrlService _documentUrlService; - public CacheNodeFactory(IShortStringHelper shortStringHelper, UrlSegmentProviderCollection urlSegmentProviders, IDocumentUrlService documentUrlService) + public CacheNodeFactory(IShortStringHelper shortStringHelper, UrlSegmentProviderCollection urlSegmentProviders) { _shortStringHelper = shortStringHelper; _urlSegmentProviders = urlSegmentProviders; - _documentUrlService = documentUrlService; } public ContentCacheNode ToContentCacheNode(IContent content, bool preview) @@ -41,7 +38,7 @@ internal class CacheNodeFactory : ICacheNodeFactory }; } - private bool GetPublishedValue(IContent content, bool preview) + private static bool GetPublishedValue(IContent content, bool preview) { switch (content.PublishedState) { @@ -56,7 +53,7 @@ internal class CacheNodeFactory : ICacheNodeFactory } } - private int? GetTemplateId(IContent content, bool preview) + private static int? GetTemplateId(IContent content, bool preview) { switch (content.PublishedState) { diff --git a/src/Umbraco.PublishedCache.HybridCache/Factories/PublishedContentFactory.cs b/src/Umbraco.PublishedCache.HybridCache/Factories/PublishedContentFactory.cs index 1afc363555..57863dc986 100644 --- a/src/Umbraco.PublishedCache.HybridCache/Factories/PublishedContentFactory.cs +++ b/src/Umbraco.PublishedCache.HybridCache/Factories/PublishedContentFactory.cs @@ -4,7 +4,7 @@ using Umbraco.Cms.Core.PublishedCache; namespace Umbraco.Cms.Infrastructure.HybridCache.Factories; -internal class PublishedContentFactory : IPublishedContentFactory +internal sealed class PublishedContentFactory : IPublishedContentFactory { private readonly IElementsCache _elementsCache; private readonly IVariationContextAccessor _variationContextAccessor; @@ -88,7 +88,7 @@ internal class PublishedContentFactory : IPublishedContentFactory return new PublishedMember(member, contentNode, _elementsCache, _variationContextAccessor); } - private Dictionary GetPropertyValues(IPublishedContentType contentType, IMember member) + private static Dictionary GetPropertyValues(IPublishedContentType contentType, IMember member) { var properties = member .Properties @@ -111,7 +111,7 @@ internal class PublishedContentFactory : IPublishedContentFactory return properties; } - private void AddIf(IPublishedContentType contentType, IDictionary properties, string alias, object? value) + private static void AddIf(IPublishedContentType contentType, IDictionary properties, string alias, object? value) { IPublishedPropertyType? propertyType = contentType.GetPropertyType(alias); if (propertyType == null || propertyType.IsUserProperty) @@ -135,14 +135,14 @@ internal class PublishedContentFactory : IPublishedContentFactory } - private IPublishedContent? GetPublishedContentAsDraft(IPublishedContent? content) => + private static IPublishedContent? GetPublishedContentAsDraft(IPublishedContent? content) => content == null ? null : // an object in the cache is either an IPublishedContentOrMedia, // or a model inheriting from PublishedContentExtended - in which // case we need to unwrap to get to the original IPublishedContentOrMedia. UnwrapIPublishedContent(content); - private PublishedContent UnwrapIPublishedContent(IPublishedContent content) + private static PublishedContent UnwrapIPublishedContent(IPublishedContent content) { while (content is PublishedContentWrapped wrapped) { diff --git a/src/Umbraco.PublishedCache.HybridCache/NotificationHandlers/SeedingNotificationHandler.cs b/src/Umbraco.PublishedCache.HybridCache/NotificationHandlers/SeedingNotificationHandler.cs index 47f590125f..0581bd2654 100644 --- a/src/Umbraco.PublishedCache.HybridCache/NotificationHandlers/SeedingNotificationHandler.cs +++ b/src/Umbraco.PublishedCache.HybridCache/NotificationHandlers/SeedingNotificationHandler.cs @@ -9,7 +9,7 @@ using Umbraco.Cms.Infrastructure.HybridCache.Services; namespace Umbraco.Cms.Infrastructure.HybridCache.NotificationHandlers; -internal class SeedingNotificationHandler : INotificationAsyncHandler +internal sealed class SeedingNotificationHandler : INotificationAsyncHandler { private readonly IDocumentCacheService _documentCacheService; private readonly IMediaCacheService _mediaCacheService; diff --git a/src/Umbraco.PublishedCache.HybridCache/Persistence/ContentSourceDto.cs b/src/Umbraco.PublishedCache.HybridCache/Persistence/ContentSourceDto.cs index 4d4fcae73d..187e94fd72 100644 --- a/src/Umbraco.PublishedCache.HybridCache/Persistence/ContentSourceDto.cs +++ b/src/Umbraco.PublishedCache.HybridCache/Persistence/ContentSourceDto.cs @@ -3,7 +3,7 @@ namespace Umbraco.Cms.Infrastructure.HybridCache.Persistence { // read-only dto - internal class ContentSourceDto : IReadOnlyContentBase + internal sealed class ContentSourceDto : IReadOnlyContentBase { public int Id { get; init; } diff --git a/src/Umbraco.PublishedCache.HybridCache/PublishedMember.cs b/src/Umbraco.PublishedCache.HybridCache/PublishedMember.cs index 4253b1a4c3..8aae008782 100644 --- a/src/Umbraco.PublishedCache.HybridCache/PublishedMember.cs +++ b/src/Umbraco.PublishedCache.HybridCache/PublishedMember.cs @@ -6,7 +6,7 @@ namespace Umbraco.Cms.Infrastructure.HybridCache; // note // the whole PublishedMember thing should be refactored because as soon as a member // is wrapped on in a model, the inner IMember and all associated properties are lost -internal class PublishedMember : PublishedContent, IPublishedMember +internal sealed class PublishedMember : PublishedContent, IPublishedMember { private readonly IMember _member; diff --git a/src/Umbraco.PublishedCache.HybridCache/PublishedProperty.cs b/src/Umbraco.PublishedCache.HybridCache/PublishedProperty.cs index 187b558385..167e46c253 100644 --- a/src/Umbraco.PublishedCache.HybridCache/PublishedProperty.cs +++ b/src/Umbraco.PublishedCache.HybridCache/PublishedProperty.cs @@ -8,7 +8,7 @@ using Umbraco.Extensions; namespace Umbraco.Cms.Infrastructure.HybridCache; -internal class PublishedProperty : PublishedPropertyBase +internal sealed class PublishedProperty : PublishedPropertyBase { private readonly PublishedContent _content; private readonly bool _isPreviewing; @@ -76,7 +76,7 @@ internal class PublishedProperty : PublishedPropertyBase // used to cache the CacheValues of this property internal string ValuesCacheKey => _valuesCacheKey ??= PropertyCacheValues(_content.Key, Alias, _isPreviewing); - private string PropertyCacheValues(Guid contentUid, string typeAlias, bool previewing) + private static string PropertyCacheValues(Guid contentUid, string typeAlias, bool previewing) { if (previewing) { @@ -226,7 +226,7 @@ internal class PublishedProperty : PublishedPropertyBase return value; } - private object? GetDeliveryApiDefaultObject(CacheValue cacheValues, Func getValue) + private static object? GetDeliveryApiDefaultObject(CacheValue cacheValues, Func getValue) { if (cacheValues.DeliveryApiDefaultObjectInitialized == false) { @@ -237,7 +237,7 @@ internal class PublishedProperty : PublishedPropertyBase return cacheValues.DeliveryApiDefaultObjectValue; } - private object? GetDeliveryApiExpandedObject(CacheValue cacheValues, Func getValue) + private static object? GetDeliveryApiExpandedObject(CacheValue cacheValues, Func getValue) { if (cacheValues.DeliveryApiExpandedObjectInitialized == false) { @@ -248,7 +248,7 @@ internal class PublishedProperty : PublishedPropertyBase return cacheValues.DeliveryApiExpandedObjectValue; } - private class SourceInterValue + private sealed class SourceInterValue { private string? _culture; private string? _segment; @@ -268,7 +268,7 @@ internal class PublishedProperty : PublishedPropertyBase public object? SourceValue { get; set; } } - private class CacheValues : CacheValue + private sealed class CacheValues : CacheValue { private readonly Lock _locko = new(); private ConcurrentDictionary? _values; diff --git a/src/Umbraco.PublishedCache.HybridCache/Serialization/HybridCacheSerializer.cs b/src/Umbraco.PublishedCache.HybridCache/Serialization/HybridCacheSerializer.cs index dbe88358df..11f2a9da3a 100644 --- a/src/Umbraco.PublishedCache.HybridCache/Serialization/HybridCacheSerializer.cs +++ b/src/Umbraco.PublishedCache.HybridCache/Serialization/HybridCacheSerializer.cs @@ -6,7 +6,7 @@ using Microsoft.Extensions.Logging; namespace Umbraco.Cms.Infrastructure.HybridCache.Serialization; -internal class HybridCacheSerializer : IHybridCacheSerializer +internal sealed class HybridCacheSerializer : IHybridCacheSerializer { private readonly ILogger _logger; private readonly MessagePackSerializerOptions _options; diff --git a/src/Umbraco.PublishedCache.HybridCache/Serialization/JsonContentNestedDataSerializer.cs b/src/Umbraco.PublishedCache.HybridCache/Serialization/JsonContentNestedDataSerializer.cs index 1bb4822ced..9c730fc323 100644 --- a/src/Umbraco.PublishedCache.HybridCache/Serialization/JsonContentNestedDataSerializer.cs +++ b/src/Umbraco.PublishedCache.HybridCache/Serialization/JsonContentNestedDataSerializer.cs @@ -7,7 +7,7 @@ namespace Umbraco.Cms.Infrastructure.HybridCache.Serialization; /// /// Serializes/deserializes documents to the SQL Database as JSON. /// -internal class JsonContentNestedDataSerializer : IContentCacheDataSerializer +internal sealed class JsonContentNestedDataSerializer : IContentCacheDataSerializer { private static readonly JsonSerializerOptions _jsonSerializerOptions = new() { @@ -47,7 +47,7 @@ internal class JsonContentNestedDataSerializer : IContentCacheDataSerializer /// /// Provides a converter for handling JSON objects that can be of various types (string, number, boolean, null, or complex types). /// - internal class JsonObjectConverter : JsonConverter + internal sealed class JsonObjectConverter : JsonConverter { /// public override object? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) @@ -65,5 +65,4 @@ internal class JsonContentNestedDataSerializer : IContentCacheDataSerializer public override void Write(Utf8JsonWriter writer, object value, JsonSerializerOptions options) => JsonSerializer.Serialize(writer, value, value.GetType(), options); } - } diff --git a/src/Umbraco.PublishedCache.HybridCache/Serialization/JsonContentNestedDataSerializerFactory.cs b/src/Umbraco.PublishedCache.HybridCache/Serialization/JsonContentNestedDataSerializerFactory.cs index 7353953f4a..c3c5e395c3 100644 --- a/src/Umbraco.PublishedCache.HybridCache/Serialization/JsonContentNestedDataSerializerFactory.cs +++ b/src/Umbraco.PublishedCache.HybridCache/Serialization/JsonContentNestedDataSerializerFactory.cs @@ -1,6 +1,6 @@ namespace Umbraco.Cms.Infrastructure.HybridCache.Serialization; -internal class JsonContentNestedDataSerializerFactory : IContentCacheDataSerializerFactory +internal sealed class JsonContentNestedDataSerializerFactory : IContentCacheDataSerializerFactory { private readonly Lazy _serializer = new(); diff --git a/src/Umbraco.PublishedCache.HybridCache/Serialization/MsgPackContentNestedDataSerializerFactory.cs b/src/Umbraco.PublishedCache.HybridCache/Serialization/MsgPackContentNestedDataSerializerFactory.cs index f75f83ab73..9fa69f4d00 100644 --- a/src/Umbraco.PublishedCache.HybridCache/Serialization/MsgPackContentNestedDataSerializerFactory.cs +++ b/src/Umbraco.PublishedCache.HybridCache/Serialization/MsgPackContentNestedDataSerializerFactory.cs @@ -5,7 +5,7 @@ using Umbraco.Cms.Core.Services; namespace Umbraco.Cms.Infrastructure.HybridCache.Serialization; -internal class MsgPackContentNestedDataSerializerFactory : IContentCacheDataSerializerFactory +internal sealed class MsgPackContentNestedDataSerializerFactory : IContentCacheDataSerializerFactory { private readonly IPropertyCacheCompressionOptions _compressionOptions; private readonly IContentTypeService _contentTypeService; diff --git a/src/Umbraco.PublishedCache.HybridCache/Services/MediaCacheService.cs b/src/Umbraco.PublishedCache.HybridCache/Services/MediaCacheService.cs index 66c9fb73eb..4359f824c8 100644 --- a/src/Umbraco.PublishedCache.HybridCache/Services/MediaCacheService.cs +++ b/src/Umbraco.PublishedCache.HybridCache/Services/MediaCacheService.cs @@ -13,7 +13,7 @@ using Umbraco.Extensions; namespace Umbraco.Cms.Infrastructure.HybridCache.Services; -internal class MediaCacheService : IMediaCacheService +internal sealed class MediaCacheService : IMediaCacheService { private readonly IDatabaseCacheRepository _databaseCacheRepository; private readonly IIdKeyMap _idKeyMap; diff --git a/src/Umbraco.PublishedCache.HybridCache/Services/MemberCacheService.cs b/src/Umbraco.PublishedCache.HybridCache/Services/MemberCacheService.cs index f7bc3896fb..90eba2bd5f 100644 --- a/src/Umbraco.PublishedCache.HybridCache/Services/MemberCacheService.cs +++ b/src/Umbraco.PublishedCache.HybridCache/Services/MemberCacheService.cs @@ -5,7 +5,7 @@ using Umbraco.Cms.Infrastructure.HybridCache.Factories; namespace Umbraco.Cms.Infrastructure.HybridCache.Services; -internal class MemberCacheService : IMemberCacheService +internal sealed class MemberCacheService : IMemberCacheService { private readonly IPublishedContentFactory _publishedContentFactory; diff --git a/src/Umbraco.Web.Common/ApplicationBuilder/UmbracoEndpointBuilder.cs b/src/Umbraco.Web.Common/ApplicationBuilder/UmbracoEndpointBuilder.cs index fa75ed116d..52c30690ba 100644 --- a/src/Umbraco.Web.Common/ApplicationBuilder/UmbracoEndpointBuilder.cs +++ b/src/Umbraco.Web.Common/ApplicationBuilder/UmbracoEndpointBuilder.cs @@ -7,7 +7,7 @@ namespace Umbraco.Cms.Web.Common.ApplicationBuilder; /// /// A builder to allow encapsulating the enabled endpoints in Umbraco /// -internal class UmbracoEndpointBuilder : IUmbracoEndpointBuilderContext +internal sealed class UmbracoEndpointBuilder : IUmbracoEndpointBuilderContext { public UmbracoEndpointBuilder(IServiceProvider services, IRuntimeState runtimeState, IApplicationBuilder appBuilder, IEndpointRouteBuilder endpointRouteBuilder) { diff --git a/src/Umbraco.Web.Common/AspNetCore/ApplicationUrlRequestBeginNotificationHandler.cs b/src/Umbraco.Web.Common/AspNetCore/ApplicationUrlRequestBeginNotificationHandler.cs index 0472d31592..b6cb000c5f 100644 --- a/src/Umbraco.Web.Common/AspNetCore/ApplicationUrlRequestBeginNotificationHandler.cs +++ b/src/Umbraco.Web.Common/AspNetCore/ApplicationUrlRequestBeginNotificationHandler.cs @@ -8,7 +8,7 @@ namespace Umbraco.Cms.Web.Common.AspNetCore; /// Notification handler which will listen to the , and ensure that /// the applicationUrl is set on the first request. /// -internal class ApplicationUrlRequestBeginNotificationHandler : INotificationHandler +internal sealed class ApplicationUrlRequestBeginNotificationHandler : INotificationHandler { private readonly IRequestAccessor _requestAccessor; diff --git a/src/Umbraco.Web.Common/AspNetCore/AspNetCoreApplicationShutdownRegistry.cs b/src/Umbraco.Web.Common/AspNetCore/AspNetCoreApplicationShutdownRegistry.cs index 65c03ffafc..5e8e8fef75 100644 --- a/src/Umbraco.Web.Common/AspNetCore/AspNetCoreApplicationShutdownRegistry.cs +++ b/src/Umbraco.Web.Common/AspNetCore/AspNetCoreApplicationShutdownRegistry.cs @@ -38,7 +38,7 @@ public class AspNetCoreApplicationShutdownRegistry : IApplicationShutdownRegistr } } - private class RegisteredObjectWrapper + private sealed class RegisteredObjectWrapper { private readonly IRegisteredObject _inner; diff --git a/src/Umbraco.Web.Common/AspNetCore/AspNetCoreSessionManager.cs b/src/Umbraco.Web.Common/AspNetCore/AspNetCoreSessionManager.cs index ad5f480a72..2f0a6b70ca 100644 --- a/src/Umbraco.Web.Common/AspNetCore/AspNetCoreSessionManager.cs +++ b/src/Umbraco.Web.Common/AspNetCore/AspNetCoreSessionManager.cs @@ -5,7 +5,7 @@ using Umbraco.Cms.Core.Web; namespace Umbraco.Cms.Web.Common.AspNetCore; -internal class AspNetCoreSessionManager : ISessionIdResolver, ISessionManager +internal sealed class AspNetCoreSessionManager : ISessionIdResolver, ISessionManager { private readonly IHttpContextAccessor _httpContextAccessor; diff --git a/src/Umbraco.Web.Common/Cache/HttpContextRequestAppCache.cs b/src/Umbraco.Web.Common/Cache/HttpContextRequestAppCache.cs index 53c777c63e..83de3aa4ba 100644 --- a/src/Umbraco.Web.Common/Cache/HttpContextRequestAppCache.cs +++ b/src/Umbraco.Web.Common/Cache/HttpContextRequestAppCache.cs @@ -175,7 +175,7 @@ public class HttpContextRequestAppCache : FastDictionaryAppCacheBase, IRequestCa /// /// Used as Scoped instance to allow locking within a request /// - private class RequestLock + private sealed class RequestLock { public object SyncRoot { get; } = new(); } diff --git a/src/Umbraco.Web.Common/Controllers/PublishedRequestFilterAttribute.cs b/src/Umbraco.Web.Common/Controllers/PublishedRequestFilterAttribute.cs index 9cd0a975a1..b4b0c35505 100644 --- a/src/Umbraco.Web.Common/Controllers/PublishedRequestFilterAttribute.cs +++ b/src/Umbraco.Web.Common/Controllers/PublishedRequestFilterAttribute.cs @@ -9,7 +9,7 @@ namespace Umbraco.Cms.Web.Common.Controllers; /// /// Deals with custom headers for the umbraco request /// -internal class PublishedRequestFilterAttribute : ResultFilterAttribute +internal sealed class PublishedRequestFilterAttribute : ResultFilterAttribute { /// /// Deals with custom headers for the umbraco request @@ -48,7 +48,7 @@ internal class PublishedRequestFilterAttribute : ResultFilterAttribute /// /// Gets the /// - protected UmbracoRouteValues GetUmbracoRouteValues(ResultExecutingContext context) + protected static UmbracoRouteValues GetUmbracoRouteValues(ResultExecutingContext context) { UmbracoRouteValues? routeVals = context.HttpContext.Features.Get(); if (routeVals == null) @@ -60,7 +60,7 @@ internal class PublishedRequestFilterAttribute : ResultFilterAttribute return routeVals; } - private void AddCacheControlHeaders(ResultExecutingContext context, IPublishedRequest pcr) + private static void AddCacheControlHeaders(ResultExecutingContext context, IPublishedRequest pcr) { var cacheControlHeaders = new List(); diff --git a/src/Umbraco.Web.Common/DependencyInjection/ScopedServiceProvider.cs b/src/Umbraco.Web.Common/DependencyInjection/ScopedServiceProvider.cs index 31f5709bd4..7f19ede935 100644 --- a/src/Umbraco.Web.Common/DependencyInjection/ScopedServiceProvider.cs +++ b/src/Umbraco.Web.Common/DependencyInjection/ScopedServiceProvider.cs @@ -4,7 +4,7 @@ using Umbraco.Cms.Core.DependencyInjection; namespace Umbraco.Cms.Web.Common.DependencyInjection; /// -internal class ScopedServiceProvider : IScopedServiceProvider +internal sealed class ScopedServiceProvider : IScopedServiceProvider { private readonly IHttpContextAccessor _accessor; diff --git a/src/Umbraco.Web.Common/Filters/ModelBindingExceptionAttribute.cs b/src/Umbraco.Web.Common/Filters/ModelBindingExceptionAttribute.cs index 0129874deb..4b7f0a17b7 100644 --- a/src/Umbraco.Web.Common/Filters/ModelBindingExceptionAttribute.cs +++ b/src/Umbraco.Web.Common/Filters/ModelBindingExceptionAttribute.cs @@ -30,7 +30,7 @@ public sealed class ModelBindingExceptionAttribute : TypeFilterAttribute { } - private class ModelBindingExceptionFilter : IExceptionFilter + private sealed class ModelBindingExceptionFilter : IExceptionFilter { private static readonly Regex GetPublishedModelsTypesRegex = new("Umbraco.Web.PublishedModels.(\\w+)", RegexOptions.Compiled); diff --git a/src/Umbraco.Web.Common/Filters/UmbracoUserTimeoutFilterAttribute.cs b/src/Umbraco.Web.Common/Filters/UmbracoUserTimeoutFilterAttribute.cs index 13c62365c2..a615b7a277 100644 --- a/src/Umbraco.Web.Common/Filters/UmbracoUserTimeoutFilterAttribute.cs +++ b/src/Umbraco.Web.Common/Filters/UmbracoUserTimeoutFilterAttribute.cs @@ -17,7 +17,7 @@ public class UmbracoUserTimeoutFilterAttribute : TypeFilterAttribute { } - private class UmbracoUserTimeoutFilter : IActionFilter + private sealed class UmbracoUserTimeoutFilter : IActionFilter { public void OnActionExecuted(ActionExecutedContext context) { diff --git a/src/Umbraco.Web.Common/Filters/ValidateUmbracoFormRouteStringAttribute.cs b/src/Umbraco.Web.Common/Filters/ValidateUmbracoFormRouteStringAttribute.cs index cdf3d8c135..03020edccb 100644 --- a/src/Umbraco.Web.Common/Filters/ValidateUmbracoFormRouteStringAttribute.cs +++ b/src/Umbraco.Web.Common/Filters/ValidateUmbracoFormRouteStringAttribute.cs @@ -22,9 +22,9 @@ public class ValidateUmbracoFormRouteStringAttribute : TypeFilterAttribute // TODO: Lets revisit this when we get members done and the front-end working and whether it can moved to an authz policy public ValidateUmbracoFormRouteStringAttribute() : base(typeof(ValidateUmbracoFormRouteStringFilter)) => - Arguments = new object[] { }; + Arguments = []; - internal class ValidateUmbracoFormRouteStringFilter : IAuthorizationFilter + internal sealed class ValidateUmbracoFormRouteStringFilter : IAuthorizationFilter { private readonly IDataProtectionProvider _dataProtectionProvider; diff --git a/src/Umbraco.Web.Common/Hosting/UmbracoHostBuilderDecorator.cs b/src/Umbraco.Web.Common/Hosting/UmbracoHostBuilderDecorator.cs index afe4e78906..e827e5c556 100644 --- a/src/Umbraco.Web.Common/Hosting/UmbracoHostBuilderDecorator.cs +++ b/src/Umbraco.Web.Common/Hosting/UmbracoHostBuilderDecorator.cs @@ -4,7 +4,7 @@ using Microsoft.Extensions.Hosting; namespace Umbraco.Cms.Web.Common.Hosting; -internal class UmbracoHostBuilderDecorator : IHostBuilder +internal sealed class UmbracoHostBuilderDecorator : IHostBuilder { private readonly IHostBuilder _inner; private readonly Action? _onBuild; diff --git a/src/Umbraco.Web.Common/Logging/Enrichers/ApplicationIdEnricher.cs b/src/Umbraco.Web.Common/Logging/Enrichers/ApplicationIdEnricher.cs index 7886e38614..56b043732a 100644 --- a/src/Umbraco.Web.Common/Logging/Enrichers/ApplicationIdEnricher.cs +++ b/src/Umbraco.Web.Common/Logging/Enrichers/ApplicationIdEnricher.cs @@ -5,7 +5,7 @@ using Umbraco.Extensions; namespace Umbraco.Cms.Web.Common.Logging.Enrichers; -internal class ApplicationIdEnricher : ILogEventEnricher +internal sealed class ApplicationIdEnricher : ILogEventEnricher { public const string ApplicationIdProperty = "ApplicationId"; private readonly IApplicationDiscriminator _applicationDiscriminator; diff --git a/src/Umbraco.Web.Common/Logging/Enrichers/NoopEnricher.cs b/src/Umbraco.Web.Common/Logging/Enrichers/NoopEnricher.cs index d0ec659526..2318a5eefb 100644 --- a/src/Umbraco.Web.Common/Logging/Enrichers/NoopEnricher.cs +++ b/src/Umbraco.Web.Common/Logging/Enrichers/NoopEnricher.cs @@ -6,7 +6,7 @@ namespace Umbraco.Cms.Web.Common.Logging.Enrichers; /// /// NoOp but useful for tricks to avoid disposal of the global logger. /// -internal class NoopEnricher : ILogEventEnricher +internal sealed class NoopEnricher : ILogEventEnricher { public void Enrich(LogEvent logEvent, ILogEventPropertyFactory propertyFactory) { diff --git a/src/Umbraco.Web.Common/Logging/RegisteredReloadableLogger.cs b/src/Umbraco.Web.Common/Logging/RegisteredReloadableLogger.cs index 499d7aceaf..dfc4be2e09 100644 --- a/src/Umbraco.Web.Common/Logging/RegisteredReloadableLogger.cs +++ b/src/Umbraco.Web.Common/Logging/RegisteredReloadableLogger.cs @@ -9,7 +9,7 @@ namespace Umbraco.Cms.Web.Common.Logging; /// Ensures freeze is only called a single time even when resolving a logger from the snapshot container /// built for . /// -internal class RegisteredReloadableLogger +internal sealed class RegisteredReloadableLogger { private static readonly Lock _frozenLock = new(); private static bool _frozen; diff --git a/src/Umbraco.Web.Common/Media/MediaPrependBasePathFileProvider.cs b/src/Umbraco.Web.Common/Media/MediaPrependBasePathFileProvider.cs index 45d522d0de..0b78c9dcca 100644 --- a/src/Umbraco.Web.Common/Media/MediaPrependBasePathFileProvider.cs +++ b/src/Umbraco.Web.Common/Media/MediaPrependBasePathFileProvider.cs @@ -15,7 +15,7 @@ namespace Umbraco.Cms.Web.Common.Media; /// A PR has been submitted to the Dazinator project: https://github.com/dazinator/Dazinator.Extensions.FileProviders/pull/53 /// If that PR is accepted, the Dazinator dependency should be updated and this class should be removed. /// -internal class MediaPrependBasePathFileProvider : IFileProvider +internal sealed class MediaPrependBasePathFileProvider : IFileProvider { private readonly PathString _basePath; private readonly IFileProvider _underlyingFileProvider; @@ -29,7 +29,7 @@ internal class MediaPrependBasePathFileProvider : IFileProvider _underlyingFileProvider = underlyingFileProvider; } - protected virtual bool TryMapSubPath(string originalSubPath, out PathString newSubPath) + private bool TryMapSubPath(string originalSubPath, out PathString newSubPath) { if (!string.IsNullOrEmpty(originalSubPath)) { diff --git a/src/Umbraco.Web.Common/Middleware/UmbracoRequestMiddleware.cs b/src/Umbraco.Web.Common/Middleware/UmbracoRequestMiddleware.cs index 38d6fae93a..de6218d9af 100644 --- a/src/Umbraco.Web.Common/Middleware/UmbracoRequestMiddleware.cs +++ b/src/Umbraco.Web.Common/Middleware/UmbracoRequestMiddleware.cs @@ -31,7 +31,7 @@ namespace Umbraco.Cms.Web.Common.Middleware; /// This is responsible for creating and assigning an /// /// -internal class UmbracoRequestMiddleware : IMiddleware +internal sealed class UmbracoRequestMiddleware : IMiddleware { private readonly IDefaultCultureAccessor _defaultCultureAccessor; private readonly IEventAggregator _eventAggregator; @@ -158,7 +158,7 @@ internal class UmbracoRequestMiddleware : IMiddleware _profiler?.UmbracoApplicationEndRequest(context, _runtimeState.Level); } - private Uri? GetApplicationUrlFromCurrentRequest(HttpRequest request) + private static Uri? GetApplicationUrlFromCurrentRequest(HttpRequest request) { // We only consider GET and POST. // Especially the DEBUG sent when debugging the application is annoying because it uses http, even when the https is available. @@ -173,7 +173,7 @@ internal class UmbracoRequestMiddleware : IMiddleware /// /// Dispose some request scoped objects that we are maintaining the lifecycle for. /// - private void DisposeHttpContextItems(HttpRequest request) + private static void DisposeHttpContextItems(HttpRequest request) { // do not process if client-side request if (request.IsClientSideRequest()) diff --git a/src/Umbraco.Web.Common/ModelsBuilder/InMemoryAuto/CollectibleRuntimeViewCompiler.cs b/src/Umbraco.Web.Common/ModelsBuilder/InMemoryAuto/CollectibleRuntimeViewCompiler.cs index a00193850c..46670862ed 100644 --- a/src/Umbraco.Web.Common/ModelsBuilder/InMemoryAuto/CollectibleRuntimeViewCompiler.cs +++ b/src/Umbraco.Web.Common/ModelsBuilder/InMemoryAuto/CollectibleRuntimeViewCompiler.cs @@ -18,7 +18,7 @@ using Umbraco.Extensions; namespace Umbraco.Cms.Web.Common.ModelsBuilder.InMemoryAuto; -internal class CollectibleRuntimeViewCompiler : IViewCompiler +internal sealed class CollectibleRuntimeViewCompiler : IViewCompiler { private readonly Lock _cacheLock = new(); private readonly Dictionary _precompiledViews; @@ -319,7 +319,7 @@ internal class CollectibleRuntimeViewCompiler : IViewCompiler } } - protected virtual CompiledViewDescriptor CompileAndEmit(string relativePath) + private CompiledViewDescriptor CompileAndEmit(string relativePath) { RazorProjectItem projectItem = _projectEngine.FileSystem.GetItem(relativePath, fileKind: null); RazorCodeDocument codeDocument = _projectEngine.Process(projectItem); @@ -444,7 +444,7 @@ internal class CollectibleRuntimeViewCompiler : IViewCompiler // Taken from: https://github.com/dotnet/aspnetcore/blob/a450cb69b5e4549f5515cdb057a68771f56cefd7/src/Mvc/Mvc.Razor/src/ViewPath.cs // This normalizes the relative path to the view, ensuring that it matches with what we have as keys in _precompiledViews - private string NormalizePath(string path) + private static string NormalizePath(string path) { var addLeadingSlash = path[0] != '\\' && path[0] != '/'; var transformSlashes = path.IndexOf('\\') != -1; diff --git a/src/Umbraco.Web.Common/ModelsBuilder/InMemoryAuto/InMemoryAssemblyLoadContextManager.cs b/src/Umbraco.Web.Common/ModelsBuilder/InMemoryAuto/InMemoryAssemblyLoadContextManager.cs index 15a280574d..d999333f77 100644 --- a/src/Umbraco.Web.Common/ModelsBuilder/InMemoryAuto/InMemoryAssemblyLoadContextManager.cs +++ b/src/Umbraco.Web.Common/ModelsBuilder/InMemoryAuto/InMemoryAssemblyLoadContextManager.cs @@ -4,7 +4,7 @@ using Umbraco.Cms.Infrastructure.ModelsBuilder; namespace Umbraco.Cms.Web.Common.ModelsBuilder.InMemoryAuto; -internal class InMemoryAssemblyLoadContextManager +internal sealed class InMemoryAssemblyLoadContextManager { private UmbracoAssemblyLoadContext? _currentAssemblyLoadContext; diff --git a/src/Umbraco.Web.Common/ModelsBuilder/InMemoryAuto/InMemoryModelFactory.cs b/src/Umbraco.Web.Common/ModelsBuilder/InMemoryAuto/InMemoryModelFactory.cs index b44b6345e1..cee000e7f9 100644 --- a/src/Umbraco.Web.Common/ModelsBuilder/InMemoryAuto/InMemoryModelFactory.cs +++ b/src/Umbraco.Web.Common/ModelsBuilder/InMemoryAuto/InMemoryModelFactory.cs @@ -21,7 +21,7 @@ using IHostingEnvironment = Umbraco.Cms.Core.Hosting.IHostingEnvironment; namespace Umbraco.Cms.Web.Common.ModelsBuilder.InMemoryAuto { - internal class InMemoryModelFactory : IAutoPublishedModelFactory, IRegisteredObject, IDisposable + internal sealed class InMemoryModelFactory : IAutoPublishedModelFactory, IRegisteredObject, IDisposable { private static readonly Regex s_usingRegex = new Regex("^using(.*);", RegexOptions.Compiled | RegexOptions.Multiline); private static readonly Regex s_aattrRegex = new Regex("^\\[assembly:(.*)\\]", RegexOptions.Compiled | RegexOptions.Multiline); @@ -572,7 +572,7 @@ namespace Umbraco.Cms.Web.Common.ModelsBuilder.InMemoryAuto return assembly; } - private void TryDeleteUnusedAssemblies(string dllPathFile) + private static void TryDeleteUnusedAssemblies(string dllPathFile) { if (File.Exists(dllPathFile)) { @@ -818,7 +818,7 @@ namespace Umbraco.Cms.Web.Common.ModelsBuilder.InMemoryAuto _hostingLifetime.UnregisterObject(this); } - protected virtual void Dispose(bool disposing) + private void Dispose(bool disposing) { if (!_disposedValue) { @@ -843,14 +843,14 @@ namespace Umbraco.Cms.Web.Common.ModelsBuilder.InMemoryAuto Dispose(disposing: true); } - internal class Infos + internal sealed class Infos { public Dictionary? ModelTypeMap { get; set; } public Dictionary? ModelInfos { get; set; } } - internal class ModelInfo + internal sealed class ModelInfo { public Type? ParameterType { get; set; } diff --git a/src/Umbraco.Web.Common/ModelsBuilder/InMemoryAuto/RuntimeCompilationCacheBuster.cs b/src/Umbraco.Web.Common/ModelsBuilder/InMemoryAuto/RuntimeCompilationCacheBuster.cs index 51774b92f2..f13b815f9a 100644 --- a/src/Umbraco.Web.Common/ModelsBuilder/InMemoryAuto/RuntimeCompilationCacheBuster.cs +++ b/src/Umbraco.Web.Common/ModelsBuilder/InMemoryAuto/RuntimeCompilationCacheBuster.cs @@ -4,7 +4,7 @@ using Umbraco.Cms.Core; namespace Umbraco.Cms.Web.Common.ModelsBuilder.InMemoryAuto; -internal class RuntimeCompilationCacheBuster +internal sealed class RuntimeCompilationCacheBuster { private readonly IViewCompilerProvider _viewCompilerProvider; private readonly IRazorViewEngine _razorViewEngine; diff --git a/src/Umbraco.Web.Common/ModelsBuilder/InMemoryAuto/UmbracoAssemblyLoadContext.cs b/src/Umbraco.Web.Common/ModelsBuilder/InMemoryAuto/UmbracoAssemblyLoadContext.cs index 5ca90c2df9..b21a55cb6c 100644 --- a/src/Umbraco.Web.Common/ModelsBuilder/InMemoryAuto/UmbracoAssemblyLoadContext.cs +++ b/src/Umbraco.Web.Common/ModelsBuilder/InMemoryAuto/UmbracoAssemblyLoadContext.cs @@ -3,7 +3,7 @@ using System.Runtime.Loader; namespace Umbraco.Cms.Web.Common.ModelsBuilder.InMemoryAuto; -internal class UmbracoAssemblyLoadContext : AssemblyLoadContext +internal sealed class UmbracoAssemblyLoadContext : AssemblyLoadContext { /// /// Initializes a new instance of the class. diff --git a/src/Umbraco.Web.Common/ModelsBuilder/InMemoryAuto/UmbracoCompilationException.cs b/src/Umbraco.Web.Common/ModelsBuilder/InMemoryAuto/UmbracoCompilationException.cs index cb180a6264..fb39c8fb04 100644 --- a/src/Umbraco.Web.Common/ModelsBuilder/InMemoryAuto/UmbracoCompilationException.cs +++ b/src/Umbraco.Web.Common/ModelsBuilder/InMemoryAuto/UmbracoCompilationException.cs @@ -2,7 +2,7 @@ namespace Umbraco.Cms.Web.Common.ModelsBuilder.InMemoryAuto; -internal class UmbracoCompilationException : Exception, ICompilationException +internal sealed class UmbracoCompilationException : Exception, ICompilationException { public IEnumerable? CompilationFailures { get; init; } } diff --git a/src/Umbraco.Web.Common/ModelsBuilder/InMemoryAuto/UmbracoRazorReferenceManager.cs b/src/Umbraco.Web.Common/ModelsBuilder/InMemoryAuto/UmbracoRazorReferenceManager.cs index 3a90e43be5..92891d5ed4 100644 --- a/src/Umbraco.Web.Common/ModelsBuilder/InMemoryAuto/UmbracoRazorReferenceManager.cs +++ b/src/Umbraco.Web.Common/ModelsBuilder/InMemoryAuto/UmbracoRazorReferenceManager.cs @@ -17,7 +17,7 @@ namespace Umbraco.Cms.Web.Common.ModelsBuilder.InMemoryAuto; * * This class is used by the the ViewCompiler (CollectibleRuntimeViewCompiler) to find the required references when compiling views. */ -internal class UmbracoRazorReferenceManager +internal sealed class UmbracoRazorReferenceManager { private readonly ApplicationPartManager _partManager; private readonly MvcRazorRuntimeCompilationOptions _options; @@ -33,7 +33,7 @@ internal class UmbracoRazorReferenceManager _options = options.Value; } - public virtual IReadOnlyList CompilationReferences + public IReadOnlyList CompilationReferences { get { diff --git a/src/Umbraco.Web.Common/ModelsBuilder/InMemoryAuto/UmbracoViewCompilerProvider.cs b/src/Umbraco.Web.Common/ModelsBuilder/InMemoryAuto/UmbracoViewCompilerProvider.cs index 2c4bfe0a33..600ca67a54 100644 --- a/src/Umbraco.Web.Common/ModelsBuilder/InMemoryAuto/UmbracoViewCompilerProvider.cs +++ b/src/Umbraco.Web.Common/ModelsBuilder/InMemoryAuto/UmbracoViewCompilerProvider.cs @@ -9,7 +9,7 @@ using Umbraco.Cms.Core.Exceptions; namespace Umbraco.Cms.Web.Common.ModelsBuilder.InMemoryAuto; -internal class UmbracoViewCompilerProvider : IViewCompilerProvider +internal sealed class UmbracoViewCompilerProvider : IViewCompilerProvider { private readonly RazorProjectEngine _razorProjectEngine; private readonly UmbracoRazorReferenceManager _umbracoRazorReferenceManager; diff --git a/src/Umbraco.Web.Common/ModelsBuilder/ModelsBuilderNotificationHandler.cs b/src/Umbraco.Web.Common/ModelsBuilder/ModelsBuilderNotificationHandler.cs index c25a485b55..98936a828a 100644 --- a/src/Umbraco.Web.Common/ModelsBuilder/ModelsBuilderNotificationHandler.cs +++ b/src/Umbraco.Web.Common/ModelsBuilder/ModelsBuilderNotificationHandler.cs @@ -15,7 +15,7 @@ namespace Umbraco.Cms.Web.Common.ModelsBuilder; /// Handles and /// notifications to initialize MB /// -internal class ModelsBuilderNotificationHandler : +internal sealed class ModelsBuilderNotificationHandler : INotificationHandler, INotificationHandler, INotificationHandler diff --git a/src/Umbraco.Web.Common/Repositories/WebProfilerRepository.cs b/src/Umbraco.Web.Common/Repositories/WebProfilerRepository.cs index 44dc862e96..668f1f46de 100644 --- a/src/Umbraco.Web.Common/Repositories/WebProfilerRepository.cs +++ b/src/Umbraco.Web.Common/Repositories/WebProfilerRepository.cs @@ -4,7 +4,7 @@ using Umbraco.Extensions; namespace Umbraco.Cms.Web.Common.Repositories; -internal class WebProfilerRepository : IWebProfilerRepository +internal sealed class WebProfilerRepository : IWebProfilerRepository { private const string CookieName = "UMB-DEBUG"; private const string HeaderName = "X-UMB-DEBUG"; diff --git a/src/Umbraco.Web.Common/Routing/CustomRouteContentFinderDelegate.cs b/src/Umbraco.Web.Common/Routing/CustomRouteContentFinderDelegate.cs index e42e1e63a7..16960099d2 100644 --- a/src/Umbraco.Web.Common/Routing/CustomRouteContentFinderDelegate.cs +++ b/src/Umbraco.Web.Common/Routing/CustomRouteContentFinderDelegate.cs @@ -3,7 +3,7 @@ using Umbraco.Cms.Core.Models.PublishedContent; namespace Umbraco.Cms.Web.Common.Routing; -internal class CustomRouteContentFinderDelegate +internal sealed class CustomRouteContentFinderDelegate { private readonly Func _findContent; diff --git a/src/Umbraco.Web.Common/Security/UmbracoSignInManager.cs b/src/Umbraco.Web.Common/Security/UmbracoSignInManager.cs index d49c2ae238..1d6d865f9e 100644 --- a/src/Umbraco.Web.Common/Security/UmbracoSignInManager.cs +++ b/src/Umbraco.Web.Common/Security/UmbracoSignInManager.cs @@ -517,7 +517,7 @@ public abstract class UmbracoSignInManager : SignInManager } // borrowed from https://github.com/dotnet/aspnetcore/blob/master/src/Identity/Core/src/SignInManager.cs#L891 - private class TwoFactorAuthenticationInfo + private sealed class TwoFactorAuthenticationInfo { public string? UserId { get; set; } diff --git a/src/Umbraco.Web.Common/Templates/TemplateRenderer.cs b/src/Umbraco.Web.Common/Templates/TemplateRenderer.cs index adfe936988..f60833a4b7 100644 --- a/src/Umbraco.Web.Common/Templates/TemplateRenderer.cs +++ b/src/Umbraco.Web.Common/Templates/TemplateRenderer.cs @@ -26,7 +26,7 @@ namespace Umbraco.Cms.Web.Common.Templates; /// This allows you to render an MVC template based purely off of a node id and an optional alttemplate id as string /// output. /// -internal class TemplateRenderer : ITemplateRenderer +internal sealed class TemplateRenderer : ITemplateRenderer { private readonly IFileService _fileService; private readonly IHttpContextAccessor _httpContextAccessor; diff --git a/src/Umbraco.Web.Common/Validators/BypassRenderingModelValidationMetadataProvider.cs b/src/Umbraco.Web.Common/Validators/BypassRenderingModelValidationMetadataProvider.cs index 94f0dea502..dd7117e273 100644 --- a/src/Umbraco.Web.Common/Validators/BypassRenderingModelValidationMetadataProvider.cs +++ b/src/Umbraco.Web.Common/Validators/BypassRenderingModelValidationMetadataProvider.cs @@ -6,7 +6,7 @@ namespace Umbraco.Cms.Web.Common.Validators; /// /// Ensures we bypass object graph validation for rendering models. /// -internal class BypassRenderingModelValidationMetadataProvider : IValidationMetadataProvider +internal sealed class BypassRenderingModelValidationMetadataProvider : IValidationMetadataProvider { public void CreateValidationMetadata(ValidationMetadataProviderContext context) { diff --git a/src/Umbraco.Web.Common/Validators/BypassRenderingModelValidatorProvider.cs b/src/Umbraco.Web.Common/Validators/BypassRenderingModelValidatorProvider.cs index ab52483180..a86b66974e 100644 --- a/src/Umbraco.Web.Common/Validators/BypassRenderingModelValidatorProvider.cs +++ b/src/Umbraco.Web.Common/Validators/BypassRenderingModelValidatorProvider.cs @@ -6,7 +6,7 @@ namespace Umbraco.Cms.Web.Common.Validators; /// /// Ensures we bypass property validation for rendering models. /// -internal class BypassRenderingModelValidatorProvider : IModelValidatorProvider +internal sealed class BypassRenderingModelValidatorProvider : IModelValidatorProvider { public void CreateValidators(ModelValidatorProviderContext context) { diff --git a/src/Umbraco.Web.Website/Extensions/HtmlHelperRenderExtensions.cs b/src/Umbraco.Web.Website/Extensions/HtmlHelperRenderExtensions.cs index efb48d59da..1df5c8ef1e 100644 --- a/src/Umbraco.Web.Website/Extensions/HtmlHelperRenderExtensions.cs +++ b/src/Umbraco.Web.Website/Extensions/HtmlHelperRenderExtensions.cs @@ -872,7 +872,7 @@ public static class HtmlHelperRenderExtensions /// /// Used for rendering out the Form for BeginUmbracoForm /// - internal class UmbracoForm : MvcForm + internal sealed class UmbracoForm : MvcForm { private readonly string _surfaceControllerInput; private readonly ViewContext _viewContext; diff --git a/src/Umbraco.Web.Website/Routing/EagerMatcherPolicy.cs b/src/Umbraco.Web.Website/Routing/EagerMatcherPolicy.cs index 1752fa0a72..37035ef8ab 100644 --- a/src/Umbraco.Web.Website/Routing/EagerMatcherPolicy.cs +++ b/src/Umbraco.Web.Website/Routing/EagerMatcherPolicy.cs @@ -34,7 +34,7 @@ namespace Umbraco.Cms.Web.Website.Routing; * This also handles rerouting under install/upgrade states. */ -internal class EagerMatcherPolicy : MatcherPolicy, IEndpointSelectorPolicy +internal sealed class EagerMatcherPolicy : MatcherPolicy, IEndpointSelectorPolicy { private readonly IRuntimeState _runtimeState; private readonly EndpointDataSource _endpointDataSource; diff --git a/src/Umbraco.Web.Website/Routing/NotFoundSelectorPolicy.cs b/src/Umbraco.Web.Website/Routing/NotFoundSelectorPolicy.cs index b99b432942..44b9627f31 100644 --- a/src/Umbraco.Web.Website/Routing/NotFoundSelectorPolicy.cs +++ b/src/Umbraco.Web.Website/Routing/NotFoundSelectorPolicy.cs @@ -13,7 +13,7 @@ namespace Umbraco.Cms.Web.Website.Routing; /// /// Used to handle 404 routes that haven't been handled by the end user /// -internal class NotFoundSelectorPolicy : MatcherPolicy, IEndpointSelectorPolicy +internal sealed class NotFoundSelectorPolicy : MatcherPolicy, IEndpointSelectorPolicy { private readonly EndpointDataSource _endpointDataSource; private readonly Lazy _notFound; diff --git a/src/Umbraco.Web.Website/Routing/SurfaceControllerMatcherPolicy.cs b/src/Umbraco.Web.Website/Routing/SurfaceControllerMatcherPolicy.cs index e2b0082cc2..ae8099aa3d 100644 --- a/src/Umbraco.Web.Website/Routing/SurfaceControllerMatcherPolicy.cs +++ b/src/Umbraco.Web.Website/Routing/SurfaceControllerMatcherPolicy.cs @@ -11,7 +11,7 @@ namespace Umbraco.Cms.Web.Website.Routing; /// Ensures the surface controller requests takes priority over other things like virtual routes. /// Also ensures that requests to a surface controller on a virtual route will return 405, like HttpMethodMatcherPolicy ensures for non-virtual route requests. /// -internal class SurfaceControllerMatcherPolicy : MatcherPolicy, IEndpointSelectorPolicy +internal sealed class SurfaceControllerMatcherPolicy : MatcherPolicy, IEndpointSelectorPolicy { private const string Http405EndpointDisplayName = "405 HTTP Method Not Supported"; diff --git a/src/Umbraco.Web.Website/Routing/UmbracoRouteValueTransformer.cs b/src/Umbraco.Web.Website/Routing/UmbracoRouteValueTransformer.cs index 0816e655e0..a990d981db 100644 --- a/src/Umbraco.Web.Website/Routing/UmbracoRouteValueTransformer.cs +++ b/src/Umbraco.Web.Website/Routing/UmbracoRouteValueTransformer.cs @@ -272,7 +272,7 @@ public class UmbracoRouteValueTransformer : DynamicRouteValueTransformer return values; } - private class PostedDataProxyInfo + private sealed class PostedDataProxyInfo { public string? ControllerName { get; set; } diff --git a/src/Umbraco.Web.Website/Security/MemberAuthenticationBuilder.cs b/src/Umbraco.Web.Website/Security/MemberAuthenticationBuilder.cs index 50e6f80b78..36274f4705 100644 --- a/src/Umbraco.Web.Website/Security/MemberAuthenticationBuilder.cs +++ b/src/Umbraco.Web.Website/Security/MemberAuthenticationBuilder.cs @@ -59,7 +59,7 @@ public class MemberAuthenticationBuilder : AuthenticationBuilder } // Ensures that the sign in scheme is always the Umbraco member external type - private class EnsureMemberScheme : IPostConfigureOptions + private sealed class EnsureMemberScheme : IPostConfigureOptions where TOptions : RemoteAuthenticationOptions { public void PostConfigure(string? name, TOptions options) diff --git a/src/Umbraco.Web.Website/ViewEngines/PluginRazorViewEngineOptionsSetup.cs b/src/Umbraco.Web.Website/ViewEngines/PluginRazorViewEngineOptionsSetup.cs index ca7696c1e9..a12f7e6524 100644 --- a/src/Umbraco.Web.Website/ViewEngines/PluginRazorViewEngineOptionsSetup.cs +++ b/src/Umbraco.Web.Website/ViewEngines/PluginRazorViewEngineOptionsSetup.cs @@ -23,7 +23,7 @@ public class PluginRazorViewEngineOptionsSetup : IConfigureOptions /// Expands the default view locations /// - private class ViewLocationExpander : IViewLocationExpander + private sealed class ViewLocationExpander : IViewLocationExpander { public IEnumerable ExpandViewLocations( ViewLocationExpanderContext context, IEnumerable viewLocations) diff --git a/src/Umbraco.Web.Website/ViewEngines/RenderRazorViewEngineOptionsSetup.cs b/src/Umbraco.Web.Website/ViewEngines/RenderRazorViewEngineOptionsSetup.cs index 25022feafc..a1148bc071 100644 --- a/src/Umbraco.Web.Website/ViewEngines/RenderRazorViewEngineOptionsSetup.cs +++ b/src/Umbraco.Web.Website/ViewEngines/RenderRazorViewEngineOptionsSetup.cs @@ -22,7 +22,7 @@ public class RenderRazorViewEngineOptionsSetup : IConfigureOptions /// Expands the default view locations /// - private class ViewLocationExpander : IViewLocationExpander + private sealed class ViewLocationExpander : IViewLocationExpander { public IEnumerable ExpandViewLocations( ViewLocationExpanderContext context, IEnumerable viewLocations) diff --git a/tests/Umbraco.Tests.Common/Builders/ContentDataBuilder.cs b/tests/Umbraco.Tests.Common/Builders/ContentDataBuilder.cs index cd0c6f031f..e89d68951f 100644 --- a/tests/Umbraco.Tests.Common/Builders/ContentDataBuilder.cs +++ b/tests/Umbraco.Tests.Common/Builders/ContentDataBuilder.cs @@ -7,7 +7,7 @@ using Umbraco.Extensions; namespace Umbraco.Cms.Tests.Common.Builders; -internal class ContentDataBuilder : BuilderBase, IWithNameBuilder +internal sealed class ContentDataBuilder : BuilderBase, IWithNameBuilder { private Dictionary _cultureInfos; private string _name; diff --git a/tests/Umbraco.Tests.Integration/DependencyInjection/UmbracoBuilderExtensions.cs b/tests/Umbraco.Tests.Integration/DependencyInjection/UmbracoBuilderExtensions.cs index f2fdfe2128..021eaaa2ba 100644 --- a/tests/Umbraco.Tests.Integration/DependencyInjection/UmbracoBuilderExtensions.cs +++ b/tests/Umbraco.Tests.Integration/DependencyInjection/UmbracoBuilderExtensions.cs @@ -150,7 +150,7 @@ public static class UmbracoBuilderExtensions } // replace the default so there is no background index rebuilder - private class TestBackgroundIndexRebuilder : ExamineIndexRebuilder + private sealed class TestBackgroundIndexRebuilder : ExamineIndexRebuilder { public TestBackgroundIndexRebuilder( IMainDom mainDom, diff --git a/tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Persistence/Repositories/ContentTypeRepositoryTest.cs b/tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Persistence/Repositories/ContentTypeRepositoryTest.cs index 17cbab42ed..bba1bd864b 100644 --- a/tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Persistence/Repositories/ContentTypeRepositoryTest.cs +++ b/tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Persistence/Repositories/ContentTypeRepositoryTest.cs @@ -87,7 +87,6 @@ internal sealed class ContentTypeRepositoryTest : UmbracoIntegrationTest AppCaches.Disabled, LoggerFactory.CreateLogger(), FileSystems, - IOHelper, ShortStringHelper, Mock.Of(), runtimeSettingsMock.Object); diff --git a/tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Persistence/Repositories/DocumentRepositoryTest.cs b/tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Persistence/Repositories/DocumentRepositoryTest.cs index 22cc35b424..b794eccd86 100644 --- a/tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Persistence/Repositories/DocumentRepositoryTest.cs +++ b/tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Persistence/Repositories/DocumentRepositoryTest.cs @@ -117,7 +117,7 @@ internal sealed class DocumentRepositoryTest : UmbracoIntegrationTest var runtimeSettingsMock = new Mock>(); runtimeSettingsMock.Setup(x => x.CurrentValue).Returns(new RuntimeSettings()); - templateRepository = new TemplateRepository(scopeAccessor, appCaches, LoggerFactory.CreateLogger(), FileSystems, IOHelper, ShortStringHelper, Mock.Of(), runtimeSettingsMock.Object); + templateRepository = new TemplateRepository(scopeAccessor, appCaches, LoggerFactory.CreateLogger(), FileSystems, ShortStringHelper, Mock.Of(), runtimeSettingsMock.Object); var tagRepository = new TagRepository(scopeAccessor, appCaches, LoggerFactory.CreateLogger()); var commonRepository = new ContentTypeCommonRepository(scopeAccessor, templateRepository, appCaches, ShortStringHelper); diff --git a/tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Persistence/Repositories/TemplateRepositoryTest.cs b/tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Persistence/Repositories/TemplateRepositoryTest.cs index 2350b1d1f5..bcef116a97 100644 --- a/tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Persistence/Repositories/TemplateRepositoryTest.cs +++ b/tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Persistence/Repositories/TemplateRepositoryTest.cs @@ -63,7 +63,7 @@ internal sealed class TemplateRepositoryTest : UmbracoIntegrationTest private IOptionsMonitor RuntimeSettings => GetRequiredService>(); private ITemplateRepository CreateRepository(IScopeProvider provider) => - new TemplateRepository((IScopeAccessor)provider, AppCaches.Disabled, LoggerFactory.CreateLogger(), FileSystems, IOHelper, ShortStringHelper, ViewHelper, RuntimeSettings); + new TemplateRepository((IScopeAccessor)provider, AppCaches.Disabled, LoggerFactory.CreateLogger(), FileSystems, ShortStringHelper, ViewHelper, RuntimeSettings); [Test] public void Can_Instantiate_Repository() diff --git a/tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Persistence/Repositories/UserRepositoryTest.cs b/tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Persistence/Repositories/UserRepositoryTest.cs index 96575a67e7..b7c8f1ce3c 100644 --- a/tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Persistence/Repositories/UserRepositoryTest.cs +++ b/tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Persistence/Repositories/UserRepositoryTest.cs @@ -57,8 +57,7 @@ internal sealed class UserRepositoryTest : UmbracoIntegrationTest Options.Create(new UserPasswordConfigurationSettings()), new SystemTextJsonSerializer(), mockRuntimeState.Object, - PermissionMappers, - AppPolicyCache); + PermissionMappers); return repository; } @@ -165,8 +164,7 @@ internal sealed class UserRepositoryTest : UmbracoIntegrationTest Options.Create(new UserPasswordConfigurationSettings()), new SystemTextJsonSerializer(), mockRuntimeState.Object, - PermissionMappers, - AppPolicyCache); + PermissionMappers); repository2.Delete(user); diff --git a/tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Services/Importing/ImportResources.Designer.cs b/tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Services/Importing/ImportResources.Designer.cs index 45fd3a2057..3e5bc253a7 100644 --- a/tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Services/Importing/ImportResources.Designer.cs +++ b/tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Services/Importing/ImportResources.Designer.cs @@ -18,7 +18,7 @@ namespace Umbraco.Cms.Tests.Integration.Umbraco.Infrastructure.Services.Importin [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class ImportResources { + internal sealed class ImportResources { private static global::System.Resources.ResourceManager resourceMan; diff --git a/tests/Umbraco.Tests.Integration/Umbraco.Persistence.EFCore/DbContext/UmbracoLock.cs b/tests/Umbraco.Tests.Integration/Umbraco.Persistence.EFCore/DbContext/UmbracoLock.cs index 02a3c648cb..1dcd65a966 100644 --- a/tests/Umbraco.Tests.Integration/Umbraco.Persistence.EFCore/DbContext/UmbracoLock.cs +++ b/tests/Umbraco.Tests.Integration/Umbraco.Persistence.EFCore/DbContext/UmbracoLock.cs @@ -1,6 +1,6 @@ namespace Umbraco.Cms.Tests.Integration.Umbraco.Persistence.EFCore.DbContext; -internal class UmbracoLock +internal sealed class UmbracoLock { public int Id { get; set; } diff --git a/tests/Umbraco.Tests.UnitTests/AutoFixture/Customizations/OmitRecursionCustomization.cs b/tests/Umbraco.Tests.UnitTests/AutoFixture/Customizations/OmitRecursionCustomization.cs index 1ae0af54ef..b7615d7c75 100644 --- a/tests/Umbraco.Tests.UnitTests/AutoFixture/Customizations/OmitRecursionCustomization.cs +++ b/tests/Umbraco.Tests.UnitTests/AutoFixture/Customizations/OmitRecursionCustomization.cs @@ -2,7 +2,7 @@ using AutoFixture; namespace Umbraco.Cms.Tests.UnitTests.AutoFixture.Customizations; -internal class OmitRecursionCustomization : ICustomization +internal sealed class OmitRecursionCustomization : ICustomization { public void Customize(IFixture fixture) => fixture.Behaviors.Add(new OmitOnRecursionBehavior()); diff --git a/tests/Umbraco.Tests.UnitTests/AutoFixture/Customizations/UmbracoCustomizations.cs b/tests/Umbraco.Tests.UnitTests/AutoFixture/Customizations/UmbracoCustomizations.cs index 1d1c25f8df..2593f08295 100644 --- a/tests/Umbraco.Tests.UnitTests/AutoFixture/Customizations/UmbracoCustomizations.cs +++ b/tests/Umbraco.Tests.UnitTests/AutoFixture/Customizations/UmbracoCustomizations.cs @@ -1,16 +1,13 @@ -using System.Linq; using AutoFixture; using AutoFixture.Kernel; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Identity; -using Microsoft.Extensions.Options; using Moq; using Umbraco.Cms.Api.Management.Controllers.Security; using Umbraco.Cms.Api.Management.Routing; using Umbraco.Cms.Core; using Umbraco.Cms.Core.Configuration; using Umbraco.Cms.Core.Configuration.Models; -using Umbraco.Cms.Core.Hosting; using Umbraco.Cms.Core.Routing; using Umbraco.Cms.Core.Security; using Umbraco.Cms.Core.Services; @@ -20,7 +17,7 @@ using Umbraco.Cms.Web.Common.Security; namespace Umbraco.Cms.Tests.UnitTests.AutoFixture.Customizations; -internal class UmbracoCustomizations : ICustomization +internal sealed class UmbracoCustomizations : ICustomization { public void Customize(IFixture fixture) { diff --git a/tools/Umbraco.JsonSchema/Options.cs b/tools/Umbraco.JsonSchema/Options.cs index cba5d1f16b..b1ea7ac608 100644 --- a/tools/Umbraco.JsonSchema/Options.cs +++ b/tools/Umbraco.JsonSchema/Options.cs @@ -1,6 +1,6 @@ using CommandLine; -internal class Options +internal sealed class Options { [Option("outputFile", Default = "appsettings-schema.Umbraco.Cms.json", HelpText = "Output file to save the generated JSON schema for Umbraco CMS.")] public required string OutputFile { get; set; } diff --git a/tools/Umbraco.JsonSchema/UmbracoCmsSchema.cs b/tools/Umbraco.JsonSchema/UmbracoCmsSchema.cs index 63ae6b1efa..1a874e40dc 100644 --- a/tools/Umbraco.JsonSchema/UmbracoCmsSchema.cs +++ b/tools/Umbraco.JsonSchema/UmbracoCmsSchema.cs @@ -1,8 +1,7 @@ -using Umbraco.Cms.Core.Configuration; using Umbraco.Cms.Core.Configuration.Models; using Umbraco.Cms.Core.Models; -internal class UmbracoCmsSchema +internal sealed class UmbracoCmsSchema { public required UmbracoDefinition Umbraco { get; set; } diff --git a/tools/Umbraco.JsonSchema/UmbracoJsonSchemaGenerator.cs b/tools/Umbraco.JsonSchema/UmbracoJsonSchemaGenerator.cs index 099ad498c3..fee902ffac 100644 --- a/tools/Umbraco.JsonSchema/UmbracoJsonSchemaGenerator.cs +++ b/tools/Umbraco.JsonSchema/UmbracoJsonSchemaGenerator.cs @@ -5,7 +5,7 @@ using NJsonSchema; using NJsonSchema.Generation; /// -internal class UmbracoJsonSchemaGenerator : JsonSchemaGenerator +internal sealed class UmbracoJsonSchemaGenerator : JsonSchemaGenerator { /// /// Initializes a new instance of the class. @@ -26,7 +26,7 @@ internal class UmbracoJsonSchemaGenerator : JsonSchemaGenerator { } /// - private class UmbracoSystemTextJsonReflectionService : SystemTextJsonReflectionService + private sealed class UmbracoSystemTextJsonReflectionService : SystemTextJsonReflectionService { /// public override void GenerateProperties(JsonSchema schema, ContextualType contextualType, SystemTextJsonSchemaGeneratorSettings settings, JsonSchemaGenerator schemaGenerator, JsonSchemaResolver schemaResolver)