ContainerBuilder Class |
Namespace: Autofac
The ContainerBuilder type exposes the following members.
Name | Description | |
---|---|---|
ContainerBuilder |
Initializes a new instance of the ContainerBuilder class.
|
Name | Description | |
---|---|---|
ComponentRegistryBuilder |
Gets the builder to use for building the underlying IComponentRegistry.
| |
Properties |
Gets the set of properties used during component registration.
|
Name | Description | |
---|---|---|
Build |
Create a new container with the component registrations that have been made.
| |
Equals | Determines whether the specified object is equal to the current object. (Inherited from Object.) | |
Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) | |
GetHashCode | Serves as the default hash function. (Inherited from Object.) | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) | |
RegisterBuildCallback |
Register a callback that will be invoked when the container (or lifetime scope) is built.
| |
RegisterCallback |
Register a callback that will be invoked when the container is configured.
| |
ToString | Returns a string that represents the current object. (Inherited from Object.) |
Name | Description | |
---|---|---|
OverrideActionFilterForTController | Overloaded.
Sets the provided registration to act as an IOverrideFilter for the specified controller.
(Defined by RegistrationExtensions.) | |
OverrideActionFilterForTController(ExpressionActionTController) | Overloaded.
Sets the provided registration to act as an IOverrideFilter for the specified controller action.
(Defined by RegistrationExtensions.) | |
OverrideAuthenticationFilterForTController | Overloaded.
Sets the provided registration to act as an IOverrideFilter for the specified controller.
(Defined by RegistrationExtensions.) | |
OverrideAuthenticationFilterForTController(ExpressionActionTController) | Overloaded.
Sets the provided registration to act as an IOverrideFilter for the specified controller action.
(Defined by RegistrationExtensions.) | |
OverrideAuthorizationFilterForTController | Overloaded.
Sets the provided registration to act as an IOverrideFilter for the specified controller.
(Defined by RegistrationExtensions.) | |
OverrideAuthorizationFilterForTController(ExpressionActionTController) | Overloaded.
Sets the provided registration to act as an IOverrideFilter for the specified controller action.
(Defined by RegistrationExtensions.) | |
OverrideExceptionFilterForTController | Overloaded.
Sets the provided registration to act as an IOverrideFilter for the specified controller.
(Defined by RegistrationExtensions.) | |
OverrideExceptionFilterForTController(ExpressionActionTController) | Overloaded.
Sets the provided registration to act as an IOverrideFilter for the specified controller action.
(Defined by RegistrationExtensions.) | |
OverrideResultFilterForTController | Overloaded.
Sets the provided registration to act as an IOverrideFilter for the specified controller.
(Defined by RegistrationExtensions.) | |
OverrideResultFilterForTController(ExpressionActionTController) | Overloaded.
Sets the provided registration to act as an IOverrideFilter for the specified controller action.
(Defined by RegistrationExtensions.) | |
OverrideWebApiActionFilterForTController | Overloaded.
Sets the provided registration to act as an IOverrideFilter for the specified controller.
(Defined by RegistrationExtensions.) | |
OverrideWebApiActionFilterForTController(ExpressionActionTController) | Overloaded.
Sets the provided registration to act as an IOverrideFilter for the specified controller action.
(Defined by RegistrationExtensions.) | |
OverrideWebApiAuthenticationFilterForTController | Overloaded.
Sets the provided registration to act as an IOverrideFilter for the specified controller.
(Defined by RegistrationExtensions.) | |
OverrideWebApiAuthenticationFilterForTController(ExpressionActionTController) | Overloaded.
Sets the provided registration to act as an IOverrideFilter for the specified controller action.
(Defined by RegistrationExtensions.) | |
OverrideWebApiAuthorizationFilterForTController | Overloaded.
Sets the provided registration to act as an IOverrideFilter for the specified controller.
(Defined by RegistrationExtensions.) | |
OverrideWebApiAuthorizationFilterForTController(ExpressionActionTController) | Overloaded.
Sets the provided registration to act as an IOverrideFilter for the specified controller action.
(Defined by RegistrationExtensions.) | |
OverrideWebApiExceptionFilterForTController | Overloaded.
Sets the provided registration to act as an IOverrideFilter for the specified controller.
(Defined by RegistrationExtensions.) | |
OverrideWebApiExceptionFilterForTController(ExpressionActionTController) | Overloaded.
Sets the provided registration to act as an IOverrideFilter for the specified controller action.
(Defined by RegistrationExtensions.) | |
Populate(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.) | |
Populate(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.) | |
RegisterT(FuncIComponentContext, T) | Overloaded.
Register a delegate as a component.
(Defined by RegistrationExtensions.) | |
RegisterT(FuncIComponentContext, IEnumerableParameter, T) | Overloaded.
Register a delegate as a component.
(Defined by RegistrationExtensions.) | |
RegisterActorTActor |
Registers an actor service with the container.
(Defined by AutofacActorExtensions.) | |
RegisterAdapterTFrom, TTo(FuncTFrom, TTo) | Overloaded.
Adapt all components implementing service TFrom
to provide TTo using the provided adapter
function.
(Defined by RegistrationExtensions.) | |
RegisterAdapterTFrom, TTo(FuncIComponentContext, IEnumerableParameter, TFrom, TTo) | Overloaded.
Adapt all components implementing service TFrom
to provide TTo using the provided adapter
function.
(Defined by RegistrationExtensions.) | |
RegisterAdapterTFrom, TTo(FuncIComponentContext, TFrom, TTo) | Overloaded.
Adapt all components implementing service TFrom
to provide TTo using the provided adapter
function.
(Defined by RegistrationExtensions.) | |
RegisterAggregateService(Type) | Overloaded.
Register interfaceType as an aggregate service.
(Defined by ContainerBuilderExtensions.) | |
RegisterAggregateServiceTInterface | Overloaded.
Register TInterface as an aggregate service.
(Defined by ContainerBuilderExtensions.) | |
RegisterApiControllers(Assembly) | Overloaded.
Register types in the provided assemblies that implement IHttpController and
match the default type name suffix of "Controller".
(Defined by RegistrationExtensions.) | |
RegisterApiControllers(String, Assembly) | Overloaded.
Register types in the provided assemblies that implement IHttpController and
match the provided type name suffix.
(Defined by RegistrationExtensions.) | |
RegisterAssemblyModules(Assembly) | Overloaded.
Registers modules found in an assembly.
(Defined by ModuleRegistrationExtensions.) | |
RegisterAssemblyModules(Type, Assembly) | Overloaded.
Registers modules found in an assembly.
(Defined by ModuleRegistrationExtensions.) | |
RegisterAssemblyModulesTModule(Assembly) | Overloaded.
Registers modules found in an assembly.
(Defined by ModuleRegistrationExtensions.) | |
RegisterAssemblyTypes |
Register all types in an assembly.
(Defined by RegistrationExtensions.) | |
RegisterComponent |
Add a component to the container.
(Defined by RegistrationExtensions.) | |
RegisterComposablePartCatalog(ComposablePartCatalog) | Overloaded.
Register a MEF catalog.
(Defined by RegistrationExtensions.) | |
RegisterComposablePartCatalog(ComposablePartCatalog, Service) | Overloaded.
Register a MEF catalog.
(Defined by RegistrationExtensions.) | |
RegisterComposablePartCatalog(ComposablePartCatalog, FuncExportDefinition, IEnumerableService) | Overloaded.
Register a MEF catalog.
(Defined by RegistrationExtensions.) | |
RegisterComposablePartDefinition |
Register a MEF part definition.
(Defined by RegistrationExtensions.) | |
RegisterComposablePartType(Type) | Overloaded.
Register a MEF-attributed type as a component.
(Defined by RegistrationExtensions.) | |
RegisterComposablePartType(Type, FuncExportDefinition, IEnumerableService) | Overloaded.
Register a MEF-attributed type as a component.
(Defined by RegistrationExtensions.) | |
RegisterComposite(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. | |
RegisterCompositeTService(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. | |
RegisterCompositeTService(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. | |
RegisterCompositeTComposite, TService | Overloaded. 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. | |
RegisterControllers |
Register types that implement IController in the provided assemblies.
(Defined by RegistrationExtensions.) | |
RegisterDecorator(Type, Type, FuncIDecoratorContext, Boolean) | Overloaded.
Decorate all components implementing service serviceType
with decorator service decoratorType.
(Defined by RegistrationExtensions.) | |
RegisterDecoratorTService(FuncIComponentContext, IEnumerableParameter, TService, TService, FuncIDecoratorContext, Boolean) | Overloaded.
Decorate all components implementing service TService
using the provided decorator function.
(Defined by RegistrationExtensions.) | |
RegisterDecoratorTService(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.) | |
RegisterDecoratorTService(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.) | |
RegisterDecoratorTService(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.) | |
RegisterDecoratorTDecorator, TService(FuncIDecoratorContext, Boolean) | Overloaded.
Decorate all components implementing service TService
with decorator service TDecorator.
(Defined by RegistrationExtensions.) | |
RegisterFilterProvider |
Registers the AutofacFilterProvider.
(Defined by RegistrationExtensions.) | |
RegisterGeneratedFactory(Type) | Overloaded.
Registers a factory delegate.
(Defined by RegistrationExtensions.) | |
RegisterGeneratedFactory(Type, Service) | Overloaded.
Registers a factory delegate.
(Defined by RegistrationExtensions.) | |
RegisterGeneratedFactoryTDelegate | Overloaded.
Registers a factory delegate.
(Defined by RegistrationExtensions.) | |
RegisterGeneratedFactoryTDelegate(Service) | Overloaded.
Registers a factory delegate.
(Defined by RegistrationExtensions.) | |
RegisterGeneric(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.) | |
RegisterGeneric(FuncIComponentContext, Type, Object) | Overloaded.
Register a delegate that can provide instances of an open generic registration.
(Defined by RegistrationExtensions.) | |
RegisterGeneric(FuncIComponentContext, Type, IEnumerableParameter, Object) | Overloaded.
Register a delegate that can provide instances of an open generic registration.
(Defined by RegistrationExtensions.) | |
RegisterGenericComposite | 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. | |
RegisterGenericDecorator(Type, Type, FuncIDecoratorContext, Boolean) | Overloaded.
Decorate all components implementing open generic service serviceType.
(Defined by RegistrationExtensions.) | |
RegisterGenericDecorator(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.) | |
RegisterHttpRequestMessage |
Makes the current HttpRequestMessage resolvable through the dependency scope.
(Defined by RegistrationExtensions.) | |
RegisterHubs |
Register types that implement IHub in the provided assemblies.
(Defined by RegistrationExtensions.) | |
RegisterInstanceT |
Register an instance as a component.
(Defined by RegistrationExtensions.) | |
RegisterMetadataRegistrationSources |
Registers the LazyWithMetadataRegistrationSource and
StronglyTypedMetadataRegistrationSource registration sources.
(Defined by RegistrationExtensions.) | |
RegisterMockTMocked |
Register a mock by explicitly providing a Mock instance for the service being mocked.
(Defined by MockRegistrationExtensions.) | |
RegisterModelBinderProvider |
Registers the AutofacModelBinderProvider.
(Defined by RegistrationExtensions.) | |
RegisterModelBinders |
Register types that implement IModelBinder in the provided assemblies
and have a ModelBinderTypeAttribute.
(Defined by RegistrationExtensions.) | |
RegisterModule(IModule) | Overloaded.
Add a module to the container.
(Defined by ModuleRegistrationExtensions.) | |
RegisterModuleTModule | Overloaded.
Add a module to the container.
(Defined by ModuleRegistrationExtensions.) | |
RegisterServiceFabricSupport |
Adds the core services required by the Service Fabric integration.
(Defined by RegistrationExtensions.) | |
RegisterServiceMiddleware(Type, IResolveMiddleware, MiddlewareInsertionMode) | Overloaded.
Register a resolve middleware for services providing a particular type.
(Defined by ServiceMiddlewareRegistrationExtensions.) | |
RegisterServiceMiddleware(Service, IResolveMiddleware, MiddlewareInsertionMode) | Overloaded.
Register a resolve middleware for a particular service.
(Defined by ServiceMiddlewareRegistrationExtensions.) | |
RegisterServiceMiddlewareTService(IResolveMiddleware, MiddlewareInsertionMode) | Overloaded.
Register a resolve middleware for services providing a particular type.
(Defined by ServiceMiddlewareRegistrationExtensions.) | |
RegisterServiceMiddlewareTService(PipelinePhase, ActionResolveRequestContext, ActionResolveRequestContext) | Overloaded.
Register a resolve middleware for services providing a particular type.
(Defined by ServiceMiddlewareRegistrationExtensions.) | |
RegisterServiceMiddlewareTService(String, PipelinePhase, ActionResolveRequestContext, ActionResolveRequestContext) | Overloaded.
Register a resolve middleware for services providing a particular type.
(Defined by ServiceMiddlewareRegistrationExtensions.) | |
RegisterServiceMiddlewareTService(String, PipelinePhase, MiddlewareInsertionMode, ActionResolveRequestContext, ActionResolveRequestContext) | Overloaded.
Register a resolve middleware for services providing a particular type.
(Defined by ServiceMiddlewareRegistrationExtensions.) | |
RegisterServiceMiddlewareSource |
Register a source of service middleware.
(Defined by ServiceMiddlewareRegistrationExtensions.) | |
RegisterSource(IRegistrationSource) | Overloaded.
Add a registration source to the container.
(Defined by SourceRegistrationExtensions.) | |
RegisterSourceTRegistrationSource | Overloaded.
Add a registration source to the container.
(Defined by SourceRegistrationExtensions.) | |
RegisterStatefulServiceTService |
Registers a stateful service with the container.
(Defined by AutofacServiceExtensions.) | |
RegisterStatelessServiceTService |
Registers a stateless service with the container.
(Defined by AutofacServiceExtensions.) | |
RegisterType(Type) | Overloaded.
Register a component to be created through reflection.
(Defined by RegistrationExtensions.) | |
RegisterTypeTImplementer | Overloaded.
Register a component to be created through reflection.
(Defined by RegistrationExtensions.) | |
RegisterTypes |
Register the types in a list.
(Defined by RegistrationExtensions.) | |
RegisterWebApiFilterProvider |
Registers the AutofacWebApiFilterProvider.
(Defined by RegistrationExtensions.) | |
RegisterWebApiModelBinderProvider |
Registers the AutofacWebApiModelBinderProvider.
(Defined by RegistrationExtensions.) | |
RegisterWebApiModelBinders |
Register types that implement IModelBinder in the provided assemblies.
(Defined by RegistrationExtensions.) |
var builder = new ContainerBuilder(); builder.RegisterType<Logger>() .As<ILogger>() .SingleInstance(); builder.Register(c => new MessageHandler(c.Resolve<ILogger>())); var container = builder.Build(); // resolve components from container...