Design-Time Configuration

Microsoft Enterprise Library 5.0

DropDown image DropDownHover image Collapse image Expand image CollapseAll image ExpandAll image Copy image CopyHover image

This topic describes the techniques you can use to configure Unity containers using a configuration file or a configuration you load into the container at run time.


Note:
This documentation is based on the Unity 2.0 configuration schema and all examples use Unity 2.0. Partial backward compatibility is provided for the Unity 1.2 configuration schema.


The following topics describe Unity configuration:

  • Using the Configuration Tool. Not available for Unity configuration.
  • Using the Unity XSD to Enable Visual Studio IntelliSense. This topic explains how to use the Unity XSD to enable IntelliSense® in Visual Studio to assist in manually editing the Unity configuration.
  • Reusing Configuration Files Based on a Previous Schema. This topic explains how to create a current configuration file by reusing a configuration file based on a previous Unity schema.
  • Using Design-Time Configuration. This topic explains the overall structure of the Unity configuration file, how you load configuration information at run time, and how you can use alternative configuration sources with Unity.
  • Specifying Types in the Configuration File. This topic explains how to configure mappings in the container between types. In general, you will create mappings between an interface and a type that implements the interface, or between a base class and a type that inherits that base class. You can also use this section to specify concrete types for which you want Unity to manage the lifetime.
  • The Unity Configuration Schema. This topic describes the configuration schema elements for Unity.
  • Specifying Values for Injection. This topic explains how to configure registrations for instance types such as string, date and time, or integer values that you can resolve in your application.
  • Extending the Unity Configuration Schema. This topic explains how to configure Unity to load and use container extensions that add additional functionality to the container, and how you can specify configuration information for these extensions.
  • Configuration Files for Interception. This topic explains how to configure interceptors, behaviors, policies, handlers, and matching rules that Unity will use when creating instances of types to which you want to add interception capabilities in order to change the behavior of that object or type.

For information about how to configure Unity using code that executes at run time and calls the registration methods of the Unity container, see Run-Time Configuration. For information about resolving types at run time, see Resolving Objects.