Configuring Matching Rules

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 Enterprise Library information can be found at the Enterprise Library site.

The next procedure describes how to add one of the built-in matching rules to an application using the configuration tools.

To configure a new built-in matching rule

  1. Right-click the Matching Rules node in the Enterprise Library Configuration Console or Visual Studio Configuration Editor, point to New, and then click the type of matching rule you want to add.
  2. In the right pane of the Enterprise Library Configuration Console, or in the Visual Studio Properties window, select the Name property, and then change the default name to the name you want to use for the new matching rule.
  3. The remaining properties shown in the right pane of the Enterprise Library Configuration Console, or in the Visual Studio Properties window, depend on the type of matching rule you selected. Edit the properties to suit the requirements of your application. For details about the properties for each type of matching rule, see Configuring Matching Rules.
  4. Repeat this procedure to add additional matching rules as required.

The next procedure describes how to add a custom matching rule type to an application using the configuration tools.

To configure a custom matching rule

  1. Right-click the Matching Rules node in the Enterprise Library Configuration Console or Visual Studio Configuration Editor, point to New, and then click Custom Matching Rule.
  2. In the right pane of the Enterprise Library Configuration Console, or in the Visual Studio Properties window, select the Name property, and then change the default name to the name you want to use for the new matching rule.
  3. In the right pane of the Enterprise Library Configuration Console, or in the Visual Studio Properties window, select the Type property, and then click the ellipsis button (...) to open the TypeSelector dialog box. Select the class that implements the custom matching rule, and then click OK.
  4. If the list does not show the assembly containing the custom matching rule, click Load an Assembly, navigate to the assembly that contains the matching rule, select the assembly, and then click Open. Back in the Type Selector dialog box, select the required custom matching rule class, and then click OK.
  5. In the right pane of the Enterprise Library Configuration Console, or in the Visual Studio Properties window, select the Attributes property, and then click the ellipsis button (...) to open the EditableKeyValue Collection Editor dialog box.
  6. Click Add, and then, in the right pane of the dialog box, enter the name of the attribute (the key) and the corresponding value for an attribute the custom matching rule requires.
  7. Repeat the previous step to add all the required attributes, and then click OK to close the EditableKeyValue Collection Editor dialog box.
    Ff649622.note(en-us,PandP.10).gifNotes:

    The Custom Matching Rule configuration item allows you to configure any custom matching rule class you create. The configuration editor creates an entry in the configuration that contains the name and the class type, plus all the attributes you enter in the EditableKeyValue Collection Editor dialog box. These values are all available to the custom matching rule at run time through a NameValueCollection passed to the custom class.

    Only classes that implement the IMatchingRule interface and carry the attribute [ConfigurationElementType(typeof(CustomMatchingRuleData))] will be visible in the Type Selector dialog box and available for configuration with Enterprise Library Configuration Console or Visual Studio Configuration Editor.

    For details about how you can create custom matching rules, see Creating a New 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 Enterprise Library information can be found at the Enterprise Library site.