- Removed BackOfficeArea
- Injected IEmailSender
- Uses nameof instead of magic strings
- Uses GetControllerName instead of magic strings

Signed-off-by: Bjarke Berg <mail@bergmania.dk>
This commit is contained in:
Bjarke Berg
2020-10-22 13:37:47 +02:00
parent 785c3a34e9
commit ca8e54ffc6
7 changed files with 26 additions and 70 deletions

View File

@@ -1,43 +0,0 @@
using System.Web.Mvc;
using Umbraco.Core.Configuration;
using Umbraco.Core.Configuration.Models;
using Umbraco.Core.Hosting;
using Umbraco.Web.Editors;
namespace Umbraco.Web.Mvc
{
// TODO: This has been ported to netcore, can be removed
// Has preview been migrated?
internal class BackOfficeArea : AreaRegistration
{
private readonly GlobalSettings _globalSettings;
private readonly IHostingEnvironment _hostingEnvironment;
public BackOfficeArea(GlobalSettings globalSettings, IHostingEnvironment hostingEnvironment)
{
_globalSettings = globalSettings;
_hostingEnvironment = hostingEnvironment;
}
/// <summary>
/// Create the routes for the area
/// </summary>
/// <param name="context"></param>
/// <remarks>
/// By using the context to register the routes it means that the area is already applied to them all
/// and that the namespaces searched for the controllers are ONLY the ones specified.
/// </remarks>
public override void RegisterArea(AreaRegistrationContext context)
{
context.MapRoute(
"Umbraco_preview",
AreaName + "/preview/{action}/{editor}",
new {controller = "Preview", action = "Index", editor = UrlParameter.Optional},
new[] { "Umbraco.Web.Editors" });
}
public override string AreaName => _globalSettings.GetUmbracoMvcArea(_hostingEnvironment);
}
}

View File

@@ -132,7 +132,7 @@ namespace Umbraco.Web.Runtime
// RouteTable.Routes.RegisterArea<UmbracoInstallArea>();
// register all back office routes
RouteTable.Routes.RegisterArea(new BackOfficeArea(globalSettings, hostingEnvironment));
// RouteTable.Routes.RegisterArea(new BackOfficeArea(globalSettings, hostingEnvironment));
// plugin controllers must come first because the next route will catch many things
RoutePluginControllers(globalSettings, surfaceControllerTypes, apiControllerTypes, hostingEnvironment);

View File

@@ -291,7 +291,6 @@
<Compile Include="Mvc\AreaRegistrationExtensions.cs" />
<Compile Include="Mvc\QueryStringFilterAttribute.cs" />
<Compile Include="Mvc\MemberAuthorizeAttribute.cs" />
<Compile Include="Mvc\BackOfficeArea.cs" />
<Compile Include="Mvc\ControllerFactoryExtensions.cs" />
<Compile Include="Mvc\SurfaceRouteHandler.cs" />
<Compile Include="Controllers\UmbLoginController.cs" />