IMetabaseCustomClass.Operations

Syntax

Operations: IMetabaseCustomClassOperations;

Description

The Operations property returns a collection of the class operations.

Fore 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;
    //Obtaining custom classes container
    CustomClassExtender := Mb.SpecialObject(MetabaseSpecialObject.CustomExtender).Edit As IMetabaseCustomExtender;
    //Adding custom class
    CustomClass := CustomClassExtender.Classes.Add;
    CustomClass.Id := "UserObjectClass1";
    CustomClass.Name := Test Object;
    CustomClass.ImplementationAssembly := MB.ItemById("Operations");
    CustomClass.ImplementationClass := "OperationsClass";
    //Creating operation
    Operations := CustomClass.Operations;
    Operation := Operations.Add(0);
    Operation.Name := New method;
    (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 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.

Fore.NET Example

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

Module text

The specified below procedure is an entry point for the .NET assembly.

Imports Prognoz.Platform.Interop.Metabase;

Public Shared Sub Main(Params: StartParams);
Var
    Mb: IMetabase;
    CustomClassExtender: IMetabaseCustomExtender;
    CustomClass: IMetabaseCustomClass;
    Operations: IMetabaseCustomClassOperations;
    Operation: IMetabaseCustomClassOperation;
Begin
    Mb := Params.Metabase;
    //Obtaining custom classes container
    CustomClassExtender := Mb.SpecialObject[MetabaseSpecialObject.msoCustomExtender].Edit() As IMetabaseCustomExtender;
    //Adding custom class
    CustomClass := CustomClassExtender.Classes.Add();
    CustomClass.Id := "UserObjectClass1";
    CustomClass.Name := Test object;
    CustomClass.ImplementationAssembly := MB.ItemById["Operations"];
    CustomClass.ImplementationClass := "Operations.OperationsClass";
    //Creating operation
    Operations := CustomClass.Operations;
    Operation := Operations.Add(0);
    Operation.Name := New method;
    (CustomClassExtender As IMetabaseObject).Save();
End Sub;

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 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