Click or drag to resize

ServiceCollectionExtensionsAddAutofac Method

Adds the AutofacServiceProviderFactory to the service collection. ONLY FOR PRE-ASP.NET 3.0 HOSTING. THIS WON'T WORK FOR ASP.NET CORE 3.0+ OR GENERIC HOSTING.

Namespace:  Autofac.Extensions.DependencyInjection
Assembly:  Autofac.Extensions.DependencyInjection (in Autofac.Extensions.DependencyInjection.dll) Version: 7.1.0+380b08798bf724f36e200e687129b44a0778ab92
Syntax
public static IServiceCollection AddAutofac(
	this IServiceCollection services,
	Action<ContainerBuilder> configurationAction = null
)

Parameters

services
Type: IServiceCollection
The service collection to add the factory to.
configurationAction (Optional)
Type: SystemActionContainerBuilder
Action on a ContainerBuilder that adds component registrations to the container.

Return Value

Type: IServiceCollection
The service collection.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IServiceCollection. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also