diff --git a/uSync.AutoTemplates/TemplateWatcher.cs b/uSync.AutoTemplates/TemplateWatcher.cs index 1bfac2f44..d12d54fc6 100644 --- a/uSync.AutoTemplates/TemplateWatcher.cs +++ b/uSync.AutoTemplates/TemplateWatcher.cs @@ -31,7 +31,6 @@ public partial class TemplateWatcher : IRegisteredObject private readonly ILogger _logger; private readonly ITemplateService _templateService; private readonly IShortStringHelper _shortStringHelper; - private readonly IHostEnvironment _hostEnvironment; private readonly IFileSystem? _templateFileSystem; @@ -51,14 +50,13 @@ public TemplateWatcher( ITemplateService templateService) { _shortStringHelper = shortStringHelper; - _hostEnvironment = hostEnvironment; _hostingLifetime = hostingLifetime; _logger = logger; _templateFileSystem = fileSystems.MvcViewsFileSystem; - _viewsFolder = _hostEnvironment.MapPathContentRoot(Constants.SystemDirectories.MvcViews); + _viewsFolder = hostEnvironment.MapPathContentRoot(Constants.SystemDirectories.MvcViews); // @@ -157,7 +155,7 @@ private void CheckTemplates() } - private static object lockObject = new Object(); + private static readonly Lock lockObject = new(); private void CheckFile(string filename) { diff --git a/uSync.BackOffice/Boot/uSyncBootExtension.cs b/uSync.BackOffice/Boot/uSyncBootExtension.cs index e9c0048db..74f6e2927 100644 --- a/uSync.BackOffice/Boot/uSyncBootExtension.cs +++ b/uSync.BackOffice/Boot/uSyncBootExtension.cs @@ -48,7 +48,7 @@ public static IUmbracoBuilder AdduSyncFirstBoot(this IUmbracoBuilder builder) /// /// Handler to mange app starting for first boot migrations /// -internal class FirstBootAppStartingHandler +internal sealed class FirstBootAppStartingHandler : INotificationAsyncHandler { diff --git a/uSync.BackOffice/Configuration/SyncConfigService.cs b/uSync.BackOffice/Configuration/SyncConfigService.cs index e1377ec8e..f3501afa0 100644 --- a/uSync.BackOffice/Configuration/SyncConfigService.cs +++ b/uSync.BackOffice/Configuration/SyncConfigService.cs @@ -57,7 +57,7 @@ private string[] FetchFolders() .ToArray(); } - private class SyncFolderItem + private sealed class SyncFolderItem { public required string Path { get; set; } public int Weight { get; set; } diff --git a/uSync.BackOffice/Notifications/SyncScopedNotificationPublisher.cs b/uSync.BackOffice/Notifications/SyncScopedNotificationPublisher.cs index 5e8a03be2..cb4648a15 100644 --- a/uSync.BackOffice/Notifications/SyncScopedNotificationPublisher.cs +++ b/uSync.BackOffice/Notifications/SyncScopedNotificationPublisher.cs @@ -12,11 +12,10 @@ using uSync.BackOffice.Configuration; using uSync.BackOffice.Services; -using uSync.BackOffice.SyncHandlers.Interfaces; namespace uSync.BackOffice.Notifications; -internal class SyncScopedNotificationPublisher +internal sealed class SyncScopedNotificationPublisher : ScopedNotificationPublisher, IScopedNotificationPublisher { private readonly ILogger _logger; diff --git a/uSync.BackOffice/Services/uSyncTriggers.cs b/uSync.BackOffice/Services/uSyncTriggers.cs index 51080309c..8c8146e48 100644 --- a/uSync.BackOffice/Services/uSyncTriggers.cs +++ b/uSync.BackOffice/Services/uSyncTriggers.cs @@ -10,7 +10,7 @@ namespace uSync.BackOffice; /// /// used to trigger uSync events from within other elements of uSync /// -internal class uSyncTriggers +internal sealed class uSyncTriggers { internal static event uSyncTriggerEventHandler? DoExport; internal static event uSyncTriggerEventHandler? DoImport; @@ -47,12 +47,11 @@ public static void TriggerImport(string folder, IEnumerable entityTypes, } -internal class uSyncTriggerArgs +internal sealed class uSyncTriggerArgs { public string Folder { get; set; } = string.Empty; public IEnumerable EntityTypes { get; set; } = []; public SyncHandlerOptions? HandlerOptions { get; set; } - } diff --git a/uSync.BackOffice/SyncHandlers/SyncHandlerRoot.cs b/uSync.BackOffice/SyncHandlers/SyncHandlerRoot.cs index aaaf265d5..d5b3f2758 100644 --- a/uSync.BackOffice/SyncHandlers/SyncHandlerRoot.cs +++ b/uSync.BackOffice/SyncHandlers/SyncHandlerRoot.cs @@ -1962,7 +1962,7 @@ private async Task IsItemCurrentAsync(XElement node, SyncSeriali return null; } - private class SyncChangeInfo + private sealed class SyncChangeInfo { public ChangeType Change { get; set; } public XElement? CurrentNode { get; set; } diff --git a/uSync.BackOffice/Tracker/SyncTrackerNotificationHandler.cs b/uSync.BackOffice/Tracker/SyncTrackerNotificationHandler.cs index b3ad51019..584db805f 100644 --- a/uSync.BackOffice/Tracker/SyncTrackerNotificationHandler.cs +++ b/uSync.BackOffice/Tracker/SyncTrackerNotificationHandler.cs @@ -5,7 +5,7 @@ namespace uSync.BackOffice.Tracker; -internal class SyncTrackerNotificationHandler +internal sealed class SyncTrackerNotificationHandler : INotificationAsyncHandler { private readonly ISyncTrackerService _syncTrackerService; diff --git a/uSync.BackOffice/uSyncBackOffice.cs b/uSync.BackOffice/uSyncBackOffice.cs index 8f9f519ec..8b99f563c 100644 --- a/uSync.BackOffice/uSyncBackOffice.cs +++ b/uSync.BackOffice/uSyncBackOffice.cs @@ -38,7 +38,7 @@ internal class Trees internal const string Group = "sync"; } - internal class Sets + internal sealed class Sets { internal const string DefaultSet = "Default"; } diff --git a/uSync.Core/DataTypes/DataTypeSerializers/DataListMigratingConfigSerializer.cs b/uSync.Core/DataTypes/DataTypeSerializers/DataListMigratingConfigSerializer.cs index 84c42c0ab..af8198c79 100644 --- a/uSync.Core/DataTypes/DataTypeSerializers/DataListMigratingConfigSerializer.cs +++ b/uSync.Core/DataTypes/DataTypeSerializers/DataListMigratingConfigSerializer.cs @@ -37,7 +37,7 @@ public override IDictionary GetConfigurationImport(IDictionary GetConfigurationImport(IDictionary /// -internal class OrderedPropertiesJsonResolver : DefaultJsonTypeInfoResolver +internal sealed class OrderedPropertiesJsonResolver : DefaultJsonTypeInfoResolver { public override JsonTypeInfo GetTypeInfo(Type type, JsonSerializerOptions options) { diff --git a/uSync.Core/Mapping/Mappers/MultiUrlMapper.cs b/uSync.Core/Mapping/Mappers/MultiUrlMapper.cs index 108a7785e..e7665a6ff 100644 --- a/uSync.Core/Mapping/Mappers/MultiUrlMapper.cs +++ b/uSync.Core/Mapping/Mappers/MultiUrlMapper.cs @@ -39,7 +39,7 @@ public override Task> GetDependenciesAsync(object v // we need to just be able to read / manipulate the storage // to make things generic . [DataContract] - internal class LinkDto + internal sealed class LinkDto { [DataMember(Name = "name")] public string? Name { get; set; } diff --git a/uSync.Core/Serialization/Serializers/ContentTypeBaseSerializer.cs b/uSync.Core/Serialization/Serializers/ContentTypeBaseSerializer.cs index 2f4edd84a..25fe4779b 100644 --- a/uSync.Core/Serialization/Serializers/ContentTypeBaseSerializer.cs +++ b/uSync.Core/Serialization/Serializers/ContentTypeBaseSerializer.cs @@ -760,7 +760,7 @@ virtual protected IEnumerable DeserializeExtraProperties(TObject it return []; } - private class TabInfo + private sealed class TabInfo { public TabInfo(string alias) { @@ -1002,8 +1002,8 @@ protected IEnumerable CleanTabs(TObject item, XElement node, SyncSe if (tabNode == null) return []; var newTabs = tabNode.Elements("Tab") - .Select(x => GetTabAliasFromTabGroup(x)) - .ToList(); + .Select(GetTabAliasFromTabGroup) + .ToArray(); var inheritedTabs = item.ContentTypeComposition @@ -1141,7 +1141,7 @@ private bool SetMasterFromElement(IContentTypeBase item, XElement? masterNode) return false; } - private class PropertyTypeResult + private sealed class PropertyTypeResult { public bool IsNew { get; set; } public IPropertyType? Property { get; set; } diff --git a/uSync.Core/Serialization/Serializers/DomainSerializer.cs b/uSync.Core/Serialization/Serializers/DomainSerializer.cs index 5977c05de..36e6bf2d4 100644 --- a/uSync.Core/Serialization/Serializers/DomainSerializer.cs +++ b/uSync.Core/Serialization/Serializers/DomainSerializer.cs @@ -349,7 +349,7 @@ public override async Task SaveItemAsync(IDomain item) await _domainService.UpdateDomainsAsync(contentKey.Result, updateModel); } - private class DomainSyncModel + private sealed class DomainSyncModel { public required Guid Key { get; set; } public required string DomainName { get; set; } diff --git a/uSync.History/uSyncHistory.cs b/uSync.History/uSyncHistory.cs index e7de6f179..4ccd35dab 100644 --- a/uSync.History/uSyncHistory.cs +++ b/uSync.History/uSyncHistory.cs @@ -24,7 +24,7 @@ public class uSyncHistory : ISyncAddOn public int SortOrder => 20; } - internal class SyncHistoryConstants + internal sealed class SyncHistoryConstants { public const string ApiName = "uSync.History"; public const string AppName = "uSync.History"; diff --git a/uSync.SchemaGenerator/AppSettings.cs b/uSync.SchemaGenerator/AppSettings.cs index 747e38175..d4b3b0c4c 100644 --- a/uSync.SchemaGenerator/AppSettings.cs +++ b/uSync.SchemaGenerator/AppSettings.cs @@ -4,14 +4,14 @@ namespace uSync; -internal class AppSettings +internal sealed class AppSettings { public uSyncDefinition uSync { get; set; } /// /// Configuration of uSync settings /// - internal class uSyncDefinition + internal sealed class uSyncDefinition { /// /// uSync settings @@ -33,12 +33,12 @@ internal class uSyncDefinition /// public AutoTemplatesDefinition AutoTemplates { get; set; } - internal class uSyncSetsDefinition + internal sealed class uSyncSetsDefinition { public uSyncHandlerSetSettings Default { get; set; } } - internal class AutoTemplatesDefinition + internal sealed class AutoTemplatesDefinition { /// /// Enable AutoTemplates feature diff --git a/uSync.SchemaGenerator/Options.cs b/uSync.SchemaGenerator/Options.cs index 4cbbfbfc9..6a059d85a 100644 --- a/uSync.SchemaGenerator/Options.cs +++ b/uSync.SchemaGenerator/Options.cs @@ -2,7 +2,7 @@ namespace uSync; -internal class Options +internal sealed class Options { [Option('o', "outputFile", Required = false, HelpText = "", diff --git a/uSync.SchemaGenerator/Program.cs b/uSync.SchemaGenerator/Program.cs index 7f54a94cf..ddc66fc8f 100644 --- a/uSync.SchemaGenerator/Program.cs +++ b/uSync.SchemaGenerator/Program.cs @@ -10,7 +10,7 @@ namespace uSync; /// Generate the JSON Schema file for uSync. /// just like in the Umbraco Core - https://github.com/umbraco/Umbraco-CMS/tree/v9/contrib/src/JsonSchema /// -internal class Program +internal sealed class Program { public static async Task Main(string[] args) {