Files
Umbraco-CMS/src/Umbraco.Web.BackOffice/Extensions/CompositionExtensions.cs
Mole 9cd752c2f8 Netcore: Align Namespaces in Tests and Web.BackOffice (#9274)
* Align namespaces in integration tests

* Align namespaces in unit tests

* Align namespaces in Backoffice.Filters

* Align namespaces in Backoffice.ActionResults

* Align namespaces in Backoffice.Mapping

* Align namespaces in Backoffice.PorpertyEditors and SignalR

* Align namespaces in Backoffice.Trees

* Align unit tests after migration
2020-10-26 13:34:08 +01:00

53 lines
1.7 KiB
C#

using Umbraco.Core.Composing;
using Umbraco.Web.BackOffice.Controllers;
using Umbraco.Web.Common.Controllers;
using Umbraco.Web.Common.Install;
using Umbraco.Web.BackOffice.Trees;
// the namespace here is intentional - although defined in Umbraco.Web assembly,
// this class should be visible when using Umbraco.Core.Components, alongside
// Umbraco.Core's own CompositionExtensions class
// ReSharper disable once CheckNamespace
namespace Umbraco.Extensions
{
/// <summary>
/// Provides extension methods to the <see cref="Composition"/> class.
/// </summary>
public static class WebCompositionExtensions
{
#region Collection Builders
/// <summary>
/// Gets the back office tree collection builder
/// </summary>
/// <param name="composition"></param>
/// <returns></returns>
public static TreeCollectionBuilder Trees(this Composition composition)
=> composition.WithCollectionBuilder<TreeCollectionBuilder>();
#endregion
/// <summary>
/// Registers Umbraco backoffice controllers.
/// </summary>
public static Composition ComposeUmbracoBackOfficeControllers(this Composition composition)
{
composition.RegisterControllers(new []
{
typeof(BackOfficeController),
typeof(PreviewController),
typeof(AuthenticationController),
typeof(InstallController),
typeof(InstallApiController),
});
var umbracoAuthorizedApiControllers = composition.TypeLoader.GetTypes<UmbracoApiController>();
composition.RegisterControllers(umbracoAuthorizedApiControllers);
return composition;
}
}
}