Export (0) Print
Expand All

The Type Matching Rule

Retired Content

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 Type Matching Rule allows developers, operators, and administrators to specify the target class using the namespace and class names.

In more detail, the Type Matching Rule does the following:

  • It reads the collection of matches, each containing the typeName and ignoreCase properties, from the Unity Application Block configuration.
  • It compares each typeName value to the full namespace and class name of the target object type, and to just the class name if no namespace is provided.
  • 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 any of the typeName values match the target object type's namespace and class name; if none of the typeName values match the target object type's namespace and class name, it returns False.

Unity uses constructor injection to generate new instances of matching rules. For information about constructor injection, see the following topics:

The following constructor overloads can be used for the TypeMatchingRule class.

public TypeMatchingRule(
IEnumerable<MatchingInfo> matches
)
public TypeMatchingRule(
string typeName
)
public TypeMatchingRule(
Type type
)
public TypeMatchingRule(
string typeName,
bool ignoreCase
)

The configuration settings available for the Type Matching Rule are a collection of type matches, each consisting of two parameters:

  • matches (MatchingInfo). The match information to match. Look to match any of the type names given in the collection of match information.
  • typeName (String). Type name to match. This is the full namespace and class name of the target object such as "MyNamespace.BusinessObjects.Orders", or just the class name such as "MyOrderObject".
  • type (Type). The type to match.
  • ignoreCase (Boolean). This specifies whether the match should be carried out on a case-sensitive basis.

Show:
© 2014 Microsoft