Table of Contents

Class ServiceCollectionExtensions

Namespace
Umbraco.Extensions
Assembly
Umbraco.Web.Common.dll
public static class ServiceCollectionExtensions
Inheritance
ServiceCollectionExtensions
Inherited Members

Methods

AddLogger(IServiceCollection, IHostEnvironment, IConfiguration)

Create and configure the logger.

public static IServiceCollection AddLogger(this IServiceCollection services, IHostEnvironment hostEnvironment, IConfiguration configuration)

Parameters

services IServiceCollection
hostEnvironment IHostEnvironment
configuration IConfiguration

Returns

IServiceCollection

Remarks

Additional Serilog services are registered during ConfigureUmbracoDefaults(IHostBuilder).

AddLogger(IServiceCollection, IHostingEnvironment, ILoggingConfiguration, IConfiguration)

Create and configure the logger

[Obsolete("Use the extension method that takes an IHostEnvironment instance instead.")]
public static IServiceCollection AddLogger(this IServiceCollection services, IHostingEnvironment hostingEnvironment, ILoggingConfiguration loggingConfiguration, IConfiguration configuration)

Parameters

services IServiceCollection
hostingEnvironment IHostingEnvironment
loggingConfiguration ILoggingConfiguration
configuration IConfiguration

Returns

IServiceCollection

AddTypeLoader(IServiceCollection, Assembly?, ILoggerFactory, IConfiguration)

Called to create the Umbraco.Cms.Core.Composing.TypeLoader to assign to the Umbraco.Cms.Core.DependencyInjection.IUmbracoBuilder

public static TypeLoader AddTypeLoader(this IServiceCollection services, Assembly? entryAssembly, ILoggerFactory loggerFactory, IConfiguration configuration)

Parameters

services IServiceCollection
entryAssembly Assembly
loggerFactory ILoggerFactory
configuration IConfiguration

Returns

TypeLoader

Remarks

This should never be called in a web project. It is used internally by Umbraco but could be used in unit tests. If called in a web project it will have no affect except to create and return a new TypeLoader but this will not be the instance in DI.

AddTypeLoader(IServiceCollection, Assembly, IHostingEnvironment, ILoggerFactory, AppCaches, IConfiguration, IProfiler)

Called to create the Umbraco.Cms.Core.Composing.TypeLoader to assign to the Umbraco.Cms.Core.DependencyInjection.IUmbracoBuilder

[Obsolete("Please use alternative extension method.")]
public static TypeLoader AddTypeLoader(this IServiceCollection services, Assembly entryAssembly, IHostingEnvironment hostingEnvironment, ILoggerFactory loggerFactory, AppCaches appCaches, IConfiguration configuration, IProfiler profiler)

Parameters

services IServiceCollection
entryAssembly Assembly
hostingEnvironment IHostingEnvironment
loggerFactory ILoggerFactory
appCaches AppCaches
configuration IConfiguration
profiler IProfiler

Returns

TypeLoader

Remarks

This should never be called in a web project. It is used internally by Umbraco but could be used in unit tests. If called in a web project it will have no affect except to create and return a new TypeLoader but this will not be the instance in DI.