From f86d8185bfc895dc46433b057f1f8f25b7f85124 Mon Sep 17 00:00:00 2001 From: Bjarke Berg Date: Thu, 11 Jun 2020 11:21:07 +0200 Subject: [PATCH] Clean up and based on review comments --- .../{Net => Templates}/IUmbracoComponentRenderer.cs | 2 +- .../{Net => Templates}/UmbracoComponentRenderer.cs | 4 +--- src/Umbraco.Infrastructure/Runtime/CoreInitialComposer.cs | 3 +-- src/Umbraco.Tests/Testing/TestingTests/MockTests.cs | 2 +- .../Controllers/MacroRenderingController.cs | 2 +- .../UmbracoBackOfficeServiceCollectionExtensions.cs | 4 ---- src/Umbraco.Web.UI.NetCore/Startup.cs | 5 +++++ src/Umbraco.Web/Composing/Current.cs | 2 +- src/Umbraco.Web/Runtime/WebInitialComposer.cs | 2 +- src/Umbraco.Web/UmbracoHelper.cs | 2 +- 10 files changed, 13 insertions(+), 15 deletions(-) rename src/Umbraco.Core/{Net => Templates}/IUmbracoComponentRenderer.cs (98%) rename src/Umbraco.Core/{Net => Templates}/UmbracoComponentRenderer.cs (98%) diff --git a/src/Umbraco.Core/Net/IUmbracoComponentRenderer.cs b/src/Umbraco.Core/Templates/IUmbracoComponentRenderer.cs similarity index 98% rename from src/Umbraco.Core/Net/IUmbracoComponentRenderer.cs rename to src/Umbraco.Core/Templates/IUmbracoComponentRenderer.cs index 0391a01183..cc75ff706c 100644 --- a/src/Umbraco.Core/Net/IUmbracoComponentRenderer.cs +++ b/src/Umbraco.Core/Templates/IUmbracoComponentRenderer.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; using Umbraco.Core.Strings; -namespace Umbraco.Core.Net +namespace Umbraco.Core.Templates { /// /// Methods used to render umbraco components as HTML in templates diff --git a/src/Umbraco.Core/Net/UmbracoComponentRenderer.cs b/src/Umbraco.Core/Templates/UmbracoComponentRenderer.cs similarity index 98% rename from src/Umbraco.Core/Net/UmbracoComponentRenderer.cs rename to src/Umbraco.Core/Templates/UmbracoComponentRenderer.cs index 22703a111e..27c298d54f 100644 --- a/src/Umbraco.Core/Net/UmbracoComponentRenderer.cs +++ b/src/Umbraco.Core/Templates/UmbracoComponentRenderer.cs @@ -2,7 +2,6 @@ using System.Linq; using System.IO; using System.Web; -using Umbraco.Core; using Umbraco.Web.Templates; using System.Collections.Generic; using Umbraco.Core.Models.PublishedContent; @@ -10,7 +9,7 @@ using Umbraco.Core.Strings; using Umbraco.Web; using Umbraco.Web.Macros; -namespace Umbraco.Core.Net +namespace Umbraco.Core.Templates { /// @@ -19,7 +18,6 @@ namespace Umbraco.Core.Net /// /// Used by UmbracoHelper /// - // Migrated to .NET Core public class UmbracoComponentRenderer : IUmbracoComponentRenderer { private readonly IUmbracoContextAccessor _umbracoContextAccessor; diff --git a/src/Umbraco.Infrastructure/Runtime/CoreInitialComposer.cs b/src/Umbraco.Infrastructure/Runtime/CoreInitialComposer.cs index 1c37968a6a..2843236252 100644 --- a/src/Umbraco.Infrastructure/Runtime/CoreInitialComposer.cs +++ b/src/Umbraco.Infrastructure/Runtime/CoreInitialComposer.cs @@ -18,7 +18,7 @@ using Umbraco.Core.Migrations; using Umbraco.Core.Migrations.Install; using Umbraco.Core.Migrations.PostMigrations; using Umbraco.Core.Models.PublishedContent; -using Umbraco.Core.Net; +using Umbraco.Core.Templates; using Umbraco.Core.Persistence; using Umbraco.Core.PropertyEditors; using Umbraco.Core.PropertyEditors.Validators; @@ -40,7 +40,6 @@ using Umbraco.Web.Features; using Umbraco.Web.HealthCheck; using Umbraco.Web.HealthCheck.NotificationMethods; using Umbraco.Web.Install; -using Umbraco.Web.Macros; using Umbraco.Web.Media.EmbedProviders; using Umbraco.Web.Migrations.PostMigrations; using Umbraco.Web.Models.PublishedContent; diff --git a/src/Umbraco.Tests/Testing/TestingTests/MockTests.cs b/src/Umbraco.Tests/Testing/TestingTests/MockTests.cs index 3f848325cc..76b23cf5e9 100644 --- a/src/Umbraco.Tests/Testing/TestingTests/MockTests.cs +++ b/src/Umbraco.Tests/Testing/TestingTests/MockTests.cs @@ -14,7 +14,7 @@ using Umbraco.Core.Logging; using Umbraco.Core.Mapping; using Umbraco.Core.Models; using Umbraco.Core.Models.PublishedContent; -using Umbraco.Core.Net; +using Umbraco.Core.Templates; using Umbraco.Core.Persistence; using Umbraco.Core.Services; using Umbraco.Tests.Common; diff --git a/src/Umbraco.Web.BackOffice/Controllers/MacroRenderingController.cs b/src/Umbraco.Web.BackOffice/Controllers/MacroRenderingController.cs index 58c30aa0ee..c3c4c9d9b7 100644 --- a/src/Umbraco.Web.BackOffice/Controllers/MacroRenderingController.cs +++ b/src/Umbraco.Web.BackOffice/Controllers/MacroRenderingController.cs @@ -12,7 +12,7 @@ using Umbraco.Core; using Umbraco.Core.Mapping; using Umbraco.Core.Models; using Umbraco.Core.Models.PublishedContent; -using Umbraco.Core.Net; +using Umbraco.Core.Templates; using Umbraco.Core.Services; using Umbraco.Core.Strings; using Umbraco.Web.Common.Attributes; diff --git a/src/Umbraco.Web.BackOffice/Extensions/UmbracoBackOfficeServiceCollectionExtensions.cs b/src/Umbraco.Web.BackOffice/Extensions/UmbracoBackOfficeServiceCollectionExtensions.cs index 832d92f4f0..6105383a3d 100644 --- a/src/Umbraco.Web.BackOffice/Extensions/UmbracoBackOfficeServiceCollectionExtensions.cs +++ b/src/Umbraco.Web.BackOffice/Extensions/UmbracoBackOfficeServiceCollectionExtensions.cs @@ -23,10 +23,6 @@ namespace Umbraco.Extensions { services.AddAntiforgery(); - //We need to have runtime compilation of views when using backoffice. We could consider having only this when a specific config is set. - //But as far as I can see, there are still precompiled views, even when this is activated, so maybe it is okay. - services.AddControllersWithViews().AddRazorRuntimeCompilation(); - services .AddAuthentication(Constants.Security.BackOfficeAuthenticationType) .AddCookie(Constants.Security.BackOfficeAuthenticationType); diff --git a/src/Umbraco.Web.UI.NetCore/Startup.cs b/src/Umbraco.Web.UI.NetCore/Startup.cs index 3ff9d0cff2..53fb1e6a14 100644 --- a/src/Umbraco.Web.UI.NetCore/Startup.cs +++ b/src/Umbraco.Web.UI.NetCore/Startup.cs @@ -52,6 +52,11 @@ namespace Umbraco.Web.UI.BackOffice options.ShouldProfile = request => false; // WebProfiler determine and start profiling. We should not use the MiniProfilerMiddleware to also profile }); + //We need to have runtime compilation of views when using umbraco. We could consider having only this when a specific config is set. + //But as far as I can see, there are still precompiled views, even when this is activated, so maybe it is okay. + services.AddControllersWithViews().AddRazorRuntimeCompilation(); + + // If using Kestrel: https://stackoverflow.com/a/55196057 services.Configure(options => { diff --git a/src/Umbraco.Web/Composing/Current.cs b/src/Umbraco.Web/Composing/Current.cs index 7ce8890018..68120947df 100644 --- a/src/Umbraco.Web/Composing/Current.cs +++ b/src/Umbraco.Web/Composing/Current.cs @@ -11,7 +11,7 @@ using Umbraco.Core.Composing; using Umbraco.Core.Configuration; using Umbraco.Core.Hosting; using Umbraco.Core.Mapping; -using Umbraco.Core.Net; +using Umbraco.Core.Templates; using Umbraco.Net; using Umbraco.Core.PackageActions; using Umbraco.Core.Packaging; diff --git a/src/Umbraco.Web/Runtime/WebInitialComposer.cs b/src/Umbraco.Web/Runtime/WebInitialComposer.cs index b13ffd42d5..e2f6334a11 100644 --- a/src/Umbraco.Web/Runtime/WebInitialComposer.cs +++ b/src/Umbraco.Web/Runtime/WebInitialComposer.cs @@ -4,7 +4,7 @@ using Microsoft.AspNet.SignalR; using Umbraco.Core; using Umbraco.Core.Composing; using Umbraco.Core.Dictionary; -using Umbraco.Core.Net; +using Umbraco.Core.Templates; using Umbraco.Core.Runtime; using Umbraco.Core.Security; using Umbraco.Core.Services; diff --git a/src/Umbraco.Web/UmbracoHelper.cs b/src/Umbraco.Web/UmbracoHelper.cs index 469837c5f2..5b72e9cda0 100644 --- a/src/Umbraco.Web/UmbracoHelper.cs +++ b/src/Umbraco.Web/UmbracoHelper.cs @@ -7,7 +7,7 @@ using Umbraco.Composing; using Umbraco.Core; using Umbraco.Core.Dictionary; using Umbraco.Core.Models.PublishedContent; -using Umbraco.Core.Net; +using Umbraco.Core.Templates; using Umbraco.Core.Strings; using Umbraco.Core.Xml; using Umbraco.Web.Mvc;