Autofac.Configuration
Type converter used for converting assembly name strings to assembly and back.
This type is used in configuration settings where an assembly name is provided and needs to be
handled on the back end as a strongly-typed, loaded assembly rather than a string.
Converts an assembly name into an assembly.
The configuration context.
The configuration culture.
The assembly name to parse.
If is , empty, or whitespace this conversion
will return . Otherwise, the assembly specified by the
will be loaded and returned.
Converts an assembly into an assembly name.
The configuration context.
The configuration culture.
The assembly to convert.
The destination type to which the assembly should be converted. (Ignored for configuration converters.)
If is this conversion returns ;
otherwise the return value will be the full name of the assembly.
Thrown if is not and is not an .
Element describing a component registration.
Gets the type of the component.
The type.
Gets the service exposed by the component. For multiple-service components,
use the services element instead.
The service.
Allows the component to be added to another composite component.
The name of the composite component.
Allows the component to be added to another composite component.
The name of the composite component.
Sets the scope of the component instances.
singleton (default,) factory or container.
Sets the ownership over the component instances.
container (default) or external.
Sets up property injection for the component instances. This uses the
OnActivated event so that circular dependencies can be handled.
never (default,) all, unset.
Gets the services exposed by the component.
The services.
Gets the parameters used to construct the component.
The parameters.
Gets the properties to be explicitly set on the component.
The explicit properties.
Gets the extended properties associated with the registration.
The extended properties.
A collection of component elements.
A collection of configuration elements.
The type of the element type.
Initializes a new instance of the class.
Name of the element.
Indicates whether the specified exists in the .
The name of the element to verify.
true if the element exists in the collection; otherwise, false. The default is false.
Returns an enumerator that iterates through the collection.
A that can be used to iterate through the collection.
When overridden in a derived class, creates a new .
A new .
Gets the element key for a specified configuration element when overridden in a derived class.
The to return the key for.
An that acts as the key for the specified .
Gets the name used to identify this collection of elements in the configuration file when overridden in a derived class.
The name of the collection; otherwise, an empty string. The default is an empty string.
Gets the type of the .
The of this collection.
Initializes a new instance of the class.
Base class for a configuration parsing/execution module.
Derived module classes are responsible for reading in configuration settings and populating
the property. The
value there will be used in to
convert the configuration into container registrations.
Executes the conversion of configuration data into component registrations.
The into which registrations will be placed.
This override uses the
to convert the
into component registrations in the provided .
If no specific
is set, the default type will be used.
Thrown if is .
Thrown if the is .
Gets or sets the configuration registrar.
An that will be used as the
strategy for converting the
into component registrations. If this value is , the registrar
will be a .
Gets the section handler.
The that will be converted into
component registrations in a container.
Default service for adding configured registrations to a container.
This default implementation of
processes contents into registrations into
a . You may derive and override to extend the functionality
or you may implement your own .
A service for adding configured registrations to a container.
Registers the contents of a configuration section into a container builder.
The that should receive the configured registrations.
The containing the configured registrations.
Registers the contents of a configuration section into a container builder.
The that should receive the configured registrations.
The containing the configured registrations.
Thrown if or is .
This method is the primary entry point to configuration section registration. From here,
the various modules, components, and referenced files get registered. You may override
any of those behaviors for a custom registrar if you wish to extend registration behavior.
Registers individual configured components into a container builder.
The that should receive the configured registrations.
The containing the configured registrations.
Thrown if or is .
Thrown if there is any issue in parsing the component configuration into registrations.
This is where the individually configured component registrations get added to the .
The collection from the
get processed into individual registrations with associated lifetime scope, name, etc.
You may influence the process by overriding this whole method or by overriding these individual
parsing subroutines:
-
-
-
Registers individual configured modules into a container builder.
The that should receive the configured registrations.
The containing the configured registrations.
Thrown if or is .
Thrown if there is any issue in parsing the module configuration into registrations.
This is where the individually configured component registrations get added to the .
The collection from the
get processed into individual modules which are instantiated and activated inside the .
Registers referenced configuration files into a container builder.
The that should receive the configured registrations.
The containing the configured registrations.
Thrown if or is .
Thrown if there is any issue in processing the referenced files into registrations.
This is where external files referenced in configuration get recursively loaded and added to the .
The collection from the
get processed into individual instances, each of which get
registered with the .
Sets the property injection mode for the component.
The component registration on which property injection mode is being set.
The configuration value associated with property
injection for this component registration.
By default, this implementation understands , empty,
or values (false, 0, no)
to mean "no property injection should occur" and
values (true, 1, yes) to mean "property injection
should occur."
You may override this method to extend the available grammar for property injection settings.
Thrown if is .
Thrown if the value for is not part of the
recognized grammar.
Sets the ownership model for the component.
The component registration on which the ownership model is being set.
The configuration value associated with the
ownership model for this component registration.
By default, this implementation understands or empty
values to be "default ownership model"; lifetime-scope or LifetimeScope
is "owned by lifetime scope"; and external or ExternallyOwned is
"externally owned."
You may override this method to extend the available grammar for component ownership.
Thrown if is .
Thrown if the value for is not part of the
recognized grammar.
Sets the lifetime scope for the component.
The component registration on which the lifetime scope is being set.
The configuration value associated with the
lifetime scope for this component registration.
By default, this implementation understands or empty
values to be "default ownership model"; single-instance or SingleInstance
is singleton; instance-per-lifetime-scope, InstancePerLifetimeScope, per-lifetime-scope,
or PerLifetimeScope is one instance per nested lifetime scope; and instance-per-dependency,
InstancePerDependency, per-dependency, or PerDependency is
one instance for each resolution call.
You may override this method to extend the available grammar for lifetime scope.
Thrown if is .
Thrown if the value for is not part of the
recognized grammar.
Loads a type by name.
Name of the to load. This may be a partial type name or a fully-qualified type name.
The default to use in type resolution if
is a partial type name.
The resolved based on the specified name.
Thrown if is .
Thrown if is empty.
Thrown if the specified can't be resolved as a fully-qualified type name and
isn't a partial type name for a found in the .
Configures containers based upon app.config/web.config settings.
This module type uses standard .NET application configuration format files to initialize configuration
settings. By default the standard app.config/web.config is used with a configuration
section named autofac, but you can use the various constructors to override the file location
or configuration section name.
If you are storing your configuration settings in a raw XML file (without the additional
<configuration /> wrapper and section definitions you normally see in .NET application
configuration) you can use the module to specify
the XML file location directly.
Initializes a new instance of the class
using the default application configuration file with a configuration section named autofac.
Initializes a new instance of the class
using the default application configuration file and a named section.
The name of the configuration section corresponding to a .
Initializes a new instance of the class
using a named configuration file and section.
The name of the configuration section corresponding to a .
The app.config/web.config format configuration file containing the
named section.
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 {0} may not be empty..
Looks up a localized string similar to Unable to find specified configuration file..
Looks up a localized string similar to You must initialize the section handler on the module before executing the load operation..
Looks up a localized string similar to No XML content nodes found in configuration. Check the XML reader to ensure configuration is in place..
Looks up a localized string similar to The configuration section '{0}' could not be read..
Looks up a localized string similar to If 'name' is specified, 'service' must also be specified (component name='{0}'.).
Looks up a localized string similar to Unable to convert object of type '{0}' to type '{1}'..
Looks up a localized string similar to The type '{0}' could not be found. It may require assembly qualification, e.g. "MyType, MyAssembly"..
Looks up a localized string similar to The value '{0}' is not valid for the inject-properties attribute. Valid values are 'yes' and 'no'..
Looks up a localized string similar to The value '{0}' is not valid for the ownership attribute. Valid values are 'lifetime-scope' (the default) and 'external'..
Looks up a localized string similar to The value '{0}' is not valid for the instance-scope attribute. Valid values are 'single-instance', 'per-dependency' (the default) and 'per-lifetime-scope'..
Holds a dictionary of values for those properties/parameters that are a dictionary
Initializes a new instance of the class.
Helps convert the configuration element into an actuall generic list
Holds a list of values for those properties/parameters that are enumerable
Initializes a new instance of the class.
Helps convert the configuration element into an actuall generic list
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.
Element describing a component property.
Gets the name of the property.
The name.
Gets the value to be set (will be converted.)
The value.
Gets the type of the value.
The type of the value. Defaults to string if not specified.
Collection of extended property elements.
Base for multi-valued configuration elements.
Initializes a new instance of the class.
Name of the element.
The element key.
Indicates whether the specified exists in the .
The name of the element to verify.
true if the element exists in the collection; otherwise, false. The default is false.
Creates a new .
A new .
Gets the element key for a specified configuration element when overridden in a derived class.
The to return the key for.
An that acts as the key for the specified .
Returns an enumerator that iterates through the collection.
A that can be used to iterate through the collection.
Gets the name used to identify this collection of elements in the configuration file when overridden in a derived class.
The name of the collection; otherwise, an empty string. The default is an empty string.
Gets the type of the .
The of this collection.
Gets or sets the TElementType at the specified index.
Initializes a new instance of the class.
Element describing an additional configuration file.
Gets the filename of the file.
The filename.
Gets the section name of the section in the configuration
file.
The section name.
A collection of file elements.
Initializes a new instance of the class.
Element describing a module registration.
Gets the type of the module. Must expose .
The type.
Gets the parameters used to construct the component.
The parameters.
Gets the properties to be explicitly set on the component.
The explicit properties.
A collection of module elements.
Initializes a new instance of the class.
Element describing a component constructor parameter.
Get the value of this element
Gets the name of the parameter.
The name.
Gets the value used to set the parameter (type will be converted.)
The value.
If this parameter's value is a list of values
If this parameter's value is a dictionary
A collection of parameter elements.
Initializes a new instance of the class.
Convert to the Autofac parameter type.
The parameters represented by this collection.
Element describing a component property.
Get the value of this element
Gets the name of the property.
The name.
Gets the value to be set (will be converted.)
The value.
If this property's value is a list of values
If this property's value is a dictionary
Collection of property elements.
Initializes a new instance of the class.
Convert to the Autofac parameter type.
The parameters represented by this collection.
Section handler for Autofac configuration.
This configuration section is used for XML-based configuration of an Autofac
container. While it is primarily used from inside app.config or web.config
files, you may also use it with other arbitrary XML files via the
helper method.
The default section name that will be searched for.
Deserializes a configuration section handler from a specific block of XML.
The used to read the XML configuration from the source.
A read/parsed based on the contents of the .
Thrown if is .
Thrown if does not contain XML configuration that can be parsed into
a .
Deserializes a configuration section handler from an XML configuration file.
The path to the configuration file to parse.
A read/parsed based on the contents of the .
Thrown if is .
Thrown if is empty.
Thrown if the file indicated by can't be found.
Thrown if the configuration can't properly be deserialized from the file.
Deserializes a configuration section handler from an XML configuration file.
The path to the configuration file to parse.
The name of the configuration section (if the is
application configuration format); or to use the default configuration
section name autofac or try the as a raw XML file.
A read/parsed based on the contents of the .
Thrown if is .
Thrown if is empty.
Thrown if the file indicated by can't be found.
Thrown if the configuration can't properly be deserialized from the file.
Checks the validity of a configuration file path and converts relative paths to absolute.
The file path to check/normalize.
If is an absolute path, it is returned unchanged; otherwise
it is made absolute relative to the current configuration location.
Thrown if is .
Thrown if is empty.
Thrown if the file indicated by can't be found.
Gets the components to be registered.
A with the list
of individual service components that should be registered.
Gets the default assembly to search for types in when not explicitly
provided with the type name.
An that should be used as the default assembly
in type searches.
Gets additional configuration files.
A with the list
of external/referenced configuration files.
Gets the modules to be registered.
A with the list
of modules that should be registered.
Element describing a service exposed by a component.
Gets the service type.
The type.
Gets the service name.
The name.
A collection of service elements.
Initializes a new instance of the class.
Some handy type conversion routines.
Does its best to convert whatever the value is into the destination
type. Null in yields null out for value types and the default(T)
for value types (this may change.)
The value.
Type of the destination.
An object of the destination type.
Configuration for values in a list
Gets the key to be set (will be converted.)
Gets the value to be set (will be converted.)
The value.
Configures containers based upon XML configuration settings that are not stored in .NET application configuration.
This module type uses raw XML files to initialize configuration settings. These files are expected to have XML
in them that can be deserialized into a . This XML is the same format
as you would see in a standard app.config/web.config for Autofac, but doesn't require the additional
configuration section definition or other .NET application configuration XML around it.
If you are storing your configuration settings in a .NET application configuration file
(app.config/web.config) you can use the
module to read the settings right out of the configuration file without having to manually parse the XML.
Initializes a new instance of the class
using a specified XML configuration file.
The name of the configuration file containing XML that can deserialize into a .
Thrown if is .
Thrown if is empty.
Relative paths may be specified in relation to the current application folder (where you would normally
find app.config or web.config).
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.