Share via


The Member Name 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 Member Name Matching Rule allows developers, operators, and administrators to select target classes based on the name of the class members (methods or properties), including using wildcard characters for the member name.

Behavior of the Member Name Matching Rule

In more detail, the Member Name Matching Rule does the following:

  • It reads the collection of nameToMatch and ignoreCase parameters from the Unity Application Block configuration.
  • It compares each nameToMatch value to the names of the members of the target object, taking into account any wildcard character at the start or end of the match string.
  • It performs the comparison on a non-case-sensitive basis if the ignoreCase parameter is True or on a case-sensitive basis if the ignoreCase property is False.
  • It returns True if any of the nameToMatch values matches a target object member name; if no nameToMatch values match a target object member name, it returns False.

Configuration Using Constructor Injection for Member Name Matching Rule

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 MemberNameMatchingRule class.

public MemberNameMatchingRule(
IEnumerable<MatchingInfo> matches
)
public MemberNameMatchingRule(
IEnumerable<string> namesToMatch
)
public MemberNameMatchingRule(
string nameToMatch
)
public MemberNameMatchingRule(
IEnumerable<string> namesToMatch,
bool ignoreCase
)
public MemberNameMatchingRule(
string nameToMatch,
bool ignoreCase
)

The following are the configuration settings available for the Member Name Matching Rule:

  • nameToMatch (String). This is the name of a method or parameter of the target object, such as "GetOrderDetails". It can consist of or include the * or ? wildcard characters to select multiple types. You can also use square brackets [ ] to specify a range of characters. The following are some examples:
    • GetOrder*
    • *OrderFunctions
    • OrderProcess??Node
    • Transacted[order]Node
    • *
  • namesToMatch (String). A list of names to match. If any of these patterns match, the rule matches. Comparisons are case sensitive. Wildcards are valid.
  • matches (MatchingInfo). This is a list of MatchingInfo objects containing the pattern to match and case sensitivity flag.
  • ignoreCase (Boolean). This specifies whether the match should be carried out on a case-sensitive basis.