No need to register controllers into container, DefaultControllerActivator works fine.
This commit is contained in:
@@ -1,40 +0,0 @@
|
||||
using System.Linq;
|
||||
using Umbraco.Core.Composing;
|
||||
using Umbraco.Web.Common.Controllers;
|
||||
using Umbraco.Web.Mvc;
|
||||
using Umbraco.Web.Website.Controllers;
|
||||
|
||||
namespace Umbraco.Extensions
|
||||
{
|
||||
public static class CompositionExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Registers Umbraco website controllers.
|
||||
/// </summary>
|
||||
public static Composition ComposeWebsiteUmbracoControllers(this Composition composition)
|
||||
{
|
||||
composition.RegisterControllers(new []
|
||||
{
|
||||
// typeof(UmbProfileController), //TODO introduce when migrated
|
||||
// typeof(UmbLoginStatusController),//TODO introduce when migrated
|
||||
// typeof(UmbRegisterController),//TODO introduce when migrated
|
||||
// typeof(UmbLoginController),//TODO introduce when migrated
|
||||
typeof(RenderMvcController),
|
||||
typeof(RenderNoContentController),
|
||||
|
||||
});
|
||||
|
||||
var umbracoWebAssembly = typeof(SurfaceController).Assembly;
|
||||
|
||||
// scan and register every PluginController in everything (PluginController is IDiscoverable and IController)
|
||||
var nonUmbracoWebPluginController = composition.TypeLoader.GetTypes<PluginController>().Where(x => x.Assembly != umbracoWebAssembly);
|
||||
composition.RegisterControllers(nonUmbracoWebPluginController);
|
||||
|
||||
// can and register every IRenderMvcController in everything (IRenderMvcController is IDiscoverable)
|
||||
var renderMvcControllers = composition.TypeLoader.GetTypes<IRenderMvcController>().Where(x => x.Assembly != umbracoWebAssembly);
|
||||
composition.RegisterControllers(renderMvcControllers);
|
||||
|
||||
return composition;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.Controllers;
|
||||
using Microsoft.AspNetCore.Mvc.ViewEngines;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Umbraco.Web.Website.ViewEngines;
|
||||
@@ -13,8 +9,6 @@ namespace Umbraco.Extensions
|
||||
{
|
||||
public static void AddUmbracoWebsite(this IServiceCollection services)
|
||||
{
|
||||
services.AddSingleton<IControllerActivator, ServiceBasedControllerActivator>();
|
||||
|
||||
// Set the render & plugin view engines (Super complicated, but this allows us to use the IServiceCollection
|
||||
// to inject dependencies into the viewEngines)
|
||||
services.AddTransient<IConfigureOptions<MvcViewOptions>, RenderMvcViewOptionsSetup>();
|
||||
@@ -24,8 +18,6 @@ namespace Umbraco.Extensions
|
||||
|
||||
// Wraps all existing view engines in a ProfilerViewEngine
|
||||
services.AddTransient<IConfigureOptions<MvcViewOptions>, ProfilingViewEngineWrapperMvcViewOptionsSetup>();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user