IMetabaseCustomClass.Operations

Syntax

Operations: IMetabaseCustomClassOperations;

Description

The Operations property returns the collection of class custom operations.

Example

Executing the example requires that the repository contains a module with the TestModule identifier. The class for handling operations of objects of the custom classes is implemented in this module.

Module text

Sub UserProc;
Var
    Mb: IMetabase;
    CustomClassExtender: IMetabaseCustomExtender;
    CustomClass: IMetabaseCustomClass;
    Operations: IMetabaseCustomClassOperations;
    Operation: IMetabaseCustomClassOperation;
Begin
    Mb := MetabaseClass.Active;
    //Get custom classes container
    CustomClassExtender := Mb.SpecialObject(MetabaseSpecialObject.CustomExtender).Edit As IMetabaseCustomExtender;
    //Add a custom class
    CustomClass := CustomClassExtender.Classes.Add;
    CustomClass.Id := "UserObjectClass1";
    CustomClass.Name := "Test object";
    CustomClass.ImplementationAssembly := MB.ItemById("Operations");
    CustomClass.ImplementationClass := "OperationsClass";
    //Create operation
    Operations := CustomClass.Operations;
    Operation := Operations.Add(0);
    Operation.Name := "New operation";
    Debug.WriteLine("Created operation identifier: " + Operation.Id);
    (CustomClassExtender As IMetabaseObject).Save;
End Sub UserProc;

On executing the example in the custom classes container a new object class will be created. For the class the basic property will be determined and one operation will be created. The created operation identifier will be displayed in the development environment console. The OperationsClass class will be specified as a operations handler. In this class it is required to implement the method with the identifier which the created operation will have.

See also:

IMetabaseCustomClass