Exact string rule code example - SmartPlant Foundation - IM Update 44 - Customization & Programming - Hexagon

SmartPlant Foundation Customization

Language
English
Product
SmartPlant Foundation
Search by Category
Customization & Programming
SmartPlant Foundation / SDx Version
10

The exact string rule needs to be created in the code with the interface name exactly matching the name of the interface in the schema. The matching name allows it to be referenced in the code and allows the code that runs the rules to dynamically find the new rule. The rule interface does not need to have any properties or methods related as the interface name is the most important requirement.

The class that implements this exact string rule must realize the IVTLValidationRuleExecution interface, which is a generic interface, both without a type and with the rule interface.

Public Class VTLHasExactStringValidationRule

Implements IVTLValidationRuleExecution,

IVTLValidationRuleExecution(Of IVTLHasExactStringValidationRule)

The class must be exported through the Managed Exstensibility Framework (MEF). For example,

<Export(GetType(IVTLValidationRuleExecution)), PartCreationPolicy(CreationPolicy.NonShared)>

For a rule to report that an object or property has failed validation, it must add a validation object to a collection and return that collection from the ExecuteValidation function. You need to realize the IValidationObjectCreation interface to get a class that creates validation objects.