ScriptDef Class

Meta Data Services Programming

Meta Data Services Programming

ScriptDef Class

A script definition object represents Microsoft® ActiveX® script that you can associate with a method or property definition.

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.

When to Use

Use a ScriptDef object to store the implementation of a method in an information model. You can also use ScriptDef to validate properties before storing them in a repository database.

You can implement methods or property validation rules that apply to:

  • All classes that implement the interface.

  • A specific class that implements the interface.

  • A derived interface for those cases in which you want to 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.

Interfaces
Interface Description
INamedObject Retrieves or sets the class name
IRepositoryDispatch Provides enhanced dispatch support
IRepositoryItem Manages repository objects and relationships
IReposTypeInfo Relates class, interface, and relationship definition objects to information models
IScriptDef Associates a Microsoft ActiveX script definition with a method

See Also

RTIM Classes

ScriptDef Object