diff --git a/src/Umbraco.Core/Builder/IUmbracoBuilder.cs b/src/Umbraco.Core/DependencyInjection/IUmbracoBuilder.cs similarity index 91% rename from src/Umbraco.Core/Builder/IUmbracoBuilder.cs rename to src/Umbraco.Core/DependencyInjection/IUmbracoBuilder.cs index d1bd991ef5..f532f8cdaa 100644 --- a/src/Umbraco.Core/Builder/IUmbracoBuilder.cs +++ b/src/Umbraco.Core/DependencyInjection/IUmbracoBuilder.cs @@ -1,4 +1,4 @@ -using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using Umbraco.Core.Composing; diff --git a/src/Umbraco.Core/Builder/UmbracoBuilder.Events.cs b/src/Umbraco.Core/DependencyInjection/UmbracoBuilder.Events.cs similarity index 87% rename from src/Umbraco.Core/Builder/UmbracoBuilder.Events.cs rename to src/Umbraco.Core/DependencyInjection/UmbracoBuilder.Events.cs index 8a555d58dd..a21ae74976 100644 --- a/src/Umbraco.Core/Builder/UmbracoBuilder.Events.cs +++ b/src/Umbraco.Core/DependencyInjection/UmbracoBuilder.Events.cs @@ -1,15 +1,18 @@ -using Microsoft.Extensions.DependencyInjection; +// Copyright (c) Umbraco. +// See LICENSE for more details. + +using Microsoft.Extensions.DependencyInjection; using Umbraco.Core.Events; namespace Umbraco.Core.DependencyInjection { /// - /// Contains extensions methods for . + /// Contains extensions methods for used for registering event handlers. /// public static partial class UmbracoBuilderExtensions { /// - /// Registers a notification handler against the Umbraco service collection. + /// Registers a notification handler against the Umbraco service collection. /// /// The type of notification. /// The type of notificiation handler. diff --git a/src/Umbraco.Core/Builder/UmbracoBuilder.cs b/src/Umbraco.Core/DependencyInjection/UmbracoBuilder.cs similarity index 95% rename from src/Umbraco.Core/Builder/UmbracoBuilder.cs rename to src/Umbraco.Core/DependencyInjection/UmbracoBuilder.cs index 9579d22a76..d56712cdcf 100644 --- a/src/Umbraco.Core/Builder/UmbracoBuilder.cs +++ b/src/Umbraco.Core/DependencyInjection/UmbracoBuilder.cs @@ -1,9 +1,12 @@ -using Microsoft.Extensions.Configuration; +// Copyright (c) Umbraco. +// See LICENSE for more details. + +using System; +using System.Collections.Generic; +using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging.Abstractions; -using System; -using System.Collections.Generic; using Umbraco.Core.Composing; using Umbraco.Core.Events; diff --git a/src/Umbraco.Core/Events/EventAggregator.Notifications.cs b/src/Umbraco.Core/Events/EventAggregator.Notifications.cs index 1e6bf9901f..00982b52d7 100644 --- a/src/Umbraco.Core/Events/EventAggregator.Notifications.cs +++ b/src/Umbraco.Core/Events/EventAggregator.Notifications.cs @@ -1,4 +1,7 @@ -using System; +// Copyright (c) Umbraco. +// See LICENSE for more details. + +using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; @@ -12,13 +15,13 @@ namespace Umbraco.Core.Events /// public partial class EventAggregator : IEventAggregator { - private static readonly ConcurrentDictionary NotificationHandlers + private static readonly ConcurrentDictionary s_notificationHandlers = new ConcurrentDictionary(); private Task PublishNotificationAsync(INotification notification, CancellationToken cancellationToken = default) { - var notificationType = notification.GetType(); - var handler = NotificationHandlers.GetOrAdd( + Type notificationType = notification.GetType(); + NotificationHandlerWrapper handler = s_notificationHandlers.GetOrAdd( notificationType, t => (NotificationHandlerWrapper)Activator.CreateInstance(typeof(NotificationHandlerWrapperImpl<>).MakeGenericType(notificationType))); @@ -27,9 +30,10 @@ namespace Umbraco.Core.Events private async Task PublishCoreAsync( IEnumerable> allHandlers, - INotification notification, CancellationToken cancellationToken) + INotification notification, + CancellationToken cancellationToken) { - foreach (var handler in allHandlers) + foreach (Func handler in allHandlers) { await handler(notification, cancellationToken).ConfigureAwait(false); } diff --git a/src/Umbraco.Core/Events/EventAggregator.cs b/src/Umbraco.Core/Events/EventAggregator.cs index 384cb1f9ff..8d58175da4 100644 --- a/src/Umbraco.Core/Events/EventAggregator.cs +++ b/src/Umbraco.Core/Events/EventAggregator.cs @@ -1,10 +1,21 @@ -using System; +// Copyright (c) Umbraco. +// See LICENSE for more details. + +using System; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; namespace Umbraco.Core.Events { + /// + /// A factory method used to resolve all services. + /// For multiple instances, it will resolve against . + /// + /// Type of service to resolve. + /// An instance of type . + public delegate object ServiceFactory(Type serviceType); + /// public partial class EventAggregator : IEventAggregator { @@ -31,14 +42,6 @@ namespace Umbraco.Core.Events } } - /// - /// A factory method used to resolve all services. - /// For multiple instances, it will resolve against . - /// - /// Type of service to resolve. - /// An instance of type . - public delegate object ServiceFactory(Type serviceType); - /// /// Extensions for . /// diff --git a/src/Umbraco.Core/Events/IEventAggregator.cs b/src/Umbraco.Core/Events/IEventAggregator.cs index fd8005aef8..bd01ad0b57 100644 --- a/src/Umbraco.Core/Events/IEventAggregator.cs +++ b/src/Umbraco.Core/Events/IEventAggregator.cs @@ -1,4 +1,7 @@ -using System.Threading; +// Copyright (c) Umbraco. +// See LICENSE for more details. + +using System.Threading; using System.Threading.Tasks; namespace Umbraco.Core.Events @@ -14,7 +17,7 @@ namespace Umbraco.Core.Events /// /// The type of notification being handled. /// The notification object. - /// An optional cancellation token + /// An optional cancellation token. /// A task that represents the publish operation. Task PublishAsync(TNotification notification, CancellationToken cancellationToken = default) where TNotification : INotification; @@ -23,10 +26,12 @@ namespace Umbraco.Core.Events /// /// A marker interface to represent a notification. /// - public interface INotification { } + public interface INotification + { + } /// - /// Defines a handler for a notification + /// Defines a handler for a notification. /// /// The type of notification being handled. public interface INotificationHandler @@ -36,7 +41,8 @@ namespace Umbraco.Core.Events /// Handles a notification /// /// The notification - /// Cancellation token + /// The cancellation token. + /// A representing the asynchronous operation. Task HandleAsync(TNotification notification, CancellationToken cancellationToken); } } diff --git a/src/Umbraco.Tests.Integration/RuntimeTests.cs b/src/Umbraco.Tests.Integration/RuntimeTests.cs index e930e12b9c..77ee27b8c4 100644 --- a/src/Umbraco.Tests.Integration/RuntimeTests.cs +++ b/src/Umbraco.Tests.Integration/RuntimeTests.cs @@ -1,29 +1,17 @@ -using System; using System.Threading.Tasks; using Microsoft.AspNetCore.Builder; -using Microsoft.AspNetCore.Routing; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; -using Microsoft.Extensions.Options; -using Moq; -using NUnit.Framework; using Microsoft.Extensions.Logging; +using NUnit.Framework; using Umbraco.Core; -using Umbraco.Core.DependencyInjection; using Umbraco.Core.Cache; using Umbraco.Core.Composing; -using Umbraco.Core.Configuration.Models; -using Umbraco.Core.Logging; -using Umbraco.Core.Persistence; -using Umbraco.Core.Persistence.Mappers; -using Umbraco.Core.Runtime; +using Umbraco.Core.DependencyInjection; using Umbraco.Extensions; -using Umbraco.Tests.Common; using Umbraco.Tests.Integration.Extensions; using Umbraco.Tests.Integration.Implementations; -using Umbraco.Tests.Integration.Testing; -using Umbraco.Core.DependencyInjection; namespace Umbraco.Tests.Integration { @@ -70,8 +58,8 @@ namespace Umbraco.Tests.Integration AppCaches.NoCache, hostContext.Configuration, testHelper.Profiler); - - var builder = new UmbracoBuilder(services, hostContext.Configuration, typeLoader, testHelper.ConsoleLoggerFactory); + + var builder = new UmbracoBuilder(services, hostContext.Configuration, typeLoader, testHelper.ConsoleLoggerFactory); builder.Services.AddUnique(AppCaches.NoCache); builder.AddConfiguration(); builder.AddUmbracoCore(); @@ -109,7 +97,7 @@ namespace Umbraco.Tests.Integration var webHostEnvironment = testHelper.GetWebHostEnvironment(); services.AddSingleton(testHelper.DbProviderFactoryCreator); services.AddRequiredNetCoreServices(testHelper, webHostEnvironment); - + // Add it! var typeLoader = services.AddTypeLoader( diff --git a/src/Umbraco.Tests.Integration/TestServerTest/UmbracoBuilderExtensions.cs b/src/Umbraco.Tests.Integration/TestServerTest/UmbracoBuilderExtensions.cs index 16cf6a35f4..0fcf47978a 100644 --- a/src/Umbraco.Tests.Integration/TestServerTest/UmbracoBuilderExtensions.cs +++ b/src/Umbraco.Tests.Integration/TestServerTest/UmbracoBuilderExtensions.cs @@ -1,11 +1,9 @@ -using Moq; +using Moq; using Umbraco.Core; -using Umbraco.Core.DependencyInjection; using Umbraco.Core.Cache; -using Umbraco.Core.Logging; +using Umbraco.Core.DependencyInjection; using Umbraco.Core.Runtime; using Umbraco.Tests.Integration.Implementations; -using Umbraco.Core.DependencyInjection; namespace Umbraco.Tests.Integration.TestServerTest { diff --git a/src/Umbraco.Tests.Integration/Testing/UmbracoIntegrationTest.cs b/src/Umbraco.Tests.Integration/Testing/UmbracoIntegrationTest.cs index 6ab11c839c..a8875de286 100644 --- a/src/Umbraco.Tests.Integration/Testing/UmbracoIntegrationTest.cs +++ b/src/Umbraco.Tests.Integration/Testing/UmbracoIntegrationTest.cs @@ -1,41 +1,35 @@ -using System; -using System.Threading.Tasks; +using System; +using System.Collections.Generic; +using System.Data.Common; +using System.Data.SqlClient; +using System.IO; using Microsoft.AspNetCore.Builder; +using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; +using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Logging.Abstractions; +using Microsoft.Extensions.Options; +using Moq; using NUnit.Framework; +using Serilog; +using Umbraco.Core; using Umbraco.Core.Cache; using Umbraco.Core.Composing; -using Umbraco.Core.Configuration; +using Umbraco.Core.Configuration.Models; +using Umbraco.Core.DependencyInjection; using Umbraco.Core.IO; -using Umbraco.Core.Logging; using Umbraco.Core.Persistence; using Umbraco.Core.Persistence.Mappers; +using Umbraco.Core.Runtime; using Umbraco.Core.Scoping; using Umbraco.Core.Strings; +using Umbraco.Extensions; using Umbraco.Tests.Common.Builders; using Umbraco.Tests.Integration.Extensions; using Umbraco.Tests.Integration.Implementations; -using Umbraco.Extensions; using Umbraco.Tests.Testing; using Umbraco.Web; -using Umbraco.Core.Runtime; -using Umbraco.Core; -using Moq; -using System.Collections.Generic; -using Microsoft.Extensions.Configuration; -using System.Data.SqlClient; -using System.Data.Common; -using System.Diagnostics; -using System.IO; -using Umbraco.Core.Configuration.Models; -using Microsoft.Extensions.Options; -using Microsoft.Extensions.Logging; -using Microsoft.Extensions.Logging.Abstractions; -using Serilog; -using Umbraco.Core.DependencyInjection; -using Umbraco.Core.DependencyInjection; -using ConnectionStrings = Umbraco.Core.Configuration.Models.ConnectionStrings; namespace Umbraco.Tests.Integration.Testing { @@ -65,7 +59,8 @@ namespace Umbraco.Tests.Integration.Testing [OneTimeTearDown] public void FixtureTearDown() { - foreach (var a in _fixtureTeardown) a(); + foreach (var a in _fixtureTeardown) + a(); } [TearDown] @@ -73,7 +68,8 @@ namespace Umbraco.Tests.Integration.Testing { if (_testTeardown != null) { - foreach (var a in _testTeardown) a(); + foreach (var a in _testTeardown) + a(); } _testTeardown = null; FirstTestInFixture = false; @@ -161,7 +157,7 @@ namespace Umbraco.Tests.Integration.Testing }); return hostBuilder; } - + #endregion #region IStartup @@ -275,7 +271,8 @@ namespace Umbraco.Tests.Integration.Testing { lock (_dbLocker) { - if (_dbInstance != null) return _dbInstance; + if (_dbInstance != null) + return _dbInstance; var localDb = new LocalDb(); if (localDb.IsAvailable == false) diff --git a/src/Umbraco.Tests.UnitTests/Umbraco.Core/Components/ComponentTests.cs b/src/Umbraco.Tests.UnitTests/Umbraco.Core/Components/ComponentTests.cs index 588d5d1f24..44aacab944 100644 --- a/src/Umbraco.Tests.UnitTests/Umbraco.Core/Components/ComponentTests.cs +++ b/src/Umbraco.Tests.UnitTests/Umbraco.Core/Components/ComponentTests.cs @@ -1,19 +1,19 @@ -using System; +using System; using System.Collections.Generic; using System.IO; using System.Linq; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Options; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging.Abstractions; +using Microsoft.Extensions.Options; using Moq; using NUnit.Framework; using Umbraco.Core; -using Umbraco.Core.DependencyInjection; using Umbraco.Core.Cache; using Umbraco.Core.Composing; using Umbraco.Core.Configuration.Models; +using Umbraco.Core.DependencyInjection; using Umbraco.Core.Hosting; using Umbraco.Core.IO; using Umbraco.Core.Logging; @@ -21,7 +21,6 @@ using Umbraco.Core.Persistence; using Umbraco.Core.Persistence.Mappers; using Umbraco.Core.Scoping; using Umbraco.Tests.TestHelpers; -using Umbraco.Core.DependencyInjection; namespace Umbraco.Tests.UnitTests.Umbraco.Core.Components { @@ -49,12 +48,12 @@ namespace Umbraco.Tests.UnitTests.Umbraco.Core.Components var mediaFileSystem = Mock.Of(); var p = new ScopeProvider(f, fs, Options.Create(coreDebug), mediaFileSystem, loggerFactory.CreateLogger(), loggerFactory, typeFinder, NoAppCache.Instance); - mock.Setup(x => x.GetService(typeof (ILogger))).Returns(logger); + mock.Setup(x => x.GetService(typeof(ILogger))).Returns(logger); mock.Setup(x => x.GetService(typeof(ILogger))).Returns(loggerFactory.CreateLogger); mock.Setup(x => x.GetService(typeof(ILoggerFactory))).Returns(loggerFactory); - mock.Setup(x => x.GetService(typeof (IProfilingLogger))).Returns(new ProfilingLogger(loggerFactory.CreateLogger(), Mock.Of())); - mock.Setup(x => x.GetService(typeof (IUmbracoDatabaseFactory))).Returns(f); - mock.Setup(x => x.GetService(typeof (IScopeProvider))).Returns(p); + mock.Setup(x => x.GetService(typeof(IProfilingLogger))).Returns(new ProfilingLogger(loggerFactory.CreateLogger(), Mock.Of())); + mock.Setup(x => x.GetService(typeof(IUmbracoDatabaseFactory))).Returns(f); + mock.Setup(x => x.GetService(typeof(IScopeProvider))).Returns(p); setup?.Invoke(mock); return mock.Object; @@ -94,11 +93,16 @@ namespace Umbraco.Tests.UnitTests.Umbraco.Core.Components m.Setup(x => x.GetService(It.Is(t => t == typeof(ISomeResource)))).Returns(() => new SomeResource()); m.Setup(x => x.GetService(It.IsAny())).Returns((type) => { - if (type == typeof(Composer1)) return new Composer1(); - if (type == typeof(Composer5)) return new Composer5(); - if (type == typeof(Component5)) return new Component5(new SomeResource()); - if (type == typeof(IProfilingLogger)) return new ProfilingLogger(Mock.Of>(), Mock.Of()); - if (type == typeof(ILogger)) return Mock.Of>(); + if (type == typeof(Composer1)) + return new Composer1(); + if (type == typeof(Composer5)) + return new Composer5(); + if (type == typeof(Component5)) + return new Component5(new SomeResource()); + if (type == typeof(IProfilingLogger)) + return new ProfilingLogger(Mock.Of>(), Mock.Of()); + if (type == typeof(ILogger)) + return Mock.Of>(); throw new NotSupportedException(type.FullName); }); }); @@ -213,16 +217,23 @@ namespace Umbraco.Tests.UnitTests.Umbraco.Core.Components var typeLoader = MockTypeLoader(); var factory = MockFactory(m => { - m.Setup(x => x.GetService(It.Is(t => t == typeof (ISomeResource)))).Returns(() => new SomeResource()); + m.Setup(x => x.GetService(It.Is(t => t == typeof(ISomeResource)))).Returns(() => new SomeResource()); m.Setup(x => x.GetService(It.IsAny())).Returns((type) => { - if (type == typeof(Composer1)) return new Composer1(); - if (type == typeof(Composer5)) return new Composer5(); - if (type == typeof(Composer5a)) return new Composer5a(); - if (type == typeof(Component5)) return new Component5(new SomeResource()); - if (type == typeof(Component5a)) return new Component5a(); - if (type == typeof(IProfilingLogger)) return new ProfilingLogger(Mock.Of>(), Mock.Of()); - if (type == typeof(ILogger)) return Mock.Of>(); + if (type == typeof(Composer1)) + return new Composer1(); + if (type == typeof(Composer5)) + return new Composer5(); + if (type == typeof(Composer5a)) + return new Composer5a(); + if (type == typeof(Component5)) + return new Component5(new SomeResource()); + if (type == typeof(Component5a)) + return new Component5a(); + if (type == typeof(IProfilingLogger)) + return new ProfilingLogger(Mock.Of>(), Mock.Of()); + if (type == typeof(ILogger)) + return Mock.Of>(); throw new NotSupportedException(type.FullName); }); }); diff --git a/src/Umbraco.Tests.UnitTests/Umbraco.Core/Composing/CollectionBuildersTests.cs b/src/Umbraco.Tests.UnitTests/Umbraco.Core/Composing/CollectionBuildersTests.cs index 5de3928486..b4131ca790 100644 --- a/src/Umbraco.Tests.UnitTests/Umbraco.Core/Composing/CollectionBuildersTests.cs +++ b/src/Umbraco.Tests.UnitTests/Umbraco.Core/Composing/CollectionBuildersTests.cs @@ -1,18 +1,14 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Moq; using NUnit.Framework; -using Umbraco.Core; -using Umbraco.Core.DependencyInjection; -using Umbraco.Core.Cache; using Umbraco.Core.Composing; -using Umbraco.Core.Logging; +using Umbraco.Core.DependencyInjection; using Umbraco.Tests.TestHelpers; using Umbraco.Tests.UnitTests.TestHelpers; -using Umbraco.Core.DependencyInjection; namespace Umbraco.Tests.UnitTests.Umbraco.Core.Composing { @@ -128,7 +124,7 @@ namespace Umbraco.Tests.UnitTests.Umbraco.Core.Composing //builder.Append(); // does not compile Assert.Throws(() => - builder.Append(new[] { typeof (Resolved4) }) // throws + builder.Append(new[] { typeof(Resolved4) }) // throws ); } diff --git a/src/Umbraco.Tests.UnitTests/Umbraco.Core/Events/EventAggregatorTests.cs b/src/Umbraco.Tests.UnitTests/Umbraco.Core/Events/EventAggregatorTests.cs index 84626612d9..08d78af59e 100644 --- a/src/Umbraco.Tests.UnitTests/Umbraco.Core/Events/EventAggregatorTests.cs +++ b/src/Umbraco.Tests.UnitTests/Umbraco.Core/Events/EventAggregatorTests.cs @@ -1,9 +1,12 @@ -using Microsoft.Extensions.Configuration; +// Copyright (c) Umbraco. +// See LICENSE for more details. + +using System.Threading; +using System.Threading.Tasks; +using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Moq; using NUnit.Framework; -using System.Threading; -using System.Threading.Tasks; using Umbraco.Core.DependencyInjection; using Umbraco.Core.Events; using Umbraco.Tests.TestHelpers; @@ -20,7 +23,7 @@ namespace Umbraco.Tests.UnitTests.Umbraco.Core.Events [SetUp] public void Setup() { - var register = TestHelper.GetServiceCollection(); + IServiceCollection register = TestHelper.GetServiceCollection(); _builder = new UmbracoBuilder(register, Mock.Of(), TestHelper.GetMockedTypeLoader()); } @@ -31,10 +34,10 @@ namespace Umbraco.Tests.UnitTests.Umbraco.Core.Events _builder.AddNotificationHandler(); _builder.AddNotificationHandler(); _builder.AddNotificationHandler(); - var provider = _builder.Services.BuildServiceProvider(); + ServiceProvider provider = _builder.Services.BuildServiceProvider(); var notification = new Notification(); - var aggregator = provider.GetService(); + IEventAggregator aggregator = provider.GetService(); await aggregator.PublishAsync(notification); Assert.AreEqual(A + B + C, notification.SubscriberCount); @@ -78,10 +81,7 @@ namespace Umbraco.Tests.UnitTests.Umbraco.Core.Events public class Adder { - public int Add(int a, int b) - { - return a + b; - } + public int Add(int a, int b) => a + b; } } } diff --git a/src/Umbraco.Web.BackOffice/Extensions/UmbracoBuilderExtensions.cs b/src/Umbraco.Web.BackOffice/Extensions/UmbracoBuilderExtensions.cs index 94f8577fa6..79c7a9d29a 100644 --- a/src/Umbraco.Web.BackOffice/Extensions/UmbracoBuilderExtensions.cs +++ b/src/Umbraco.Web.BackOffice/Extensions/UmbracoBuilderExtensions.cs @@ -1,11 +1,9 @@ -using System; +using System; using Microsoft.AspNetCore.Mvc.Filters; using Microsoft.Extensions.DependencyInjection; -using Microsoft.VisualBasic; using Umbraco.Core.DependencyInjection; using Umbraco.Web.BackOffice.Filters; using Umbraco.Web.BackOffice.Security; -using Umbraco.Core.DependencyInjection; namespace Umbraco.Extensions { @@ -36,7 +34,7 @@ namespace Umbraco.Extensions builder.Services .AddAuthentication() // This just creates a builder, nothing more - // Add our custom schemes which are cookie handlers + // Add our custom schemes which are cookie handlers .AddCookie(Core.Constants.Security.BackOfficeAuthenticationType) .AddCookie(Core.Constants.Security.BackOfficeExternalAuthenticationType, o => { diff --git a/src/Umbraco.Web.BackOffice/Security/AuthenticationBuilderExtensions.cs b/src/Umbraco.Web.BackOffice/Security/AuthenticationBuilderExtensions.cs index e2a7aeccaf..9949018d43 100644 --- a/src/Umbraco.Web.BackOffice/Security/AuthenticationBuilderExtensions.cs +++ b/src/Umbraco.Web.BackOffice/Security/AuthenticationBuilderExtensions.cs @@ -1,5 +1,5 @@ -using System; -using Umbraco.Core.Builder; +using System; +using Umbraco.Core.DependencyInjection; namespace Umbraco.Web.BackOffice.Security { diff --git a/src/Umbraco.Web.Common/Builder/UmbracoBuilderExtensions.cs b/src/Umbraco.Web.Common/Builder/UmbracoBuilderExtensions.cs index d69d886785..3bf4e9059b 100644 --- a/src/Umbraco.Web.Common/Builder/UmbracoBuilderExtensions.cs +++ b/src/Umbraco.Web.Common/Builder/UmbracoBuilderExtensions.cs @@ -1,18 +1,17 @@ -using Microsoft.AspNetCore.Builder; -using Microsoft.AspNetCore.Hosting; -using Microsoft.AspNetCore.Mvc; -using Microsoft.AspNetCore.Server.Kestrel.Core; -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.DependencyInjection; using System; -using System.Collections.Generic; using System.Data.Common; using System.Data.SqlClient; using System.IO; using System.Reflection; using System.Runtime.InteropServices; +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.ApplicationModels; +using Microsoft.AspNetCore.Server.Kestrel.Core; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection.Extensions; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; @@ -20,12 +19,12 @@ using Serilog; using Smidge; using Smidge.Nuglify; using Umbraco.Core; -using Umbraco.Core.DependencyInjection; using Umbraco.Core.Cache; using Umbraco.Core.Composing; using Umbraco.Core.Configuration; using Umbraco.Core.Configuration.Models; using Umbraco.Core.Configuration.Models.Validation; +using Umbraco.Core.DependencyInjection; using Umbraco.Core.IO; using Umbraco.Core.Logging; using Umbraco.Core.Persistence; @@ -52,8 +51,10 @@ namespace Umbraco.Core.DependencyInjection IWebHostEnvironment webHostEnvironment, IConfiguration config) { - if (services is null) throw new ArgumentNullException(nameof(services)); - if (config is null) throw new ArgumentNullException(nameof(config)); + if (services is null) + throw new ArgumentNullException(nameof(services)); + if (config is null) + throw new ArgumentNullException(nameof(config)); var loggingConfig = new LoggingConfiguration(Path.Combine(webHostEnvironment.ContentRootPath, "umbraco", "logs")); @@ -79,7 +80,8 @@ namespace Umbraco.Core.DependencyInjection /// Composes Composers public static IUmbracoBuilder AddUmbracoCore(this IUmbracoBuilder builder) { - if (builder is null) throw new ArgumentNullException(nameof(builder)); + if (builder is null) + throw new ArgumentNullException(nameof(builder)); builder.Services.AddLazySupport();