Autofac
Reflection activator data for concrete types.
Builder for reflection-based activators.
Specify a reflection activator for the given type.
Type that will be activated.
Get the implementation type.
The constructor finder for the registration.
The constructor selector for the registration.
The explicitly bound constructor parameters.
The explicitly bound properties.
Activator data that can provide an IInstanceActivator instance.
The instance activator based on the provided data.
Specify a reflection activator for the given type.
Type that will be activated.
The instance activator based on the provided data.
Data structure used to construct registrations.
The most specific type to which instances of the registration
can be cast.
Activator builder type.
Registration style type.
Configure the component so that instances are never disposed by the container.
A registration builder allowing further configuration of the component.
Configure the component so that instances that support IDisposable are
disposed by the container (default.)
A registration builder allowing further configuration of the component.
Configure the component so that every dependent component or call to Resolve()
gets a new, unique instance (default.)
A registration builder allowing further configuration of the component.
Configure the component so that every dependent component or call to Resolve()
gets the same, shared instance.
A registration builder allowing further configuration of the component.
Configure the component so that every dependent component or call to Resolve()
within a single ILifetimeScope gets the same, shared instance. Dependent components in
different lifetime scopes will get different instances.
A registration builder allowing further configuration of the component.
Configure the component so that every dependent component or call to Resolve()
within a ILifetimeScope tagged with the provided tag value gets the same, shared instance.
Dependent components in lifetime scopes that are children of the tagged scope will
share the parent's instance. If no appropriately tagged scope can be found in the
hierarchy an is thrown.
Tag applied to matching lifetime scopes.
A registration builder allowing further configuration of the component.
Configure the services that the component will provide. The generic parameter(s) to As()
will be exposed as TypedService instances.
Service type.
A registration builder allowing further configuration of the component.
Configure the services that the component will provide. The generic parameter(s) to As()
will be exposed as TypedService instances.
Service type.
Service type.
A registration builder allowing further configuration of the component.
Configure the services that the component will provide. The generic parameter(s) to As()
will be exposed as TypedService instances.
Service type.
Service type.
Service type.
A registration builder allowing further configuration of the component.
Configure the services that the component will provide.
Service types to expose.
A registration builder allowing further configuration of the component.
Configure the services that the component will provide.
Services to expose.
A registration builder allowing further configuration of the component.
Provide a textual name that can be used to retrieve the component.
Named service to associate with the component.
The service type provided by the component.
A registration builder allowing further configuration of the component.
Provide a textual name that can be used to retrieve the component.
Named service to associate with the component.
The service type provided by the component.
A registration builder allowing further configuration of the component.
Provide a key that can be used to retrieve the component.
Key to associate with the component.
The service type provided by the component.
A registration builder allowing further configuration of the component.
Provide a key that can be used to retrieve the component.
Key to associate with the component.
The service type provided by the component.
A registration builder allowing further configuration of the component.
Add a handler for the Preparing event. This event allows manipulating of the parameters
that will be provided to the component.
The event handler.
A registration builder allowing further configuration of the component.
Add a handler for the Activating event.
The event handler.
A registration builder allowing further configuration of the component.
Add a handler for the Activated event.
The event handler.
A registration builder allowing further configuration of the component.
Configure the component so that any properties whose types are registered in the
container will be wired to instances of the appropriate service.
A registration builder allowing further configuration of the component.
Configure the component so that any properties whose types are registered in the
container will be wired to instances of the appropriate service.
If set to true, the properties won't be wired until
after the component has been activated. This allows property-property and constructor-property
circularities in the dependency graph.
A registration builder allowing further configuration of the component.
Associates data with the component.
Key by which the data can be located.
The data value.
A registration builder allowing further configuration of the component.
Associates data with the component.
The extended properties to associate with the component.
A registration builder allowing further configuration of the component.
Associates data with the component.
A type with properties whose names correspond to the
property names to configure.
A registration builder allowing further configuration of the component.
The activator data.
The registration style.
The registration data.
Used with the WithMetadata configuration method to
associate key-value pairs with an .
Interface with properties whose names correspond to
the property keys.
This feature was suggested by OJ Reeves (@TheColonial).
Set one of the property values.
The type of the property.
An expression that accesses the property to set.
The property value to set.
Static factory methods to simplify the creation and handling of IRegistrationBuilder{L,A,R}.
To create an for a specific type, use:
var rb = IRegistrationBuilder.ForType(t).Named("foo").ExternallyOwned();
var cr = IRegistrationBuilder.CreateRegistration(rb);
Creates a registration builder for the provided delegate.
Instance type returned by delegate.
Delegate to register.
A registration builder.
Creates a registration builder for the provided delegate.
Delegate to register.
Most specific type return value of delegate can be cast to.
A registration builder.
Creates a registration builder for the provided type.
Implementation type to register.
A registration builder.
Creates a registration builder for the provided type.
Implementation type to register.
A registration builder.
Create an from a .
(There is no need to call
this method when registering components through a .)
When called on the result of one of the methods,
the returned registration will be different from the one the builder itself registers
in the container.
var registration = IRegistrationBuilder.ForType<Foo>().CreateRegistration();
The registration builder.
An IComponentRegistration.
Create an IComponentRegistration from data.
Id of the registration.
Registration data.
Activator.
Services provided by the registration.
An IComponentRegistration.
Create an IComponentRegistration from data.
Id of the registration.
Registration data.
Activator.
Services provided by the registration.
Optional; target registration.
An IComponentRegistration.
Register a component in the component registry. This helper method is necessary
in order to execute OnRegistered hooks and respect PreserveDefaults.
Hoping to refactor this out.
Component registry to make registration in.
Registration builder with data for new registration.
A strongly-typed resource class, for looking up localized strings, etc.
Returns the cached ResourceManager instance used by this class.
Overrides the current thread's CurrentUICulture property for all
resource lookups using this strongly typed resource class.
Looks up a localized string similar to The type '{0}' is not assignable to service '{1}'..
Adds registration syntax for less commonly-used features.
These features are in this namespace because they will remain accessible to
applications originally written against Autofac 1.4. In Autofac 2, this functionality
is implicitly provided and thus making explicit registrations is rarely necessary.
Registers a factory delegate.
Container builder.
Factory type to generate.
Registration builder allowing the registration to be configured.
Factory delegates are provided automatically in Autofac 2,
and this method is generally not required.
Registers a factory delegate.
Container builder.
Factory type to generate.
The service that the delegate will return instances of.
Registration builder allowing the registration to be configured.
Factory delegates are provided automatically in Autofac 2, and
this method is generally not required.
Registers a factory delegate.
The type of the delegate.
Container builder.
The service that the delegate will return instances of.
Registration builder allowing the registration to be configured.
Factory delegates are provided automatically in Autofac 2,
and this method is generally not required.
Registers a factory delegate.
The type of the delegate.
Container builder.
Registration builder allowing the registration to be configured.
Factory delegates are provided automatically in Autofac 2,
and this method is generally not required.
Changes the parameter mapping mode of the supplied delegate type to match
parameters by name.
Factory delegate type
Activator data type
Registration style
Registration to change parameter mapping mode of.
Registration builder allowing the registration to be configured.
Changes the parameter mapping mode of the supplied delegate type to match
parameters by position.
Factory delegate type
Activator data type
Registration style
Registration to change parameter mapping mode of.
Registration builder allowing the registration to be configured.
Changes the parameter mapping mode of the supplied delegate type to match
parameters by type.
Factory delegate type
Activator data type
Registration style
Registration to change parameter mapping mode of.
Registration builder allowing the registration to be configured.
Registers the type as a collection. If no services or names are specified, the
default services will be IList<T>, ICollection<T>, and IEnumerable<T>
The type of the collection elements.
Container builder.
A unique name for the collection that can be passed to MemberOf().
Registration builder allowing the registration to be configured.
Collections are provided automatically in Autofac 2,
and this method is generally not required.
Registers the type as a collection. If no services or names are specified, the
default services will be IList<T>, ICollection<T>, and IEnumerable<T>
The type of the collection elements.
Container builder.
A unique name for the collection that can be passed to MemberOf().
Registration builder allowing the registration to be configured.
Collections are provided automatically in Autofac 2,
and this method is generally not required.
Include the element explicitly in a collection configured using RegisterCollection.
Registration limit type.
Registration style.
Activator data type.
Registration to export.
The collection name, as passed to RegisterCollection.
A registration builder allowing further configuration of the component.
A strongly-typed resource class, for looking up localized strings, etc.
Returns the cached ResourceManager instance used by this class.
Overrides the current thread's CurrentUICulture property for all
resource lookups using this strongly typed resource class.
Looks up a localized string similar to A delegate registered to create instances of '{0}' returned null..
A strongly-typed resource class, for looking up localized strings, etc.
Returns the cached ResourceManager instance used by this class.
Overrides the current thread's CurrentUICulture property for all
resource lookups using this strongly typed resource class.
Looks up a localized string similar to Bound constructor '{0}'..
Looks up a localized string similar to Constructor '{0}' parameter resolution failed at parameter '{1}'..
Provides parameters that have a default value, set with an optional parameter
declaration in C# or VB.
Used in order to provide a value to a constructor parameter or property on an instance
being created by the container.
Not all parameters can be applied to all sites.
Returns true if the parameter is able to provide a value to a particular site.
Constructor, method, or property-mutator parameter.
The component context in which the value is being provided.
If the result is true, the valueProvider parameter will
be set to a function that will lazily retrieve the parameter value. If the result is false,
will be set to null.
True if a value can be supplied; otherwise, false.
Returns true if the parameter is able to provide a value to a particular site.
Constructor, method, or property-mutator parameter.
The component context in which the value is being provided.
If the result is true, the valueProvider parameter will
be set to a function that will lazily retrieve the parameter value. If the result is false,
will be set to null.
True if a value can be supplied; otherwise, false.
Fired when the activation process for a new instance is complete.
The context in which the activation occurred.
The component providing the instance.
The paramters provided when resolved.
The instance that will be used to satisfy the request.
Fired after the construction of an instance but before that instance
is shared with any other or any members are invoked on it.
The instance can be replaced if needed, e.g. by an interface proxy.
The object to use instead of the activated instance.
The context in which the activation occurred.
The component providing the instance.
The instance that will be used to satisfy the request.
The parameters supplied to the activator.
Interface supported by services that carry type information.
Return a new service of the same kind, but carrying
as the .
The new service type.
A new service with the service type.
Gets the type of the service.
The type of the service.
Identifies a service using a key in addition to its type.
Services are the lookup keys used to locate component instances.
Returns a that represents the current .
A that represents the current .
Implements the operator ==.
The LHS.
The RHS.
The result of the operator.
Implements the operator !=.
The LHS.
The RHS.
The result of the operator.
Determines whether the specified is equal to the current .
The to compare with the current .
true if the specified is equal to the current ; otherwise, false.
The parameter is null.
Serves as a hash function for a particular type.
A hash code for the current .
Gets a human-readable description of the service.
The description.
Initializes a new instance of the class.
Key of the service.
Type of the service.
Determines whether the specified is equal to the current .
The to compare with the current .
true if the specified is equal to the current ; otherwise, false.
The parameter is null.
Serves as a hash function for a particular type.
A hash code for the current .
Return a new service of the same kind, but carrying
as the .
The new service type.
A new service with the service type.
Gets or sets the key of the service.
The key of the service.
Gets the type of the service.
The type of the service.
Gets a human-readable description of the service.
The description.
A strongly-typed resource class, for looking up localized strings, etc.
Returns the cached ResourceManager instance used by this class.
Overrides the current thread's CurrentUICulture property for all
resource lookups using this strongly typed resource class.
Looks up a localized string similar to Activator = {0}, Services = [{1}], Lifetime = {2}, Sharing = {3}, Ownership = {4}.
Pulls registrations from another component registry.
Excludes most auto-generated registrations - currently has issues with
collection registrations.
Allows registrations to be made on-the-fly when unregistered
services are requested (lazy registrations.)
Retrieve registrations for an unregistered service, to be used
by the container.
The service that was requested.
A function that will return existing registrations for a service.
Registrations providing the service.
Create an external registry source that draws components from
.
Component registry to pull registrations from.
Retrieve registrations for an unregistered service, to be used
by the container.
The service that was requested.
A function that will return existing registrations for a service.
Registrations providing the service.
Internal implementation of the RegisterCollection/MemberOf-style collection feature.
Registration style for dynamic registrations.
Data used to create factory activators.
Create a new GeneratedFactoryActivatorData
The type of the factory.
The service used to provide the products of the factory.
Determines how the parameters of the delegate type are passed on
to the generated Resolve() call as Parameter objects.
For Func-based delegates, this defaults to ByType. Otherwise, the
parameters will be mapped by name.
Activator data that can provide an IInstanceActivator instance.
Generates activators in an IRegistrationSource.
Data associated with the specific kind of activator.
Given a requested service and registration data, attempt to generate an
activator for the service.
Service that was requested.
Services associated with the activator generator.
Data specific to this kind of activator.
Resulting activator.
Services provided by the activator.
True if an activator could be generated.
Hides standard Object members to make fluent interfaces
easier to read.
Based on blog post by @kzu here:
http://www.clariusconsulting.net/blogs/kzu/archive/2008/03/10/58301.aspx
Standard System.Object member.
Standard result.
Standard System.Object member.
Standard result.
Standard System.Object member.
Standard result.
Standard System.Object member.
The other.
Standard result.
Determines how the parameters of the delegate type are passed on
to the generated Resolve() call as Parameter objects.
Chooses parameter mapping based on the factory type.
For Func-based factories this is equivalent to ByType, for all
others ByName will be used.
Pass the parameters supplied to the delegate through to the
underlying registration as NamedParameters based on the parameter
names in the delegate type's formal argument list.
Pass the parameters supplied to the delegate through to the
underlying registration as TypedParameters based on the parameter
types in the delegate type's formal argument list.
Pass the parameters supplied to the delegate through to the
underlying registration as PositionalParameters based on the parameter
indices in the delegate type's formal argument list.
Provides components by lookup operations via an index (key) type.
The type of the index.
The service provided by the indexed components.
Retrieving a value given a key:
IIndex<AccountType, IRenderer> accountRenderers = // ...
var renderer = accountRenderers[AccountType.User];
Get the value associated with if any is available.
The key to look up.
The retrieved value.
True if a value associated with the key exists.
Get the value associated with .
The value to retrieve.
The associated value.
Support the
types automatically whenever type T is registered with the container.
Metadata values come from the component registration's metadata.
Provides a value along with a dictionary of metadata describing the value.
The type of the value.
Create a new instance.
The value described by the instance.
The metadata describing the value.
The value described by .
Metadata describing the value.
Provides registrations on-the-fly for any concrete type not already registered with
the container.
Initializes a new instance of the class.
Initializes a new instance of the class.
A predicate that selects types the source will register.
Retrieve registrations for an unregistered service, to be used
by the container.
The service that was requested.
A function that will return existing registrations for a service.
Registrations providing the service.
Activation data for types located by scanning assemblies.
Create an instance of .
The filters applied to the types from the scanned assembly.
Additional actions to be performed on the concrete type registrations.
Fired when the activation process for a new instance is complete.
Initializes a new instance of the class.
The context.
The component.
The parameters.
The instance.
The context in which the activation occurred.
The component providing the instance.
The paramters provided when resolved.
The instance that will be used to satisfy the request.
Fired after the construction of an instance but before that instance
is shared with any other or any members are invoked on it.
Initializes a new instance of the class.
The context.
The component.
The parameters.
The instance.
The instance can be replaced if needed, e.g. by an interface proxy.
The object to use instead of the activated instance.
The context in which the activation occurred.
The component providing the instance.
The instance that will be used to satisfy the request.
The instance can be replaced if needed, e.g. by an interface proxy.
The parameters supplied to the activator.
Activate instances using a delegate.
Base class for instance activators.
Base class for disposable objects.
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Releases unmanaged and - optionally - managed resources
true to release both managed and unmanaged resources; false to release only unmanaged resources.
Create an instance activator that will return instances compatible
with .
Most derived type to which instances can be cast.
Gets a string representation of the activator.
A string describing the activator.
The most specific type that the component instances are known to be castable to.
Activates component instances.
Activate an instance in the provided context.
Context in which to activate instances.
Parameters to the instance.
The activated instance.
The context parameter here should probably be ILifetimeScope in order to reveal Disposer,
but will wait until implementing a concrete use case to make the decision
The most specific type that the component instances are known to be castable to.
Create a delegate activator.
The most specific type to which activated instances can be cast.
Activation delegate.
Activate an instance in the provided context.
Context in which to activate instances.
Parameters to the instance.
The activated instance.
The context parameter here should probably be ILifetimeScope in order to reveal Disposer,
but will wait until implementing a concrete use case to make the decision
Provides a pre-constructed instance.
Provide the specified instance.
The instance to provide.
Activate an instance in the provided context.
Context in which to activate instances.
Parameters to the instance.
The activated instance.
The context parameter here should probably be ILifetimeScope in order to reveal Disposer,
but will wait until implementing a concrete use case to make the decision
Releases unmanaged and - optionally - managed resources
true to release both managed and unmanaged resources; false to release only unmanaged resources.
Determines whether the activator disposes the instance that it holds.
Necessary because otherwise instances that are never resolved will never be
disposed.
A strongly-typed resource class, for looking up localized strings, etc.
Returns the cached ResourceManager instance used by this class.
Overrides the current thread's CurrentUICulture property for all
resource lookups using this strongly typed resource class.
Looks up a localized string similar to The provided instance has already been used in an activation request. Did you combine a provided instance with non-root/single-instance lifetime/sharing?.
Supplies values based on the target parameter type.
Returns true if the parameter is able to provide a value to a particular site.
Constructor, method, or property-mutator parameter.
The component context in which the value is being provided.
If the result is true, the valueProvider parameter will
be set to a function that will lazily retrieve the parameter value. If the result is false,
will be set to null.
True if a value can be supplied; otherwise, false.
Finds constructors based on their binding flags.
Find suitable constructors from which to select.
Finds suitable constructors on the target type.
Type to search for constructors.
Suitable constructors.
Create an instance matching constructors with the supplied binding flags.
Binding flags to match.
Finds suitable constructors on the target type.
Type to search for constructors.
Suitable constructors.
Binds a constructor to the parameters that will be used when it is invoked.
Construct a new ConstructorParameterBinding.
ConstructorInfo to bind.
Available parameters.
Context in which to construct instance.
Invoke the constructor with the parameter bindings.
The constructed instance.
Returns a System.String that represents the current System.Object.
A System.String that represents the current System.Object.
The constructor on the target type. The actual constructor used
might differ, e.g. if using a dynamic proxy.
True if the binding is valid.
Describes the constructor parameter binding.
Selects the best constructor from a set of available constructors.
Selects the best constructor from the available constructors.
Available constructors.
The best constructor.
Selects a constructor based on its signature.
Match constructors with the provided signature.
Signature to match.
Selects the best constructor from the available constructors.
Available constructors.
The best constructor.
A strongly-typed resource class, for looking up localized strings, etc.
Returns the cached ResourceManager instance used by this class.
Overrides the current thread's CurrentUICulture property for all
resource lookups using this strongly typed resource class.
Looks up a localized string similar to The required constructor is unavailable..
Looks up a localized string similar to More than one constructor matches the selection policy..
Selects the constructor with the most parameters.
Selects the best constructor from the available constructors.
Available constructors.
The best constructor.
Uses reflection to activate instances of a type.
Create an activator for the provided type.
Type to activate.
Constructor finder.
Constructor selector.
Parameters configured explicitly for this instance.
Properties configured explicitly for this instance.
Activate an instance in the provided context.
Context in which to activate instances.
Parameters to the instance.
The activated instance.
The context parameter here should probably be ILifetimeScope in order to reveal Disposer,
but will wait until implementing a concrete use case to make the decision
The constructor finder.
The constructor selector.
A strongly-typed resource class, for looking up localized strings, etc.
Returns the cached ResourceManager instance used by this class.
Overrides the current thread's CurrentUICulture property for all
resource lookups using this strongly typed resource class.
Looks up a localized string similar to No constructors matching the constructor-finding policy can be found on the target type..
Looks up a localized string similar to None of the constructors found with policy '{0}' on type '{1}' can be invoked with the available services and parameters:{2}.
Base class for parameters that provide a constant value.
Create a constant parameter that will apply to parameters matching
the supplied predicate.
Returns true if the parameter is able to provide a value to a particular site.
Constructor, method, or property-mutator parameter.
The component context in which the value is being provided.
If the result is true, the valueProvider parameter will
be set to a function that will lazily retrieve the parameter value. If the result is false,
will be set to null.
True if a value can be supplied; otherwise, false.
The value of the parameter.
Standard container implementation.
Creates, wires dependencies and manages lifetime for a set of components.
Most instances of are created
by a .
// See ContainerBuilder for the definition of the builder variable
using (var container = builder.Build())
{
var program = container.Resolve<Program>();
program.Run();
}
Most functionality is provided by extension methods
on the inherited interface.
An tracks the instantiation of component instances.
It defines a boundary in which instances are shared and configured.
Disposing an will dispose the components that were
resolved through it.
// See IContainer for definition of the container variable
using (var requestScope = container.BeginLifetimeScope())
{
// Note that handler is resolved from requestScope, not
// from the container:
var handler = requestScope.Resolve<IRequestHandler>();
handler.Handle(request);
// When requestScope is disposed, all resources used in processing
// the request will be released.
}
All long-running applications should resolve components via an
. Choosing the duration of the lifetime is application-
specific. The standard Autofac WCF and ASP.NET/MVC integrations are already configured
to create and release s as appropriate. For example, the
ASP.NET integration will create and release an per HTTP
request.
Most functionality is provided by extension methods
on the inherited interface.
The context in which a service can be accessed or a component's
dependencies resolved. Disposal of a context will dispose any owned
components.
Resolve an instance of the provided registration within the context.
The registration.
Parameters for the instance.
The component instance.
Associates services with the components that provide them.
Begin a new nested scope. Component instances created via the new scope
will be disposed along with it.
A new lifetime scope.
Begin a new nested scope. Component instances created via the new scope
will be disposed along with it.
The tag applied to the .
A new lifetime scope.
Begin a new nested scope, with additional components available to it.
Component instances created via the new scope
will be disposed along with it.
The components registered in the sub-scope will be treated as though they were
registered in the root scope, i.e., SingleInstance() components will live as long
as the root scope.
Action on a
that adds component registations visible only in the new scope.
A new lifetime scope.
Begin a new nested scope, with additional components available to it.
Component instances created via the new scope
will be disposed along with it.
The components registered in the sub-scope will be treated as though they were
registered in the root scope, i.e., SingleInstance() components will live as long
as the root scope.
The tag applied to the .
Action on a
that adds component registations visible only in the new scope.
A new lifetime scope.
The disposer associated with this .
Component instances can be associated with it manually if required.
Typical usage does not require interaction with this member- it
is used when extending the container.
The tag applied to the .
Tags allow a level in the lifetime hierarchy to be identified.
In most applications, tags are not necessary.
An empty container.
Create a new container.
Begin a new sub-scope. Instances created via the sub-scope
will be disposed along with it.
A new lifetime scope.
Begin a new sub-scope. Instances created via the sub-scope
will be disposed along with it.
The tag applied to the .
A new lifetime scope.
Begin a new nested scope, with additional components available to it.
Component instances created via the new scope
will be disposed along with it.
Action on a
that adds component registations visible only in the new scope.
A new lifetime scope.
Begin a new nested scope, with additional components available to it.
Component instances created via the new scope
will be disposed along with it.
The tag applied to the .
Action on a
that adds component registations visible only in the new scope.
A new lifetime scope.
Resolve an instance of the provided registration within the context.
The registration.
Parameters for the instance.
The component instance.
Releases unmanaged and - optionally - managed resources
true to release both managed and unmanaged resources; false to release only unmanaged resources.
Gets the service object of the specified type.
An object that specifies the type of service object
to get.
A service object of type .-or- null if there is
no service object of type .
The disposer associated with this container. Instances can be associated
with it manually if required.
Tag applied to the lifetime scope.
The tag applied to this scope and the contexts generated when
it resolves component dependencies.
Associates services with the components that provide them.
Problem resolving dependencies, e.g. circular references, no callable constructor etc.
Initializes a new instance of the class.
Initializes a new instance of the class.
The message.
Initializes a new instance of the class.
The message.
The inner exception.
Initializes a new instance of the class.
The that holds the serialized object data about the exception being thrown.
The that contains contextual information about the source or destination.
The parameter is null.
The class name is null or is zero (0).
A strongly-typed resource class, for looking up localized strings, etc.
Returns the cached ResourceManager instance used by this class.
Overrides the current thread's CurrentUICulture property for all
resource lookups using this strongly typed resource class.
Looks up a localized string similar to A required component could not be created..
Maintains a set of objects to dispose, and disposes them in the reverse order
from which they were added when the Disposer is itself disposed.
Provided on an object that will dispose of other objects when it is
itself disposed.
Adds an object to the disposer. When the disposer is
disposed, so will the object be.
The instance.
Contents all implement IDisposable.
Releases unmanaged and - optionally - managed resources
true to release both managed and unmanaged resources; false to release only unmanaged resources.
Adds an object to the disposer. When the disposer is
disposed, so will the object be.
The instance.
Locates the lifetime to which instances of a component should be attached.
Given the most nested scope visible within the resolve operation, find
the scope for the component.
The most nested visible scope.
The scope for the component.
Describes a logical component within the container.
Called by the container when an instance is required.
The context in which the instance will be activated.
Parameters for activation. These may be modified by the event handler.
Called by the container once an instance has been constructed.
The context in which the instance was activated.
The parameters supplied to the activator.
The instance.
Called by the container once an instance has been fully constructed, including
any requested objects that depend on the instance.
The context in which the instance was activated.
The parameters supplied to the activator.
The instance.
A unique identifier for this component (shared in all sub-contexts.)
This value also appears in Services.
The activator used to create instances.
The lifetime associated with the component.
Whether the component instances are shared or not.
Whether the instances of the component should be disposed by the container.
The services provided by the component.
Additional data associated with the component.
The component registration upon which this registration is based.
Fired when a new instance is required. The instance can be
provided in order to skip the regular activator, by setting the Instance property in
the provided event arguments.
Fired when a new instance is being activated. The instance can be
wrapped or switched at this time by setting the Instance property in
the provided event arguments.
Fired when the activation process for a new instance is complete.
Provides component registrations according to the services they provide.
Attempts to find a default registration for the specified service.
The service to look up.
The default registration for the service.
True if a registration exists.
Determines whether the specified service is registered.
The service to test.
True if the service is registered.
Register a component.
The component registration.
Register a component.
The component registration.
If true, existing defaults for the services provided by the
component will not be changed.
Selects from the available registrations after ensuring that any
dynamic registration sources that may provide
have been invoked.
The service for which registrations are sought.
Registrations supporting .
Add a registration source that will provide registrations on-the-fly.
Enumerate the registered components.
Fired whenever a component is registered - either explicitly or via a
.
Represents a set of components and related functionality
packaged together.
Apply the module to the component registry.
Component registry to apply configuration to.
Determines when instances supporting IDisposable are disposed.
The lifetime scope does not dispose the instances.
The instances are disposed when the lifetime scope is disposed.
Determines whether instances are shared within a lifetime scope.
Each request for an instance will return a new object.
Each request for an instance will return the same object.
Defines a nested structure of lifetimes.
Try to retrieve an instance based on a GUID key. If the instance
does not exist, invoke to create it.
Key to look up.
Creation function.
An instance.
The root of the sharing hierarchy.
The parent of this node of the hierarchy, or null.
Attaches the instance's lifetime to the current lifetime scope.
Given the most nested scope visible within the resolve operation, find
the scope for the component.
The most nested visible scope.
The scope for the component.
Lifetime scope implementation.
Protects instance variables from concurrent access.
The tag applied by default to nested scopes when no other tag is specified.
The tag applied to root scopes when no other tag is specified.
Create a lifetime scope for the provided components and nested beneath a parent.
The tag applied to the .
Components used in the scope.
Parent scope.
Create a root lifetime scope for the provided components.
The tag applied to the .
Components used in the scope.
Create a root lifetime scope for the provided components.
Components used in the scope.
Begin a new anonymous sub-scope. Instances created via the sub-scope
will be disposed along with it.
A new lifetime scope.
Begin a new tagged sub-scope. Instances created via the sub-scope
will be disposed along with it.
The tag applied to the .
A new lifetime scope.
Begin a new anonymous sub-scope, with additional components available to it.
Component instances created via the new scope
will be disposed along with it.
Action on a
that adds component registations visible only in the new scope.
A new lifetime scope.
IContainer cr = // ...
using (var lifetime = cr.BeginLifetimeScope(builder => {
builder.RegisterType<Foo>();
builder.RegisterType<Bar>().As<IBar>(); })
{
var foo = lifetime.Resolve<Foo>();
}
Begin a new tagged sub-scope, with additional components available to it.
Component instances created via the new scope
will be disposed along with it.
The tag applied to the .
Action on a
that adds component registations visible only in the new scope.
A new lifetime scope.
IContainer cr = // ...
using (var lifetime = cr.BeginLifetimeScope("unitOfWork", builder => {
builder.RegisterType<Foo>();
builder.RegisterType<Bar>().As<IBar>(); })
{
var foo = lifetime.Resolve<Foo>();
}
Resolve an instance of the provided registration within the context.
The registration.
Parameters for the instance.
The component instance.
Try to retrieve an instance based on a GUID key. If the instance
does not exist, invoke to create it.
Key to look up.
Creation function.
An instance.
Releases unmanaged and - optionally - managed resources
true to release both managed and unmanaged resources; false to release only unmanaged resources.
Gets the service object of the specified type.
An object that specifies the type of service object
to get.
A service object of type .-or- null if there is
no service object of type .
The parent of this node of the hierarchy, or null.
The root of the sharing hierarchy.
The disposer associated with this container. Instances can be associated
with it manually if required.
Tag applied to the lifetime scope.
The tag applied to this scope and the contexts generated when
it resolves component dependencies.
Associates services with the components that provide them.
Attaches the component's lifetime to scopes matching a supplied expression.
Match scopes based on the provided expression.
Expression describing scopes that will match.
Given the most nested scope visible within the resolve operation, find
the scope for the component.
The most nested visible scope.
The scope for the component.
A strongly-typed resource class, for looking up localized strings, etc.
Returns the cached ResourceManager instance used by this class.
Overrides the current thread's CurrentUICulture property for all
resource lookups using this strongly typed resource class.
Looks up a localized string similar to No scope matching the expression '{0}' is visible from the scope in which the instance was requested..
Attaches the component's lifetime to the root scope.
Given the most nested scope visible within the resolve operation, find
the scope for the component.
The most nested visible scope.
The scope for the component.
A property identified by name. When applied to a reflection-based
component, the name will be matched against property names.
Create a with the specified constant value.
The name of the property.
The property value.
The name of the property.
Identifies a service using a textual name in addition to its type.
Initializes a new instance of the class.
Name of the service.
Type of the service.
Determines whether the specified is equal to the current .
The to compare with the current .
true if the specified is equal to the current ; otherwise, false.
The parameter is null.
Serves as a hash function for a particular type.
A hash code for the current .
Return a new service of the same kind, but carrying
as the .
The new service type.
A new service with the service type.
Gets or sets the name of the service.
The name of the service.
Gets the type of the service.
The type of the service.
Gets a human-readable description of the service.
The description.
Fired before the activation process to allow parameters to be changed or an alternative
instance to be provided.
Initializes a new instance of the class.
The context.
The component.
The parameters.
The context in which the activation is occurring.
The component providing the instance being activated.
The parameters supplied to the activator.
A service was requested that cannot be provided
by the container.
Initializes a new instance of the class.
Initializes a new instance of the class.
The service.
Initializes a new instance of the class.
The service.
The inner exception.
Initializes a new instance of the class.
The that holds the serialized object data about the exception being thrown.
The that contains contextual information about the source or destination.
The parameter is null.
The class name is null or is zero (0).
A strongly-typed resource class, for looking up localized strings, etc.
Returns the cached ResourceManager instance used by this class.
Overrides the current thread's CurrentUICulture property for all
resource lookups using this strongly typed resource class.
Looks up a localized string similar to The requested service '{0}' has not been registered..
Information about the ocurrence of a component being registered
with a container.
Create a new instance with a valid container and component registration.
The container into which the registration
was made.
The component registration.
The container into which the registration was made.
The component registration.
Describes a logical component within the container.
Create a new component registration.
Unique identifier for the component.
Activator used to activate instances.
Determines how the component will be associated with its lifetime.
Whether the component is shared within its lifetime scope.
Whether the component instances are disposed at the end of their lifetimes.
Services the component provides.
Data associated with the component.
Create a new component registration.
Unique identifier for the component.
Activator used to activate instances.
Determines how the component will be associated with its lifetime.
Whether the component is shared within its lifetime scope.
Whether the component instances are disposed at the end of their lifetimes.
Services the component provides.
Data associated with the component.
The component registration upon which this registration is based.
Called by the container when an instance is required.
The context in which the instance will be activated.
Parameters for activation.
Called by the container once an instance has been constructed.
The context in which the instance was activated.
The parameters supplied to the activator.
The instance.
Called by the container once an instance has been fully constructed, including
any requested objects that depend on the instance.
The context in which the instance was activated.
The parameters supplied to the activator.
The instance.
Describes the component in a human-readable form.
A description of the component.
Releases unmanaged and - optionally - managed resources
true to release both managed and unmanaged resources; false to release only unmanaged resources.
The component registration upon which this registration is based.
If this registration was created directly by the user, returns this.
A unique identifier for this component (shared in all sub-contexts.)
This value also appears in Services.
The activator used to create instances.
The lifetime associated with the component.
Whether the component instances are shared or not.
Whether the instances of the component should be disposed by the container.
The services provided by the component.
Additional data associated with the component.
Fired when a new instance is required. The instance can be
provided in order to skip the regular activator, by setting the Instance property in
the provided event arguments.
Fired when a new instance is being activated. The instance can be
wrapped or switched at this time by setting the Instance property in
the provided event arguments.
Fired when the activation process for a new instance is complete.
Provides component registrations according to the services they provide.
Protects instance variables from concurrent access.
External registration sources.
All registrations.
Keeps track of the status of registered services.
Releases unmanaged and - optionally - managed resources
true to release both managed and unmanaged resources; false to release only unmanaged resources.
Attempts to find a default registration for the specified service.
The service to look up.
The default registration for the service.
True if a registration exists.
Determines whether the specified service is registered.
The service to test.
True if the service is registered.
Register a component.
The component registration.
Register a component.
The component registration.
If true, existing defaults for the services provided by the
component will not be changed.
Selects from the available registrations after ensuring that any
dynamic registration sources that may provide
have been invoked.
The service for which registrations are sought.
Registrations supporting .
Add a registration source that will provide registrations on-the-fly.
Enumerate the registered components.
Fired whenever a component is registered - either explicitly or via a
.
Tracks the services known to the registry.
Initializes a new instance of the class.
The tracked service.
The first time a service is requested, initialization (e.g. reading from sources)
happens. This value will then be set to true. Calling many methods on this type before
initialisation is an error.
The known implementations.
True if any implementations are known.
Used for bookkeeping so that the same source is not queried twice (may be null.)
Catch circular dependencies that are triggered by post-resolve processing (e.g. 'OnActivated')
A strongly-typed resource class, for looking up localized strings, etc.
Returns the cached ResourceManager instance used by this class.
Overrides the current thread's CurrentUICulture property for all
resource lookups using this strongly typed resource class.
Looks up a localized string similar to Circular component dependency detected: {0}..
Looks up a localized string similar to Probable circular dependency between factory-scoped components. Chain includes '{0}'.
A strongly-typed resource class, for looking up localized strings, etc.
Returns the cached ResourceManager instance used by this class.
Overrides the current thread's CurrentUICulture property for all
resource lookups using this strongly typed resource class.
Looks up a localized string similar to Probable circular dependency between factory-scoped components. Chain includes '{0}'.
Identifies a service according to a type to which it can be assigned.
Initializes a new instance of the class.
Type of the service.
Determines whether the specified is equal to the current .
The to compare with the current .
true if the specified is equal to the current ; otherwise, false.
The parameter is null.
Serves as a hash function for a particular type.
A hash code for the current .
Return a new service of the same kind, but carrying
as the .
The new service type.
A new service with the service type.
Gets the type of the service.
The type of the service.
Gets a human-readable description of the service.
The description.
A handy unique service identifier type - all instances will be regarded as unequal.
Initializes a new instance of the class.
Initializes a new instance of the class.
The id.
Determines whether the specified is equal to the current .
The to compare with the current .
true if the specified is equal to the current ; otherwise, false.
The parameter is null.
Serves as a hash function for a particular type.
A hash code for the current .
Provides a programmer-readable description of the identifying feature of the service.
Retrieve registrations for an unregistered service, to be used
by the container.
The service that was requested.
A function that will return existing registrations for a service.
Registrations providing the service.
Retrieve registrations for an unregistered service, to be used
by the container.
The service that was requested.
A function that will return existing registrations for a service.
Registrations providing the service.
Generates context-bound closures that represent factories from
a set of heuristics based on delegate type signatures.
Create a factory generator.
The service that will be activated in
order to create the products of the factory.
The delegate to provide as a factory.
The parameter mapping mode to use.
Create a factory generator.
The component that will be activated in
order to create the products of the factory.
The delegate to provide as a factory.
The parameter mapping mode to use.
Generates a factory delegate that closes over the provided context.
The context in which the factory will be used.
Parameters provided to the resolve call for the factory itself.
A factory delegate that will work within the context.
Generates a factory delegate that closes over the provided context.
The context in which the factory will be used.
Parameters provided to the resolve call for the factory itself.
A factory delegate that will work within the context.
Generates activators for open generic types.
Given a requested service and registration data, attempt to generate an
activator for the service.
Service that was requested.
Services associated with the activator generator.
Data specific to this kind of activator.
Resulting activator.
Services provided by the activator.
True if an activator could be generated.
Represents a dependency that can be released by the dependent component.
The service provided by the dependency.
Autofac automatically provides instances of whenever the
service is registered.
It is not necessary for , or the underlying component, to implement .
Disposing of the object is the correct way to handle cleanup of the dependency,
as this will dispose of any other components created indirectly as well.
When is resolved, a new is created for the
underlying , and tagged with the service matching ,
generally a . This means that shared instances can be tied to this
scope by registering them as InstancePerMatchingLifetimeScope(new TypedService(typeof(T))).
The component D below is disposable and implements IService:
public class D : IService, IDisposable
{
// ...
}
The dependent component C can dispose of the D instance whenever required by taking a dependency on
:
public class C
{
IService _service;
public C(Owned<IService> service)
{
_service = service;
}
void DoWork()
{
_service.Value.DoSomething();
}
void OnFinished()
{
_service.Dispose();
}
}
In general, rather than depending on directly, components will depend on
System.Func<Owned<T>> in order to create and dispose of other components as required.
Create an instance of .
The value representing the instance.
An IDisposable interface through which ownership can be released.
Releases unmanaged and - optionally - managed resources
true to release both managed and unmanaged resources; false to release only unmanaged resources.
The owned value.
Generates registrations for services of type whenever the service
T is available.
Retrieve registrations for an unregistered service, to be used
by the container.
The service that was requested.
A function that will return existing registrations for a service.
Registrations providing the service.
Determines whether the candidate type supports any base or interface that closes the
provided generic service type.
The type that is being checked for the interface.
The open generic type to locate.
True if an interface was found; otherwise false.
Returns the first concrete interface supported by the candidate type that
closes the provided open generic service type.
The type that is being checked for the interface.
The open generic type to locate.
The type of the interface.
Looks for an interface on the candidate type that closes the provided open generic interface type.
The type that is being checked for the interface.
The open generic service type to locate.
True if a closed implementation was found; otherwise false.
A strongly-typed resource class, for looking up localized strings, etc.
Returns the cached ResourceManager instance used by this class.
Overrides the current thread's CurrentUICulture property for all
resource lookups using this strongly typed resource class.
Looks up a localized string similar to The type '{0}' is not an open generic class or interface type..
Base class for user-defined modules. Modules can add a set of releated components
to a container () or attach cross-cutting functionality
to other components (.
Modules are given special support in the XML configuration feature - see
http://code.google.com/p/autofac/wiki/StructuringWithModules.
Provides a user-friendly way to implement
via .
Defining a module:
public class DataAccessModule : Module
{
public string ConnectionString { get; set; }
public override void Load(ContainerBuilder moduleBuilder)
{
moduleBuilder.RegisterGeneric(typeof(MyRepository<>))
.As(typeof(IRepository<>))
.InstancePerMatchingLifetimeScope(WebLifetime.Request);
moduleBuilder.Register(c => new MyDbConnection(ConnectionString))
.As<IDbConnection>()
.InstancePerMatchingLifetimeScope(WebLifetime.Request);
}
}
Using the module:
var builder = new ContainerBuilder();
builder.RegisterModule(new DataAccessModule { ConnectionString = "..." });
var container = builder.Build();
var customers = container.Resolve<IRepository<Customer>>();
Apply the module to the component registry.
Component registry to apply configuration to.
Override to add registrations to the container.
Note that the ContainerBuilder parameter is unique to this module.
The builder through which components can be
registered.
Override to attach module-specific functionality to a
component registration.
This method will be called for all existing and future component
registrations - ordering is not important.
The component registry.
The registration to attach functionality to.
Data structure used to construct registrations.
The most specific type to which instances of the registration
can be cast.
Activator builder type.
Registration style type.
Create a IRegistrationBuilder.
Activator builder.
Registration style.
Configure the component so that instances are never disposed by the container.
A registration builder allowing further configuration of the component.
Configure the component so that instances that support IDisposable are
disposed by the container (default.)
A registration builder allowing further configuration of the component.
Configure the component so that every dependent component or call to Resolve()
gets a new, unique instance (default.)
A registration builder allowing further configuration of the component.
Configure the component so that every dependent component or call to Resolve()
gets the same, shared instance.
A registration builder allowing further configuration of the component.
Configure the component so that every dependent component or call to Resolve()
within a single ILifetimeScope gets the same, shared instance. Dependent components in
different lifetime scopes will get different instances.
A registration builder allowing further configuration of the component.
Configure the component so that every dependent component or call to Resolve()
within a ILifetimeScope tagged with the provided tag value gets the same, shared instance.
Dependent components in lifetime scopes that are children of the tagged scope will
share the parent's instance. If no appropriately tagged scope can be found in the
hierarchy an is thrown.
Tag applied to matching lifetime scopes.
A registration builder allowing further configuration of the component.
Configure the services that the component will provide. The generic parameter(s) to As()
will be exposed as TypedService instances.
Service type.
A registration builder allowing further configuration of the component.
Configure the services that the component will provide. The generic parameter(s) to As()
will be exposed as TypedService instances.
Service type.
Service type.
A registration builder allowing further configuration of the component.
Configure the services that the component will provide. The generic parameter(s) to As()
will be exposed as TypedService instances.
Service type.
Service type.
Service type.
A registration builder allowing further configuration of the component.
Configure the services that the component will provide.
Service types to expose.
A registration builder allowing further configuration of the component.
Configure the services that the component will provide.
Services to expose.
A registration builder allowing further configuration of the component.
Provide a textual name that can be used to retrieve the component.
Named service to associate with the component.
The service type provided by the component.
A registration builder allowing further configuration of the component.
Provide a textual name that can be used to retrieve the component.
Named service to associate with the component.
The service type provided by the component.
A registration builder allowing further configuration of the component.
Provide a key that can be used to retrieve the component.
Key to associate with the component.
The service type provided by the component.
A registration builder allowing further configuration of the component.
Provide a key that can be used to retrieve the component.
Key to associate with the component.
The service type provided by the component.
A registration builder allowing further configuration of the component.
Add a handler for the Preparing event. This event allows manipulating of the parameters
that will be provided to the component.
The event handler.
A registration builder allowing further configuration of the component.
Add a handler for the Activating event.
The event handler.
A registration builder allowing further configuration of the component.
Add a handler for the Activated event.
The event handler.
A registration builder allowing further configuration of the component.
Configure the component so that any properties whose types are registered in the
container will be wired to instances of the appropriate service.
A registration builder allowing further configuration of the component.
Configure the component so that any properties whose types are registered in the
container will be wired to instances of the appropriate service.
If set to true, the properties won't be wired until
after the component has been activated. This allows property-property and constructor-property
circularities in the dependency graph.
A registration builder allowing further configuration of the component.
Associates data with the component.
Key by which the data can be located.
The data value.
A registration builder allowing further configuration of the component.
Associates data with the component.
The extended properties to associate with the component.
A registration builder allowing further configuration of the component.
Associates data with the component.
A type with properties whose names correspond to the
property names to configure.
A registration builder allowing further configuration of the component.
The activator data.
The registration style.
The registration data.
Data common to all registrations made in the container, both direct (IComponentRegistration)
and dynamic (IRegistrationSource.)
Copies from.
The that.
The services explicitly assigned to the component.
If set to true, the "default" service for this registration will not
be applied.
The instance ownership assigned to the component.
The lifetime assigned to the component.
The sharing mode assigned to the component.
Extended properties assigned to the component.
Handlers for the Preparing event.
Handlers for the Activating event.
Handlers for the Activated event.
Adds registration syntax to the type.
Add a module to the container.
The builder to register the module with.
The module to add.
Add a module to the container.
The builder to register the module with.
The module to add.
Add a component to the container.
The builder to register the component with.
The component to add.
Add a registration source to the container.
The builder to register the registration source via.
The registration source to add.
Register an instance as a component.
The type of the instance.
Container builder.
The instance to register.
Registration builder allowing the registration to be configured.
If no services are explicitly specified for the instance, the
static type will be used as the default service (i.e. *not* instance.GetType()
).
Register a component to be created through reflection.
The type of the component implementation.
Container builder.
Registration builder allowing the registration to be configured.
Register a component to be created through reflection.
The type of the component implementation.
Container builder.
Registration builder allowing the registration to be configured.
Register a delegate as a component.
The type of the instance.
Container builder.
The delegate to register.
Registration builder allowing the registration to be configured.
Register a delegate as a component.
The type of the instance.
Container builder.
The delegate to register.
Registration builder allowing the registration to be configured.
Register an un-parameterised generic type, e.g. Repository<>.
Concrete types will be made as they are requested, e.g. with Resolve<Repository<int>>().
Container builder.
The open generic implementation type.
Registration builder allowing the registration to be configured.
Specifies that the component being registered should only be made the default for services
that have not already been registered.
Registration limit type.
Registration style.
Activator data type.
Registration to set service mapping on.
Registration builder allowing the registration to be configured.
Register the types in an assembly.
Container builder.
The assemblies from which to register types.
Registration builder allowing the registration to be configured.
Specifies a subset of types to register from a scanned assembly.
Registration limit type.
Registration style.
Activator data type.
Registration to filter types from.
Predicate that returns true for types to register.
Registration builder allowing the registration to be configured.
Specifies how a type from a scanned assembly is mapped to a service.
Registration limit type.
Registration style.
Activator data type.
Registration to set service mapping on.
Function mapping types to services.
Registration builder allowing the registration to be configured.
Specifies how a type from a scanned assembly is mapped to a service.
Registration limit type.
Registration style.
Activator data type.
Registration to set service mapping on.
Function mapping types to services.
Registration builder allowing the registration to be configured.
Specifies how a type from a scanned assembly is mapped to a service.
Registration limit type.
Registration style.
Activator data type.
Registration to set service mapping on.
Function mapping types to services.
Registration builder allowing the registration to be configured.
Specifies that a type from a scanned assembly provides its own concrete type as a service.
Registration limit type.
Registration style.
Activator data type.
Registration to set service mapping on.
Registration builder allowing the registration to be configured.
Specify how a type from a scanned assembly provides metadata.
Registration limit type.
Registration style.
Activator data type.
Registration to set service mapping on.
A function mapping the type to a list of metadata items.
Registration builder allowing the registration to be configured.
Specify how a type from a scanned assembly provides metadata.
Registration limit type.
Registration style.
Activator data type.
Registration to set service mapping on.
Key of the metadata item.
A function retrieving the value of the item from the component type.
Registration builder allowing the registration to be configured.
Specifies how a type from a scanned assembly is mapped to a service.
Registration limit type.
Registration style.
Activator data type.
Registration to set service mapping on.
Service type provided by the component.
Function mapping types to service names.
Registration builder allowing the registration to be configured.
Specifies that a type from a scanned assembly is registered as providing all of its
implemented interfaces.
Registration limit type.
Registration style.
Activator data type.
Registration to set service mapping on.
Registration builder allowing the registration to be configured.
Set the policy used to find candidate constructors on the implementation type.
Registration limit type.
Activator data type.
Registration style.
Registration to set policy on.
Binding flags used when searching for constructors.
A registration builder allowing further configuration of the component.
Set the policy used to find candidate constructors on the implementation type.
Registration limit type.
Activator data type.
Registration style.
Registration to set policy on.
Policy to be used when searching for constructors.
A registration builder allowing further configuration of the component.
Set the policy used to select from available constructors on the implementation type.
Registration limit type.
Activator data type.
Registration style.
Registration to set policy on.
Constructor signature to match.
A registration builder allowing further configuration of the component.
Set the policy used to select from available constructors on the implementation type.
Registration limit type.
Registration style.
Activator data type.
Registration to set policy on.
Policy to be used when selecting a constructor.
A registration builder allowing further configuration of the component.
Configure an explicit value for a constructor parameter.
Registration limit type.
Registration style.
Activator data type.
Registration to set parameter on.
Name of a constructor parameter on the target type.
Value to supply to the parameter.
A registration builder allowing further configuration of the component.
Configure an explicit value for a constructor parameter.
Registration limit type.
Registration style.
Activator data type.
Registration to set parameter on.
The parameter to supply to the constructor.
A registration builder allowing further configuration of the component.
Configure explicit values for constructor parameters.
Registration limit type.
Registration style.
Activator data type.
Registration to set parameter on.
The parameters to supply to the constructor.
A registration builder allowing further configuration of the component.
Configure an explicit value for a property.
Registration limit type.
Registration style.
Activator data type.
Registration to set property on.
Name of a property on the target type.
Value to supply to the property.
A registration builder allowing further configuration of the component.
Configure an explicit value for a property.
Registration limit type.
Registration style.
Activator data type.
Registration to set parameter on.
The property to supply.
A registration builder allowing further configuration of the component.
Configure explicit values for properties.
Registration limit type.
Registration style.
Activator data type.
Registration to set parameter on.
The properties to supply.
A registration builder allowing further configuration of the component.
Sets the target of the registration (used for metadata generation.)
The type of the limit.
The type of the activator data.
Registration style
Registration to set target for.
The target.
Registration builder allowing the registration to be configured.
Provide a handler to be called when the component is registered.
Registration limit type.
Registration style.
Activator data type.
Registration add handler to.
The handler.
Registration builder allowing the registration to be configured.
Provide a handler to be called when the component is registred.
Registration limit type.
Registration style.
Registration add handler to.
The handler.
Registration builder allowing the registration to be configured.
Specifies that a type from a scanned assembly is registered if it implements an interface
that closes the provided open generic interface type.
Registration limit type.
Registration style.
Activator data type.
Registration to set service mapping on.
The open generic interface or base class type for which implementations will be found.
Registration builder allowing the registration to be configured.
Filters the scanned types to include only those assignable to the provided
type.
Registration limit type.
Registration style.
Activator data type.
Registration to filter types from.
The type or interface which all classes must be assignable from.
Registration builder allowing the registration to be configured.
Filters the scanned types to include only those assignable to the provided
type.
Registration to filter types from.
The type or interface which all classes must be assignable from.
Registration builder allowing the registration to be configured.
Filters the scanned types to exclude the provided type.
Registration to filter types from.
The concrete type to exclude.
Registration builder allowing the registration to be configured.
Filters the scanned types to include only those in the namespace of the provided type
or one of its sub-namespaces.
Registration to filter types from.
A type in the target namespace.
Registration builder allowing the registration to be configured.
Filters the scanned types to include only those in the provided namespace
or one of its sub-namespaces.
Registration limit type.
Registration style.
Activator data type.
Registration to filter types from.
The namespace from which types will be selected.
Registration builder allowing the registration to be configured.
A strongly-typed resource class, for looking up localized strings, etc.
Returns the cached ResourceManager instance used by this class.
Overrides the current thread's CurrentUICulture property for all
resource lookups using this strongly typed resource class.
Looks up a localized string similar to The instance registration '{0}' can support SingleInstance() sharing only..
Looks up a localized string similar to No matching constructor exists on type '{0}'..
Registration source based on a registration builder.
LimitType for the registration.
Type of activator data.
Registration style.
Try to generate registrations using the provided activator generator, with
the data from the provided registration.
Registration data.
Activator generator.
Retrieve registrations for an unregistered service, to be used
by the container.
The service that was requested.
A function that will return existing registrations for a service.
Registrations providing the service.
An activator builder with no parameters.
Return the provided activator.
The activator to return.
Gets the activator.
Registration style for individual components.
Create a new SingleRegistrationStyle.
The type that will be used as the default service if
no other services are configured.
The id used for the registration.
Handlers to notify of the component registration event.
By default, new registrations override existing registrations as defaults.
If set to true, new registrations will not change existing defaults.
The component upon which this registration is based.
The type that will be used as the default service if
no other services are configured.
Used to build an from component registrations.
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...
Most functionality is accessed
via extension methods in .
Register a callback that will be invoked when the container is configured.
This is primarily for extending the builder syntax.
Callback to execute.
Create a new container with the component registrations that have been made.
Build can only be called once per
- this prevents ownership issues for provided instances.
A new container with the configured component registrations.
Configure an existing component registry with the component registrations
that have been made.
Build can only be called once per
- this prevents ownership issues for provided instances.
An existing component registry to make the registrations in.
If set to true, standard container functionality like resolve-all, auto-generated
factories and owned-instances will not be registered by this builder.
A parameter identified by name. When applied to a reflection-based
component, will be matched against
the name of the component's constructor arguments. When applied to
a delegate-based component, the parameter can be accessed using
.
Component with parameter:
public class MyComponent
{
public MyComponent(int amount) { ... }
}
Providing the parameter:
var builder = new ContainerBuilder();
builder.RegisterType<MyComponent>();
var container = builder.Build();
var myComponent = container.Resolve<MyComponent>(new NamedParameter("amount", 123));
Create a with the specified constant value.
The name of the parameter.
The parameter value.
The name of the parameter.
Extension methods that simplify extraction of parameter values from
an where T is .
Each method returns the first matching parameter value, or throws an exception if
none is provided.
At configuration time, delegate registrations can retrieve parameter values using
the methods , and :
builder.Register((c, p) => new FtpClient(p.Named<string>("server")));
These parameters can be provided at resolution time:
container.Resolve<FtpClient>(new NamedParameter("server", "ftp.example.com"));
Alternatively, the parameters can be provided via a Generated Factory - http://code.google.com/p/autofac/wiki/DelegateFactories.
Retrieve a named parameter value from a instance.
The type to which the returned value will be cast.
The available parameters to choose from.
The name of the parameter to select.
The value of the selected parameter.
Retrieve a positional parameter value from a instance.
The type to which the returned value will be cast.
The available parameters to choose from.
The zero-based position of the parameter to select.
The value of the selected parameter.
The position value is the one associated with the parameter when
it was constructed, not its index into the
sequence.
Retrieve a typed parameter value from a instance.
The type to which the returned value will be cast.
The available parameters to choose from.
The value of the selected parameter.
A parameter that is identified according to an integer representing its
position in an argument list. When applied to a reflection-based
component, will be matched against
the indices of the component's constructor arguments. When applied to
a delegate-based component, the parameter can be accessed using
.
Component with parameter:
public class MyComponent
{
public MyComponent(int amount) { ... }
}
Providing the parameter:
var builder = new ContainerBuilder();
builder.RegisterType<MyComponent>();
var container = builder.Build();
var myComponent = container.Resolve<MyComponent>(new PositionalParameter(0, 123));
Construct a positional parameter with the specified constant value.
The zero-based position of the parameter.
The parameter value.
The zero-based position of the parameter.
Adds syntactic convenience methods to the interface.
Set any properties on that can be
resolved in the context.
Type of instance. Used only to provide method chaining.
The context from which to resolve the service.
The instance to inject properties into.
.
Set any null-valued properties on that can be
resolved by the container.
Type of instance. Used only to provide method chaining.
The context from which to resolve the service.
The instance to inject properties into.
.
Retrieve a service from the context.
The type to which the result will be cast.
The context from which to resolve the service.
Identity of the registration providing the service.
The component instance that provides the service.
Retrieve a service from the context.
The type to which the result will be cast.
The context from which to resolve the service.
Identity of the registration providing the service.
The parameters.
The component instance that provides the service.
Retrieve a service from the context.
The type to which the result will be cast.
The context from which to resolve the service.
Identity of the registration providing the service.
The parameters.
The component instance that provides the service.
Retrieve a service from the context.
The type to which the result will be cast.
The context from which to resolve the service.
Name of the service.
The component instance that provides the service.
Retrieve a service from the context.
The type to which the result will be cast.
The context from which to resolve the service.
Name of the service.
The parameters.
The component instance that provides the service.
Retrieve a service from the context.
The type to which the result will be cast.
The context from which to resolve the service.
Name of the service.
The parameters.
The component instance that provides the service.
Retrieve a service from the context.
The service to retrieve.
The context from which to resolve the service.
The component instance that provides the service.
Retrieve a service from the context.
The type to which the result will be cast.
The context from which to resolve the service.
Parameters for the service.
The component instance that provides the service.
Retrieve a service from the context.
The type to which the result will be cast.
The context from which to resolve the service.
Parameters for the service.
The component instance that provides the service.
Retrieve a service from the context.
The context from which to resolve the service.
The service type.
The component instance that provides the service.
Retrieve a service from the context.
The context from which to resolve the service.
Parameters for the service.
The service type.
The component instance that provides the service.
Retrieve a service from the context.
The context from which to resolve the service.
Parameters for the service.
The service type.
The component instance that provides the service.
Retrieve a service from the context.
The context from which to resolve the service.
The service name.
Type of the service.
The component instance that provides the service.
Retrieve a service from the context.
The context from which to resolve the service.
Parameters for the service.
The service name.
Type of the service.
The component instance that provides the service.
Retrieve a service from the context.
The context from which to resolve the service.
Parameters for the service.
The service name.
Type of the service.
The component instance that provides the service.
Retrieve a service from the context.
The context from which to resolve the service.
The service to resolve.
The component instance that provides the service.
Retrieve a service from the context.
The context from which to resolve the service.
Parameters for the service.
The service to resolve.
The component instance that provides the service.
Retrieve a service from the context.
The context from which to resolve the service.
Parameters for the service.
The service to resolve.
The component instance that provides the service.
Retrieve a service from the context, or null if the service is not
registered.
The context from which to resolve the service.
The service to resolve.
The component instance that provides the service, or null.
Retrieve a service from the context, or null if the service is not
registered.
The context from which to resolve the service.
Parameters for the service.
The service to resolve.
The component instance that provides the service, or null.
Retrieve a service from the context, or null if the service is not
registered.
The context from which to resolve the service.
Parameters for the service.
The service to resolve.
The component instance that provides the service, or null.
Retrieve a service from the context, or null if the service is not
registered.
The context from which to resolve the service.
The name of the service.
The service to resolve.
The component instance that provides the service, or null.
Retrieve a service from the context, or null if the service is not
registered.
The context from which to resolve the service.
Parameters for the service.
The name of the service.
The service to resolve.
The component instance that provides the service, or null.
Retrieve a service from the context, or null if the service is not
registered.
The context from which to resolve the service.
Parameters for the service.
The name of the service.
The service to resolve.
The component instance that provides the service, or null.
Retrieve a service from the context, or null if the service is not
registered.
The context from which to resolve the service.
The type of the service.
The component instance that provides the service, or null.
Retrieve a service from the context, or null if the service is not
registered.
The context from which to resolve the service.
Parameters for the service.
The type of the service.
The component instance that provides the service, or null.
Retrieve a service from the context, or null if the service is not
registered.
The context from which to resolve the service.
Parameters for the service.
The type of the service.
The component instance that provides the service, or null.
Retrieve a service from the context, or null if the service is not
registered.
The context from which to resolve the service.
The service.
The component instance that provides the service, or null.
Retrieve a service from the context, or null if the service is not
registered.
The context from which to resolve the service.
The service.
Parameters for the service.
The component instance that provides the service, or null.
Retrieve a service from the context, or null if the service is not
registered.
The context from which to resolve the service.
The service.
Parameters for the service.
The component instance that provides the service, or null.
Determine whether the specified service is available in the context.
The context from which to resolve the service.
The service to test for the registration of.
True if the service is registered.
Determine whether the specified service is available in the context.
The context from which to resolve the service.
The service to test for the registration of.
True if the service is registered.
Determine whether the specified service is available in the context.
The context from which to resolve the service.
The name of the service to test for the registration of.
Type type of the service to test for the registration of.
True if the service is registered.
Determine whether the specified service is available in the context.
The context from which to resolve the service.
The name of the service to test for the registration of.
Type type of the service to test for the registration of.
True if the service is registered.
Determine whether the specified service is available in the context.
The context from which to resolve the service.
The service to test for the registration of.
True if the service is registered.
Try to retrieve a service from the context.
The context from which to resolve the service.
The service to resolve.
The resulting component instance providing the service, or null.
The parameters.
True if a component providing the service is available.
Try to retrieve a service from the context.
The context from which to resolve the service.
The service to resolve.
The resulting component instance providing the service, or null.
True if a component providing the service is available.
Try to retrieve a service from the context.
The context from which to resolve the service.
The service type to resolve.
The resulting component instance providing the service, or null.
True if a component providing the service is available.
Try to retrieve a service from the context.
The context from which to resolve the service.
The name of the service to resolve.
The type of the service to resolve.
The resulting component instance providing the service, or null.
True if a component providing the service is available.
Flexible parameter type allows arbitrary values to be retrieved
from the resolution context.
Create an instance of the ResolvedParameter class.
A predicate that determines which parameters on a constructor will be supplied by this instance.
A function that supplies the parameter value given the context.
Returns true if the parameter is able to provide a value to a particular site.
Constructor, method, or property-mutator parameter.
The component context in which the value is being provided.
If the result is true, the valueProvider parameter will
be set to a function that will lazily retrieve the parameter value. If the result is false,
will be set to null.
True if a value can be supplied; otherwise, false.
A parameter that can supply values to sites that exactly
match a specified type. When applied to a reflection-based
component, will be matched against
the types of the component's constructor arguments. When applied to
a delegate-based component, the parameter can be accessed using
.
Component with parameter:
public class MyComponent
{
public MyComponent(int amount) { ... }
}
Providing the parameter:
var builder = new ContainerBuilder();
builder.RegisterType<MyComponent>();
var container = builder.Build();
var myComponent = container.Resolve<MyComponent>(new TypedParameter(typeof(int), 123));
Create a typed parameter with the specified constant value.
The exact type to match.
The parameter value.
Shortcut for creating
by using the
type to be used for the parameter
The parameter value.
new typed parameter
The type against which targets are matched.
Helper methods used throughout the codebase.
Enforce that an argument is not null. Returns the
value if valid so that it can be used inline in
base initialiser syntax.
Enforce that sequence does not contain null. Returns the
value if valid so that it can be used inline in
base initialiser syntax.
The value.
The name.
Enforces that the provided object is non-null.
The value.
Enforce that an argument is not null or empty. Returns the
value if valid so that it can be used inline in
base initialiser syntax.
The value.
The description.
Enforce that the argument is a delegate type.
The type to test.
A strongly-typed resource class, for looking up localized strings, etc.
Returns the cached ResourceManager instance used by this class.
Overrides the current thread's CurrentUICulture property for all
resource lookups using this strongly typed resource class.
Looks up a localized string similar to The argument '{0}' cannot be empty..
Looks up a localized string similar to The object of type '{0}' cannot be null..
Looks up a localized string similar to Type {0} returns void..
Looks up a localized string similar to The sequence provided as argument '{0}' cannot contain null elements..
Looks up a localized string similar to Type {0} is not a delegate type..
Extension methods for reflection-related types.
Maps from a property-set-value parameter to the declaring property.
Parameter to the property setter.
The property info on which the setter is specified.
True if the parameter is a property setter.
Get a PropertyInfo object from an expression of the form
x => x.P.
Type declaring the property.
The type of the property.
Expression mapping an instance of the
declaring type to the property value.
Property info.
A strongly-typed resource class, for looking up localized strings, etc.
Returns the cached ResourceManager instance used by this class.
Overrides the current thread's CurrentUICulture property for all
resource lookups using this strongly typed resource class.
Looks up a localized string similar to The provided expression must be of the form x =>x.P, but the provided expression was {0}..
Joins the strings into one single string interspersing the elements with the separator (a-la
System.String.Join()).
The elements.
The separator.
The joined string.
Appends the item to the specified sequence.
The sequence.
The trailing item.
Prepends the item to the specified sequence.
The sequence.
The leading item.