Click or drag to resize

ContainerBuilder Methods

The ContainerBuilder type exposes the following members.

Methods
  NameDescription
Public methodBuild
Create a new container with the component registrations that have been made.
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodRegisterBuildCallback
Register a callback that will be invoked when the container (or lifetime scope) is built.
Public methodRegisterCallback
Register a callback that will be invoked when the container is configured.
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Top
Extension Methods
  NameDescription
Public Extension MethodOverrideActionFilterForTControllerOverloaded.
Sets the provided registration to act as an IOverrideFilter for the specified controller.
(Defined by RegistrationExtensions.)
Public Extension MethodOverrideActionFilterForTController(ExpressionActionTController)Overloaded.
Sets the provided registration to act as an IOverrideFilter for the specified controller action.
(Defined by RegistrationExtensions.)
Public Extension MethodOverrideAuthenticationFilterForTControllerOverloaded.
Sets the provided registration to act as an IOverrideFilter for the specified controller.
(Defined by RegistrationExtensions.)
Public Extension MethodOverrideAuthenticationFilterForTController(ExpressionActionTController)Overloaded.
Sets the provided registration to act as an IOverrideFilter for the specified controller action.
(Defined by RegistrationExtensions.)
Public Extension MethodOverrideAuthorizationFilterForTControllerOverloaded.
Sets the provided registration to act as an IOverrideFilter for the specified controller.
(Defined by RegistrationExtensions.)
Public Extension MethodOverrideAuthorizationFilterForTController(ExpressionActionTController)Overloaded.
Sets the provided registration to act as an IOverrideFilter for the specified controller action.
(Defined by RegistrationExtensions.)
Public Extension MethodOverrideExceptionFilterForTControllerOverloaded.
Sets the provided registration to act as an IOverrideFilter for the specified controller.
(Defined by RegistrationExtensions.)
Public Extension MethodOverrideExceptionFilterForTController(ExpressionActionTController)Overloaded.
Sets the provided registration to act as an IOverrideFilter for the specified controller action.
(Defined by RegistrationExtensions.)
Public Extension MethodOverrideResultFilterForTControllerOverloaded.
Sets the provided registration to act as an IOverrideFilter for the specified controller.
(Defined by RegistrationExtensions.)
Public Extension MethodOverrideResultFilterForTController(ExpressionActionTController)Overloaded.
Sets the provided registration to act as an IOverrideFilter for the specified controller action.
(Defined by RegistrationExtensions.)
Public Extension MethodOverrideWebApiActionFilterForTControllerOverloaded.
Sets the provided registration to act as an IOverrideFilter for the specified controller.
(Defined by RegistrationExtensions.)
Public Extension MethodOverrideWebApiActionFilterForTController(ExpressionActionTController)Overloaded.
Sets the provided registration to act as an IOverrideFilter for the specified controller action.
(Defined by RegistrationExtensions.)
Public Extension MethodOverrideWebApiAuthenticationFilterForTControllerOverloaded.
Sets the provided registration to act as an IOverrideFilter for the specified controller.
(Defined by RegistrationExtensions.)
Public Extension MethodOverrideWebApiAuthenticationFilterForTController(ExpressionActionTController)Overloaded.
Sets the provided registration to act as an IOverrideFilter for the specified controller action.
(Defined by RegistrationExtensions.)
Public Extension MethodOverrideWebApiAuthorizationFilterForTControllerOverloaded.
Sets the provided registration to act as an IOverrideFilter for the specified controller.
(Defined by RegistrationExtensions.)
Public Extension MethodOverrideWebApiAuthorizationFilterForTController(ExpressionActionTController)Overloaded.
Sets the provided registration to act as an IOverrideFilter for the specified controller action.
(Defined by RegistrationExtensions.)
Public Extension MethodOverrideWebApiExceptionFilterForTControllerOverloaded.
Sets the provided registration to act as an IOverrideFilter for the specified controller.
(Defined by RegistrationExtensions.)
Public Extension MethodOverrideWebApiExceptionFilterForTController(ExpressionActionTController)Overloaded.
Sets the provided registration to act as an IOverrideFilter for the specified controller action.
(Defined by RegistrationExtensions.)
Public Extension MethodPopulate(IEnumerableServiceDescriptor)Overloaded.
Populates the Autofac container builder with the set of registered service descriptors and makes IServiceProvider and IServiceScopeFactory available in the container.
(Defined by AutofacRegistration.)
Public Extension MethodPopulate(IEnumerableServiceDescriptor, Object)Overloaded.
Populates the Autofac container builder with the set of registered service descriptors and makes IServiceProvider and IServiceScopeFactory available in the container. Using this overload is incompatible with the ASP.NET Core support for IServiceProviderFactory.
(Defined by AutofacRegistration.)
Public Extension MethodRegisterT(FuncIComponentContext, T)Overloaded.
Register a delegate as a component.
(Defined by RegistrationExtensions.)
Public Extension MethodRegisterT(FuncIComponentContext, IEnumerableParameter, T)Overloaded.
Register a delegate as a component.
(Defined by RegistrationExtensions.)
Public Extension MethodRegisterActorTActor
Registers an actor service with the container.
(Defined by AutofacActorExtensions.)
Public Extension MethodRegisterAdapterTFrom, TTo(FuncTFrom, TTo)Overloaded.
Adapt all components implementing service TFrom to provide TTo using the provided adapter function.
(Defined by RegistrationExtensions.)
Public Extension MethodRegisterAdapterTFrom, TTo(FuncIComponentContext, IEnumerableParameter, TFrom, TTo)Overloaded.
Adapt all components implementing service TFrom to provide TTo using the provided adapter function.
(Defined by RegistrationExtensions.)
Public Extension MethodRegisterAdapterTFrom, TTo(FuncIComponentContext, TFrom, TTo)Overloaded.
Adapt all components implementing service TFrom to provide TTo using the provided adapter function.
(Defined by RegistrationExtensions.)
Public Extension MethodRegisterAggregateService(Type)Overloaded.
Register interfaceType as an aggregate service.
(Defined by ContainerBuilderExtensions.)
Public Extension MethodRegisterAggregateServiceTInterfaceOverloaded.
Register TInterface as an aggregate service.
(Defined by ContainerBuilderExtensions.)
Public Extension MethodRegisterApiControllers(Assembly)Overloaded.
Register types in the provided assemblies that implement IHttpController and match the default type name suffix of "Controller".
(Defined by RegistrationExtensions.)
Public Extension MethodRegisterApiControllers(String, Assembly)Overloaded.
Register types in the provided assemblies that implement IHttpController and match the provided type name suffix.
(Defined by RegistrationExtensions.)
Public Extension MethodRegisterAssemblyModules(Assembly)Overloaded.
Registers modules found in an assembly.
(Defined by ModuleRegistrationExtensions.)
Public Extension MethodRegisterAssemblyModules(Type, Assembly)Overloaded.
Registers modules found in an assembly.
(Defined by ModuleRegistrationExtensions.)
Public Extension MethodRegisterAssemblyModulesTModule(Assembly)Overloaded.
Registers modules found in an assembly.
(Defined by ModuleRegistrationExtensions.)
Public Extension MethodRegisterAssemblyTypes
Register all types in an assembly.
(Defined by RegistrationExtensions.)
Public Extension MethodRegisterComponent
Add a component to the container.
(Defined by RegistrationExtensions.)
Public Extension MethodRegisterComposablePartCatalog(ComposablePartCatalog)Overloaded.
Register a MEF catalog.
(Defined by RegistrationExtensions.)
Public Extension MethodRegisterComposablePartCatalog(ComposablePartCatalog, Service)Overloaded.
Register a MEF catalog.
(Defined by RegistrationExtensions.)
Public Extension MethodRegisterComposablePartCatalog(ComposablePartCatalog, FuncExportDefinition, IEnumerableService)Overloaded.
Register a MEF catalog.
(Defined by RegistrationExtensions.)
Public Extension MethodRegisterComposablePartDefinition
Register a MEF part definition.
(Defined by RegistrationExtensions.)
Public Extension MethodRegisterComposablePartType(Type)Overloaded.
Register a MEF-attributed type as a component.
(Defined by RegistrationExtensions.)
Public Extension MethodRegisterComposablePartType(Type, FuncExportDefinition, IEnumerableService)Overloaded.
Register a MEF-attributed type as a component.
(Defined by RegistrationExtensions.)
Public Extension MethodRegisterComposite(Type, Type)Overloaded.

Register a composite type that should always provide the instance of serviceType when it is resolved, regardless of what other registrations for serviceType are available.

Composite registrations are not included when resolving a collection of serviceType.

(Defined by RegistrationExtensions.)
Public Extension MethodRegisterCompositeTService(FuncIComponentContext, IEnumerableParameter, IEnumerableTService, TService)Overloaded.

Register a delegate that should always provide the composite instance of a service type when it is resolved, regardless of what other registrations for TService are available.

Composite registrations are not included when resolving a collection of TService.

(Defined by RegistrationExtensions.)
Public Extension MethodRegisterCompositeTService(FuncIComponentContext, IEnumerableTService, TService)Overloaded.

Register a delegate that should always provide the composite instance of a service type when it is resolved, regardless of what other registrations for TService are available.

Composite registrations are not included when resolving a collection of TService.

(Defined by RegistrationExtensions.)
Public Extension MethodRegisterCompositeTComposite, TServiceOverloaded.

Register a composite type that should always provide the instance of TService when it is resolved, regardless of what other registrations for TService are available.

Composite registrations are not included when resolving a collection of TService.

(Defined by RegistrationExtensions.)
Public Extension MethodRegisterControllers
Register types that implement IController in the provided assemblies.
(Defined by RegistrationExtensions.)
Public Extension MethodRegisterDecorator(Type, Type, FuncIDecoratorContext, Boolean)Overloaded.
Decorate all components implementing service serviceType with decorator service decoratorType.
(Defined by RegistrationExtensions.)
Public Extension MethodRegisterDecoratorTService(FuncIComponentContext, IEnumerableParameter, TService, TService, FuncIDecoratorContext, Boolean)Overloaded.
Decorate all components implementing service TService using the provided decorator function.
(Defined by RegistrationExtensions.)
Public Extension MethodRegisterDecoratorTService(FuncTService, TService, Object, Object)Overloaded.
Decorate all components implementing service TService using the provided decorator function. The fromKey and toKey parameters must be different values.
(Defined by RegistrationExtensions.)
Public Extension MethodRegisterDecoratorTService(FuncIComponentContext, IEnumerableParameter, TService, TService, Object, Object)Overloaded.
Decorate all components implementing service TService using the provided decorator function. The fromKey and toKey parameters must be different values.
(Defined by RegistrationExtensions.)
Public Extension MethodRegisterDecoratorTService(FuncIComponentContext, TService, TService, Object, Object)Overloaded.
Decorate all components implementing service TService using the provided decorator function. The fromKey and toKey parameters must be different values.
(Defined by RegistrationExtensions.)
Public Extension MethodRegisterDecoratorTDecorator, TService(FuncIDecoratorContext, Boolean)Overloaded.
Decorate all components implementing service TService with decorator service TDecorator.
(Defined by RegistrationExtensions.)
Public Extension MethodRegisterFilterProvider
Registers the AutofacFilterProvider.
(Defined by RegistrationExtensions.)
Public Extension MethodRegisterGeneratedFactory(Type)Overloaded.
Registers a factory delegate.
(Defined by RegistrationExtensions.)
Public Extension MethodRegisterGeneratedFactory(Type, Service)Overloaded.
Registers a factory delegate.
(Defined by RegistrationExtensions.)
Public Extension MethodRegisterGeneratedFactoryTDelegateOverloaded.
Registers a factory delegate.
(Defined by RegistrationExtensions.)
Public Extension MethodRegisterGeneratedFactoryTDelegate(Service)Overloaded.
Registers a factory delegate.
(Defined by RegistrationExtensions.)
Public Extension MethodRegisterGeneric(Type)Overloaded.
Register an un-parameterised generic type, e.g. Repository<>. Concrete types will be made as they are requested, e.g. with Resolve<Repository<int>>().
(Defined by RegistrationExtensions.)
Public Extension MethodRegisterGeneric(FuncIComponentContext, Type, Object)Overloaded.
Register a delegate that can provide instances of an open generic registration.
(Defined by RegistrationExtensions.)
Public Extension MethodRegisterGeneric(FuncIComponentContext, Type, IEnumerableParameter, Object)Overloaded.
Register a delegate that can provide instances of an open generic registration.
(Defined by RegistrationExtensions.)
Public Extension MethodRegisterGenericComposite

Register an un-parameterised generic type, e.g. Composite<> to function as a composite for an open generic service, e.g. IRepository<>. Composites will be made as they are requested, e.g. with Resolve<IRepository<int>>().

Composite registrations are not included when resolving a collection of serviceType.

(Defined by RegistrationExtensions.)
Public Extension MethodRegisterGenericDecorator(Type, Type, FuncIDecoratorContext, Boolean)Overloaded.
Decorate all components implementing open generic service serviceType.
(Defined by RegistrationExtensions.)
Public Extension MethodRegisterGenericDecorator(Type, Type, Object, Object)Overloaded.
Decorate all components implementing open generic service decoratedServiceType. The fromKey and toKey parameters must be different values.
(Defined by RegistrationExtensions.)
Public Extension MethodRegisterHttpRequestMessage
Makes the current HttpRequestMessage resolvable through the dependency scope.
(Defined by RegistrationExtensions.)
Public Extension MethodRegisterHubs
Register types that implement IHub in the provided assemblies.
(Defined by RegistrationExtensions.)
Public Extension MethodRegisterInstanceT
Register an instance as a component.
(Defined by RegistrationExtensions.)
Public Extension MethodRegisterMetadataRegistrationSources
Registers the LazyWithMetadataRegistrationSource and StronglyTypedMetadataRegistrationSource registration sources.
(Defined by RegistrationExtensions.)
Public Extension MethodRegisterMockTMocked
Register a mock by explicitly providing a Mock instance for the service being mocked.
(Defined by MockRegistrationExtensions.)
Public Extension MethodRegisterModelBinderProvider (Defined by RegistrationExtensions.)
Public Extension MethodRegisterModelBinders
Register types that implement IModelBinder in the provided assemblies and have a ModelBinderTypeAttribute.
(Defined by RegistrationExtensions.)
Public Extension MethodRegisterModule(IModule)Overloaded.
Add a module to the container.
(Defined by ModuleRegistrationExtensions.)
Public Extension MethodRegisterModuleTModuleOverloaded.
Add a module to the container.
(Defined by ModuleRegistrationExtensions.)
Public Extension MethodRegisterServiceFabricSupport
Adds the core services required by the Service Fabric integration.
(Defined by RegistrationExtensions.)
Public Extension MethodRegisterServiceMiddleware(Type, IResolveMiddleware, MiddlewareInsertionMode)Overloaded.
Register a resolve middleware for services providing a particular type.
(Defined by ServiceMiddlewareRegistrationExtensions.)
Public Extension MethodRegisterServiceMiddleware(Service, IResolveMiddleware, MiddlewareInsertionMode)Overloaded.
Register a resolve middleware for a particular service.
(Defined by ServiceMiddlewareRegistrationExtensions.)
Public Extension MethodRegisterServiceMiddlewareTService(IResolveMiddleware, MiddlewareInsertionMode)Overloaded.
Register a resolve middleware for services providing a particular type.
(Defined by ServiceMiddlewareRegistrationExtensions.)
Public Extension MethodRegisterServiceMiddlewareTService(PipelinePhase, ActionResolveRequestContext, ActionResolveRequestContext)Overloaded.
Register a resolve middleware for services providing a particular type.
(Defined by ServiceMiddlewareRegistrationExtensions.)
Public Extension MethodRegisterServiceMiddlewareTService(String, PipelinePhase, ActionResolveRequestContext, ActionResolveRequestContext)Overloaded.
Register a resolve middleware for services providing a particular type.
(Defined by ServiceMiddlewareRegistrationExtensions.)
Public Extension MethodRegisterServiceMiddlewareTService(String, PipelinePhase, MiddlewareInsertionMode, ActionResolveRequestContext, ActionResolveRequestContext)Overloaded.
Register a resolve middleware for services providing a particular type.
(Defined by ServiceMiddlewareRegistrationExtensions.)
Public Extension MethodRegisterServiceMiddlewareSource
Register a source of service middleware.
(Defined by ServiceMiddlewareRegistrationExtensions.)
Public Extension MethodRegisterSource(IRegistrationSource)Overloaded.
Add a registration source to the container.
(Defined by SourceRegistrationExtensions.)
Public Extension MethodRegisterSourceTRegistrationSourceOverloaded.
Add a registration source to the container.
(Defined by SourceRegistrationExtensions.)
Public Extension MethodRegisterStatefulServiceTService
Registers a stateful service with the container.
(Defined by AutofacServiceExtensions.)
Public Extension MethodRegisterStatelessServiceTService
Registers a stateless service with the container.
(Defined by AutofacServiceExtensions.)
Public Extension MethodRegisterType(Type)Overloaded.
Register a component to be created through reflection.
(Defined by RegistrationExtensions.)
Public Extension MethodRegisterTypeTImplementerOverloaded.
Register a component to be created through reflection.
(Defined by RegistrationExtensions.)
Public Extension MethodRegisterTypes
Register the types in a list.
(Defined by RegistrationExtensions.)
Public Extension MethodRegisterWebApiFilterProvider (Defined by RegistrationExtensions.)
Public Extension MethodRegisterWebApiModelBinderProvider (Defined by RegistrationExtensions.)
Public Extension MethodRegisterWebApiModelBinders
Register types that implement IModelBinder in the provided assemblies.
(Defined by RegistrationExtensions.)
Top
See Also