The Parameter Type Matching Rule
This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This page may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
|The latest Unity Application Block information can be found at the Unity Application Block site.|
The Parameter Type Matching Rule allows developers, operators, and administrators to select target classes based on the type name of a parameter for a member of the target object.
In more detail, the Parameter Type Matching Rule does the following:
- It reads the collection of match values, each containing the nameToMatch, kind, and ignoreCase properties, from the Unity Application Block configuration.
- It compares each match value to the fully qualified namespace and class name, or just the class name, of the parameter types of members of the target object.
- It compares each matching type to the value of the kind property. This is a value from the ParameterKind enumeration, and can be Input, Output, InputOrOutput, or ReturnValue.
- It performs the comparison on a non-case-sensitive basis if the ignoreCase property is True, or on a case-sensitive basis if the ignoreCase property is False.
- It returns True if the target object member has parameters of matching types; if the target member does not have parameter of matching types, it returns False.
Unity uses constructor injection to generate new instances of matching rules. For information about constructor injection, see the following topics:
- Streamlining Interception by Using PolicyDefinition API
- Configuration Support for Interception
- Configuring Containers at Run Time
The following constructor overloads can be used for the ParameterTypeMatchingRule class.
public ParameterTypeMatchingInfo( ParameterKind kind ) public ParameterTypeMatchingInfo( string nameToMatch, ParameterKind kind ) public ParameterTypeMatchingInfo( string nameToMatch, bool ignoreCase, ParameterKind kind )
The configuration settings available for the Parameter Type Matching Rule are a collection of parameter type matches, each consisting of three parameters:
- nameToMatch (String). This is the full namespace-qualified type name or just the type name of a parameter of a member of the target object. The following are examples:
- kind: (ParameterKind). This value specifies the usage of the parameter; it can be Input, Output, InputOrOutput, or ReturnValue.
- ignoreCase (Boolean). This specifies whether the match should be carried out on a case-sensitive basis.
The next procedure shows how to configure the Parameter Type Matching Rule using the Configuration Console or the Visual Studio Configuration Editor.