From 8c09521021bd2dadc2ffc9f73621b97ded34fa5f Mon Sep 17 00:00:00 2001 From: Jordan Brown Date: Sat, 18 Jan 2020 19:39:42 -0500 Subject: [PATCH] Create the .Extensions namespace --- src/Tgstation.Server.Host/Components/Watchdog/WatchdogBase.cs | 1 + .../Controllers/AdministrationController.cs | 1 + src/Tgstation.Server.Host/Core/Application.cs | 1 + .../{Core => Extensions}/ApplicationBuilderExtensions.cs | 4 ++-- .../{Core => Extensions}/ServiceCollectionExtensions.cs | 2 +- .../{Core => Extensions}/TaskExtensions.cs | 2 +- .../Core/TestServiceCollectionExtensions.cs | 1 + 7 files changed, 8 insertions(+), 4 deletions(-) rename src/Tgstation.Server.Host/{Core => Extensions}/ApplicationBuilderExtensions.cs (95%) rename src/Tgstation.Server.Host/{Core => Extensions}/ServiceCollectionExtensions.cs (97%) rename src/Tgstation.Server.Host/{Core => Extensions}/TaskExtensions.cs (97%) diff --git a/src/Tgstation.Server.Host/Components/Watchdog/WatchdogBase.cs b/src/Tgstation.Server.Host/Components/Watchdog/WatchdogBase.cs index 8b962e9936..6a5eeefb18 100644 --- a/src/Tgstation.Server.Host/Components/Watchdog/WatchdogBase.cs +++ b/src/Tgstation.Server.Host/Components/Watchdog/WatchdogBase.cs @@ -17,6 +17,7 @@ using Tgstation.Server.Host.Components.Chat; using Tgstation.Server.Host.Components.Compiler; using Tgstation.Server.Host.Components.Interop; using Tgstation.Server.Host.Core; +using Tgstation.Server.Host.Extensions; namespace Tgstation.Server.Host.Components.Watchdog { diff --git a/src/Tgstation.Server.Host/Controllers/AdministrationController.cs b/src/Tgstation.Server.Host/Controllers/AdministrationController.cs index def822cfb8..28aef34122 100644 --- a/src/Tgstation.Server.Host/Controllers/AdministrationController.cs +++ b/src/Tgstation.Server.Host/Controllers/AdministrationController.cs @@ -15,6 +15,7 @@ using Tgstation.Server.Api.Models; using Tgstation.Server.Api.Rights; using Tgstation.Server.Host.Configuration; using Tgstation.Server.Host.Core; +using Tgstation.Server.Host.Extensions; using Tgstation.Server.Host.IO; using Tgstation.Server.Host.Models; using Tgstation.Server.Host.Security; diff --git a/src/Tgstation.Server.Host/Core/Application.cs b/src/Tgstation.Server.Host/Core/Application.cs index 64e77a50b0..823f653c6a 100644 --- a/src/Tgstation.Server.Host/Core/Application.cs +++ b/src/Tgstation.Server.Host/Core/Application.cs @@ -32,6 +32,7 @@ using Tgstation.Server.Host.Components.Repository; using Tgstation.Server.Host.Components.Watchdog; using Tgstation.Server.Host.Configuration; using Tgstation.Server.Host.Controllers; +using Tgstation.Server.Host.Extensions; using Tgstation.Server.Host.IO; using Tgstation.Server.Host.Models; using Tgstation.Server.Host.Security; diff --git a/src/Tgstation.Server.Host/Core/ApplicationBuilderExtensions.cs b/src/Tgstation.Server.Host/Extensions/ApplicationBuilderExtensions.cs similarity index 95% rename from src/Tgstation.Server.Host/Core/ApplicationBuilderExtensions.cs rename to src/Tgstation.Server.Host/Extensions/ApplicationBuilderExtensions.cs index a9290b8c01..b79855c412 100644 --- a/src/Tgstation.Server.Host/Core/ApplicationBuilderExtensions.cs +++ b/src/Tgstation.Server.Host/Extensions/ApplicationBuilderExtensions.cs @@ -9,7 +9,7 @@ using System.Globalization; using System.Net; using Tgstation.Server.Api.Models; -namespace Tgstation.Server.Host.Core +namespace Tgstation.Server.Host.Extensions { /// /// Extensions for @@ -21,7 +21,7 @@ namespace Tgstation.Server.Host.Core /// /// The to get the from /// A new - static ILogger GetLogger(HttpContext httpContext) => httpContext.RequestServices.GetRequiredService>(); + static ILogger GetLogger(HttpContext httpContext) => httpContext.RequestServices.GetRequiredService().CreateLogger(typeof(ApplicationBuilderExtensions)); /// /// Return a for s diff --git a/src/Tgstation.Server.Host/Core/ServiceCollectionExtensions.cs b/src/Tgstation.Server.Host/Extensions/ServiceCollectionExtensions.cs similarity index 97% rename from src/Tgstation.Server.Host/Core/ServiceCollectionExtensions.cs rename to src/Tgstation.Server.Host/Extensions/ServiceCollectionExtensions.cs index cd50b10b88..3398d70c90 100644 --- a/src/Tgstation.Server.Host/Core/ServiceCollectionExtensions.cs +++ b/src/Tgstation.Server.Host/Extensions/ServiceCollectionExtensions.cs @@ -4,7 +4,7 @@ using System; using System.Globalization; using Tgstation.Server.Host.Configuration; -namespace Tgstation.Server.Host.Core +namespace Tgstation.Server.Host.Extensions { /// /// Extensions for diff --git a/src/Tgstation.Server.Host/Core/TaskExtensions.cs b/src/Tgstation.Server.Host/Extensions/TaskExtensions.cs similarity index 97% rename from src/Tgstation.Server.Host/Core/TaskExtensions.cs rename to src/Tgstation.Server.Host/Extensions/TaskExtensions.cs index fb1b825313..f2e8802173 100644 --- a/src/Tgstation.Server.Host/Core/TaskExtensions.cs +++ b/src/Tgstation.Server.Host/Extensions/TaskExtensions.cs @@ -2,7 +2,7 @@ using System.Threading; using System.Threading.Tasks; -namespace Tgstation.Server.Host.Core +namespace Tgstation.Server.Host.Extensions { /// /// Extensions for the . diff --git a/tests/Tgstation.Server.Host.Tests/Core/TestServiceCollectionExtensions.cs b/tests/Tgstation.Server.Host.Tests/Core/TestServiceCollectionExtensions.cs index 3cb14f8dd8..0b186d5444 100644 --- a/tests/Tgstation.Server.Host.Tests/Core/TestServiceCollectionExtensions.cs +++ b/tests/Tgstation.Server.Host.Tests/Core/TestServiceCollectionExtensions.cs @@ -3,6 +3,7 @@ using Microsoft.Extensions.DependencyInjection; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; using System; +using Tgstation.Server.Host.Extensions; namespace Tgstation.Server.Host.Core.Tests {