Binding Scripts

Meta Data Services Programming

Meta Data Services Programming

Binding Scripts

ScriptDef objects are bound to method and property definitions through relationships. The repository engine uses an algorithm to support the binding.

To support scripting for both method and property interface members, a ScriptDef object is associated at the interface member level. Because method and property definitions inherit from interface member objects, an interface member object provides the common ground where an association between script and interface members can be made.

Because interfaces can be aliased, derived, or otherwise reused, script definitions are linked through association to support the levels of indirection that are customary in COM programming. Associations are established through collections of classes, interfaces, and members that you define for each ScriptDef object.

During script invocation, the repository engine reads the collections to select a script definition most closely related to the interface. When the repository engine selects the closest script definition, it determines which method calls the script, on which interface, and on what class. The selection process enables support for two conditions that are common to C++ programming: inheriting a method or property implementation, and overriding a default implementation.

A method or property can be associated with the class and interface being executed, the interface being executed, or the closest ancestor that has the script. If a script cannot be selected, then the repository engine returns an error in the case of methods.

You can implement script for methods and property validation rules that apply to:

  • All classes that implement the interface.

  • A specific class that implements the interface.

  • A derived interface that can override the implementation of a base interface method or property validation rule.

Each method or property can be associated with only one script definition. However, the same script definition can be associated with multiple methods and properties.

The IScriptDef interface, along with its relationships to other classes and interfaces, is shown in the following figure.

See Also

Accessing a Script

Defining Script Objects

IScriptDef Interface

ScriptDef Object