Autofac .NET Inversion of Control Container
ContainerBuilder Class
NamespacesAutofacContainerBuilder
Used to build an IContainer from component registrations.
Declaration Syntax
C#Visual BasicVisual C++
public class ContainerBuilder
Public Class ContainerBuilder
public ref class ContainerBuilder
Members
All MembersConstructorsMethodsProperties



IconMemberDescription
ContainerBuilder()()()
Initializes a new instance of the ContainerBuilder class

Build()()()
Create a new container with the component registrations that have been made.

Equals(Object)
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
ExcludeDefaultModules
If set to true, standard container functionality like resolve-all, auto-generated factories and owned-instances will not be registered by this builder.

Finalize()()()
Allows an Object to attempt to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection.
(Inherited from Object.)
GetHashCode()()()
Serves as a hash function for a particular type.
(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.)
RegisterCallback(Action<(Of <(IComponentRegistry>)>))
Register a callback that will be invoked when the container is configured.

ToString()()()
Returns a String that represents the current Object.
(Inherited from Object.)
Remarks
Most ContainerBuilder functionality is accessed via extension methods in RegistrationExtensions.
Examples
CopyC#
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...
Inheritance Hierarchy
Object
ContainerBuilder
See Also

Assembly: Autofac (Module: Autofac) Version: 2.1.13.813 (2.1.13.813)