More composition simplification
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using System.Reflection;
|
||||
using System.Web.Http.Controllers;
|
||||
using System.Web.Mvc;
|
||||
using Umbraco.Core.Components;
|
||||
using Umbraco.Core.Composing;
|
||||
|
||||
namespace Umbraco.Web.Composing.Composers
|
||||
@@ -10,27 +11,31 @@ namespace Umbraco.Web.Composing.Composers
|
||||
/// <summary>
|
||||
/// Registers all IControllers using the TypeLoader for scanning and caching found instances for the calling assembly
|
||||
/// </summary>
|
||||
public static IContainer ComposeMvcControllers(this IContainer container, TypeLoader typeLoader, Assembly assembly)
|
||||
public static Composition ComposeMvcControllers(this Composition composition, TypeLoader typeLoader, Assembly assembly)
|
||||
{
|
||||
var container = composition.Container;
|
||||
|
||||
//TODO: We've already scanned for UmbracoApiControllers and SurfaceControllers - should we scan again
|
||||
// for all controllers? Seems like we should just do this once and then filter. That said here we are
|
||||
// only scanning our own single assembly. Hrm.
|
||||
|
||||
container.RegisterControllers<IController>(typeLoader, assembly);
|
||||
return container;
|
||||
return composition;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Registers all IHttpController using the TypeLoader for scanning and caching found instances for the calling assembly
|
||||
/// </summary>
|
||||
public static IContainer ComposeApiControllers(this IContainer container, TypeLoader typeLoader, Assembly assembly)
|
||||
public static Composition ComposeApiControllers(this Composition composition, TypeLoader typeLoader, Assembly assembly)
|
||||
{
|
||||
var container = composition.Container;
|
||||
|
||||
//TODO: We've already scanned for UmbracoApiControllers and SurfaceControllers - should we scan again
|
||||
// for all controllers? Seems like we should just do this once and then filter. That said here we are
|
||||
// only scanning our own single assembly. Hrm.
|
||||
|
||||
container.RegisterControllers<IHttpController>(typeLoader, assembly);
|
||||
return container;
|
||||
return composition;
|
||||
}
|
||||
|
||||
private static void RegisterControllers<TController>(this IContainer container, TypeLoader typeLoader, Assembly assembly)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Umbraco.Core.Composing;
|
||||
using Umbraco.Core.Components;
|
||||
using Umbraco.Core.Composing;
|
||||
using Umbraco.Web.Install;
|
||||
using Umbraco.Web.Install.InstallSteps;
|
||||
|
||||
@@ -6,8 +7,10 @@ namespace Umbraco.Web.Composing.Composers
|
||||
{
|
||||
public static class InstallerComposer
|
||||
{
|
||||
public static IContainer ComposeInstaller(this IContainer container)
|
||||
public static Composition ComposeInstaller(this Composition composition)
|
||||
{
|
||||
var container = composition.Container;
|
||||
|
||||
// register the installer steps
|
||||
|
||||
container.Register<NewInstallStep>(Lifetime.Scope);
|
||||
@@ -28,7 +31,7 @@ namespace Umbraco.Web.Composing.Composers
|
||||
container.Register<InstallStepCollection>();
|
||||
container.Register<InstallHelper>();
|
||||
|
||||
return container;
|
||||
return composition;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using AutoMapper;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Components;
|
||||
using Umbraco.Core.Composing;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Web.Models.ContentEditing;
|
||||
@@ -10,8 +11,10 @@ namespace Umbraco.Web.Composing.Composers
|
||||
{
|
||||
public static class WebMappingProfilesComposer
|
||||
{
|
||||
public static IContainer ComposeWebMappingProfiles(this IContainer container)
|
||||
public static Composition ComposeWebMappingProfiles(this Composition composition)
|
||||
{
|
||||
var container = composition.Container;
|
||||
|
||||
//register the profiles
|
||||
container.Register<Profile, AuditMapperProfile>();
|
||||
container.Register<Profile, CodeFileMapperProfile>();
|
||||
@@ -44,7 +47,7 @@ namespace Umbraco.Web.Composing.Composers
|
||||
container.Register<MediaAppResolver>();
|
||||
container.Register<ContentAppResolver>();
|
||||
|
||||
return container;
|
||||
return composition;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -120,7 +120,7 @@ namespace Umbraco.Web.Composing
|
||||
|
||||
internal static EditorValidatorCollection EditorValidators
|
||||
=> Container.GetInstance<EditorValidatorCollection>();
|
||||
|
||||
|
||||
internal static UmbracoApiControllerTypeCollection UmbracoApiControllerTypes
|
||||
=> Container.GetInstance<UmbracoApiControllerTypeCollection>();
|
||||
|
||||
@@ -230,7 +230,7 @@ namespace Umbraco.Web.Composing
|
||||
|
||||
public static IProfiler Profiler => CoreCurrent.Profiler;
|
||||
|
||||
public static ProfilingLogger ProfilingLogger => CoreCurrent.ProfilingLogger;
|
||||
public static IProfilingLogger ProfilingLogger => CoreCurrent.ProfilingLogger;
|
||||
|
||||
public static CacheHelper ApplicationCache => CoreCurrent.ApplicationCache;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user