Class UmbracoBuilderExtensions
Inheritance
Namespace: Umbraco.Extensions
Assembly: Umbraco.Cms.Api.Delivery.dll
Syntax
public static class UmbracoBuilderExtensions
Methods
View SourceAddBackOffice(IUmbracoBuilder, Action<IMvcBuilder>?)
Adds all required components to run the Umbraco back office.
Declaration
public static IUmbracoBuilder AddBackOffice(this IUmbracoBuilder builder, Action<IMvcBuilder>? configureMvc = null)
Parameters
| Type | Name | Description |
|---|---|---|
| IUmbracoBuilder | builder | The Umbraco builder. |
| Action<IMvcBuilder> | configureMvc | Optional action to configure the MVC builder. |
Returns
| Type | Description |
|---|---|
| IUmbracoBuilder | The Umbraco builder. |
Remarks
This method calls AddCore() and AddBackOfficeSignIn(IUmbracoBuilder) internally
to register core services, identity, and cookie authentication, then adds backoffice-specific
services on top (OpenIddict, backoffice SPA infrastructure, token management).
For frontend-only deployments that only need basic authentication with backoffice credentials (no backoffice UI), use AddBackOfficeSignIn(IUmbracoBuilder) instead.
AddBackOfficeCore(IUmbracoBuilder)
Registers the essential services required for the Umbraco back office, including the back office path generator and the physical file system implementation.
Declaration
public static IUmbracoBuilder AddBackOfficeCore(this IUmbracoBuilder builder)
Parameters
| Type | Name | Description |
|---|---|---|
| IUmbracoBuilder | builder | The IUmbracoBuilder to add services to. |
Returns
| Type | Description |
|---|---|
| IUmbracoBuilder | The updated IUmbracoBuilder instance. |
AddBackOfficeExternalLogins(IUmbracoBuilder, Action<BackOfficeExternalLoginsBuilder>)
Adds support for external login providers in Umbraco
Declaration
public static IUmbracoBuilder AddBackOfficeExternalLogins(this IUmbracoBuilder umbracoBuilder, Action<BackOfficeExternalLoginsBuilder> builder)
Parameters
| Type | Name | Description |
|---|---|---|
| IUmbracoBuilder | umbracoBuilder | |
| Action<BackOfficeExternalLoginsBuilder> | builder |
Returns
| Type | Description |
|---|---|
| IUmbracoBuilder |
AddBackOfficeIdentity(IUmbracoBuilder)
Adds Identity support for Umbraco back office
Declaration
public static IUmbracoBuilder AddBackOfficeIdentity(this IUmbracoBuilder builder)
Parameters
| Type | Name | Description |
|---|---|---|
| IUmbracoBuilder | builder |
Returns
| Type | Description |
|---|---|
| IUmbracoBuilder |
AddBackOfficeSignIn(IUmbracoBuilder)
Adds backoffice identity and cookie authentication without the full backoffice UI or OpenIddict. Use this for frontend-only deployments that need basic authentication with backoffice credentials.
Declaration
public static IUmbracoBuilder AddBackOfficeSignIn(this IUmbracoBuilder builder)
Parameters
| Type | Name | Description |
|---|---|---|
| IUmbracoBuilder | builder | The IUmbracoBuilder to configure. |
Returns
| Type | Description |
|---|---|
| IUmbracoBuilder | The same IUmbracoBuilder instance. |
Remarks
This registers the backoffice identity system (user manager, sign-in manager) and cookie authentication
schemes, but does NOT register OpenIddict, the Management API, or the backoffice SPA. It enables
BasicAuthenticationMiddleware to authenticate users via a standalone server-rendered login page.
Requires AddCore() to have been called first.
For full backoffice support, use AddBackOffice(IUmbracoBuilder, Action<IMvcBuilder>?) instead.
AddCore(IUmbracoBuilder, Action<IMvcBuilder>?)
Adds all core Umbraco services required to run without the backoffice.
Use this for delivery-only scenarios (Delivery API, Website) without the management backoffice.
For full Umbraco with backoffice, use AddBackOffice() instead.
Declaration
public static IUmbracoBuilder AddCore(this IUmbracoBuilder builder, Action<IMvcBuilder>? configureMvc = null)
Parameters
| Type | Name | Description |
|---|---|---|
| IUmbracoBuilder | builder | The Umbraco builder. |
| Action<IMvcBuilder> | configureMvc | Optional action to configure the MVC builder. |
Returns
| Type | Description |
|---|---|
| IUmbracoBuilder | The Umbraco builder. |
Remarks
This method is idempotent - calling it multiple times has no effect after the first call.
The individual service registration methods are also idempotent, so calling both
AddBackOffice() and AddCore(IUmbracoBuilder, Action<IMvcBuilder>?) is safe (though not expected).
AddDeliveryApi(IUmbracoBuilder)
Add services for the Umbraco Delivery API (headless content delivery).
Declaration
public static IUmbracoBuilder AddDeliveryApi(this IUmbracoBuilder builder)
Parameters
| Type | Name | Description |
|---|---|---|
| IUmbracoBuilder | builder | The Umbraco builder. |
Returns
| Type | Description |
|---|---|
| IUmbracoBuilder | The Umbraco builder. |
Remarks
This method assumes that either AddBackOffice() or AddCore() has already been called.
It registers Delivery API-specific services such as controllers, output caching, and member authentication.
AddHelpers(IUmbracoBuilder)
Declaration
public static IUmbracoBuilder AddHelpers(this IUmbracoBuilder builder)
Parameters
| Type | Name | Description |
|---|---|---|
| IUmbracoBuilder | builder |
Returns
| Type | Description |
|---|---|
| IUmbracoBuilder |
AddMemberExternalLogins(IUmbracoBuilder, Action<MemberExternalLoginsBuilder>)
Adds support for external login providers in Umbraco
Declaration
public static IUmbracoBuilder AddMemberExternalLogins(this IUmbracoBuilder umbracoBuilder, Action<MemberExternalLoginsBuilder> builder)
Parameters
| Type | Name | Description |
|---|---|---|
| IUmbracoBuilder | umbracoBuilder | |
| Action<MemberExternalLoginsBuilder> | builder |
Returns
| Type | Description |
|---|---|
| IUmbracoBuilder |
AddMembersIdentity(IUmbracoBuilder)
Adds Identity support for Umbraco members
Declaration
public static IUmbracoBuilder AddMembersIdentity(this IUmbracoBuilder builder)
Parameters
| Type | Name | Description |
|---|---|---|
| IUmbracoBuilder | builder |
Returns
| Type | Description |
|---|---|
| IUmbracoBuilder |
AddMvcAndRazor(IUmbracoBuilder, Action<IMvcBuilder>?)
Declaration
public static IUmbracoBuilder AddMvcAndRazor(this IUmbracoBuilder builder, Action<IMvcBuilder>? mvcBuilding = null)
Parameters
| Type | Name | Description |
|---|---|---|
| IUmbracoBuilder | builder | |
| Action<IMvcBuilder> | mvcBuilding |
Returns
| Type | Description |
|---|---|
| IUmbracoBuilder |
AddTwoFactorProvider<T>(BackOfficeIdentityBuilder, string)
Registers a two-factor authentication provider for the back office identity system.
Declaration
public static BackOfficeIdentityBuilder AddTwoFactorProvider<T>(this BackOfficeIdentityBuilder identityBuilder, string providerName) where T : class, ITwoFactorProvider
Parameters
| Type | Name | Description |
|---|---|---|
| BackOfficeIdentityBuilder | identityBuilder | The BackOfficeIdentityBuilder to configure. |
| string | providerName | The unique name of the two-factor provider. |
Returns
| Type | Description |
|---|---|
| BackOfficeIdentityBuilder | The configured BackOfficeIdentityBuilder instance. |
Type Parameters
| Name | Description |
|---|---|
| T | The type of the two-factor provider to register. Must implement ITwoFactorProvider. |
AddUmbraco(IServiceCollection, IWebHostEnvironment, IConfiguration)
Creates an IUmbracoBuilder and registers basic Umbraco services
Declaration
public static IUmbracoBuilder AddUmbraco(this IServiceCollection services, IWebHostEnvironment webHostEnvironment, IConfiguration config)
Parameters
| Type | Name | Description |
|---|---|---|
| IServiceCollection | services | |
| IWebHostEnvironment | webHostEnvironment | |
| IConfiguration | config |
Returns
| Type | Description |
|---|---|
| IUmbracoBuilder |
AddUmbracoCore(IUmbracoBuilder)
Adds core Umbraco services
Declaration
public static IUmbracoBuilder AddUmbracoCore(this IUmbracoBuilder builder)
Parameters
| Type | Name | Description |
|---|---|---|
| IUmbracoBuilder | builder |
Returns
| Type | Description |
|---|---|
| IUmbracoBuilder |
Remarks
This will not add any composers/components
AddUmbracoHybridCache(IUmbracoBuilder)
Adds Umbraco NuCache dependencies
Declaration
public static IUmbracoBuilder AddUmbracoHybridCache(this IUmbracoBuilder builder)
Parameters
| Type | Name | Description |
|---|---|---|
| IUmbracoBuilder | builder |
Returns
| Type | Description |
|---|---|
| IUmbracoBuilder |
AddUmbracoManagementApi(IUmbracoBuilder)
Registers and configures all services, controllers, and options required for the Umbraco Management API. This includes endpoints and features for managing Umbraco backoffice resources via HTTP APIs.
Declaration
public static IUmbracoBuilder AddUmbracoManagementApi(this IUmbracoBuilder builder)
Parameters
| Type | Name | Description |
|---|---|---|
| IUmbracoBuilder | builder | The IUmbracoBuilder to add the Management API services to. |
Returns
| Type | Description |
|---|---|
| IUmbracoBuilder | The IUmbracoBuilder instance with Management API services configured. |
AddUmbracoProfiler(IUmbracoBuilder)
Adds the Umbraco request profiler
Declaration
public static IUmbracoBuilder AddUmbracoProfiler(this IUmbracoBuilder builder)
Parameters
| Type | Name | Description |
|---|---|---|
| IUmbracoBuilder | builder |
Returns
| Type | Description |
|---|---|
| IUmbracoBuilder |
AddWebComponents(IUmbracoBuilder)
Adds all web based services required for Umbraco to run
Declaration
public static IUmbracoBuilder AddWebComponents(this IUmbracoBuilder builder)
Parameters
| Type | Name | Description |
|---|---|---|
| IUmbracoBuilder | builder |
Returns
| Type | Description |
|---|---|
| IUmbracoBuilder |
AddWebsite(IUmbracoBuilder)
Add services for the umbraco front-end website.
Declaration
public static IUmbracoBuilder AddWebsite(this IUmbracoBuilder builder)
Parameters
| Type | Name | Description |
|---|---|---|
| IUmbracoBuilder | builder | The Umbraco builder. |
Returns
| Type | Description |
|---|---|
| IUmbracoBuilder | The Umbraco builder. |
Remarks
This method assumes that either AddBackOffice() or AddCore() has already been called.
It registers website-specific services such as Surface controllers, view engines, and routing.
FlagProviders(IUmbracoBuilder)
Gets the flag providers collection builder.
Declaration
public static FlagProviderCollectionBuilder FlagProviders(this IUmbracoBuilder builder)
Parameters
| Type | Name | Description |
|---|---|---|
| IUmbracoBuilder | builder | The builder. |
Returns
| Type | Description |
|---|---|
| FlagProviderCollectionBuilder |
Mappers(IUmbracoBuilder)
Gets the MapperCollectionBuilder for registering and configuring mappers.
Declaration
public static MapperCollectionBuilder Mappers(this IUmbracoBuilder builder)
Parameters
| Type | Name | Description |
|---|---|---|
| IUmbracoBuilder | builder | The Umbraco builder instance. |
Returns
| Type | Description |
|---|---|
| MapperCollectionBuilder | The MapperCollectionBuilder instance. |
NPocoMappers(IUmbracoBuilder)
Gets the collection builder for NPoco mappers.
Declaration
public static NPocoMapperCollectionBuilder NPocoMappers(this IUmbracoBuilder builder)
Parameters
| Type | Name | Description |
|---|---|---|
| IUmbracoBuilder | builder | The Umbraco builder instance. |
Returns
| Type | Description |
|---|---|
| NPocoMapperCollectionBuilder | An NPocoMapperCollectionBuilder for configuring NPoco mappers. |
PackageMigrationPlans(IUmbracoBuilder)
Gets the collection builder for package migration plans.
Declaration
public static PackageMigrationPlanCollectionBuilder PackageMigrationPlans(this IUmbracoBuilder builder)
Parameters
| Type | Name | Description |
|---|---|---|
| IUmbracoBuilder | builder | The Umbraco builder instance. |
Returns
| Type | Description |
|---|---|
| PackageMigrationPlanCollectionBuilder | The PackageMigrationPlanCollectionBuilder for package migration plans. |
RuntimeModeValidators(IUmbracoBuilder)
Returns the collection builder for runtime mode validators.
Declaration
public static RuntimeModeValidatorCollectionBuilder RuntimeModeValidators(this IUmbracoBuilder builder)
Parameters
| Type | Name | Description |
|---|---|---|
| IUmbracoBuilder | builder | The Umbraco builder instance. |
Returns
| Type | Description |
|---|---|
| RuntimeModeValidatorCollectionBuilder | The RuntimeModeValidatorCollectionBuilder for configuring runtime mode validators. |
SignProviders(IUmbracoBuilder)
Gets the sign providers collection builder.
Declaration
[Obsolete("Please use the correctly named FlagProviders. Scheduled for removal in Umbraco 19.")]
public static FlagProviderCollectionBuilder SignProviders(this IUmbracoBuilder builder)
Parameters
| Type | Name | Description |
|---|---|---|
| IUmbracoBuilder | builder | The Umbraco builder instance. |
Returns
| Type | Description |
|---|---|
| FlagProviderCollectionBuilder | The FlagProviderCollectionBuilder instance. |