IBaseMethod.Invoke

Syntax

Invoke([Value: Variant = Null]);

Invoke(Value: Object);

Parameters

Value. Value sent to method.

Description

The Invoke method executes custom method.

Comments

Invoke provides a possibility to execute custom method, but do not allow to get execution result. It can be used to check custom method efficiency. The custom method can contain maximum one parameter.

Example

Executing the example the repository must contain custom methods. The first custom method must not contain parameters in its signature.

Add links to the Fore and Metabase system assemblies.

Sub UserProc;
Var
    Mb: IMetabase;
    SharedParams: ISharedParams;
    Method: IForeMethod;
Begin
    Mb := MetabaseClass.Active;
    SharedParams := Mb.SpecialObject(MetabaseSpecialObject.SharedParams).Bind 
As ISharedParams;
    Method := SharedParams.Methods.FindByKey(
16);
    
Try     
        Method.Invoke;
    
Except On e: Exception Do
        Debug.WriteLine(
"Error: " + e.Message);
    
End Try;
End Sub UserProc;

Imports Prognoz.Platform.Interop.KeFore;
Imports Prognoz.Platform.Interop.Metabase;

Public Shared Sub Main(Params: StartParams);
Var
    Mb: IMetabase;
    SharedParams: ISharedParams;
    Method: IForeMethod;
Begin
    Mb := Params.Metabase;
    SharedParams := Mb.SpecialObject[MetabaseSpecialObject.msoSharedParams].Bind() 
As ISharedParams;
    Method := SharedParams.Methods.Item[
0];
    
Try
        Method.Invoke(
Null);
    
Except On e: Exception Do
        System.Diagnostics.Debug.WriteLine(
"Error: " + e.Message);
    
End Try;
End Sub;

On executing the example the custom method execution will be checked. If errors occur while execution, text of error will be displayed in the development environment console.

See also:

IBaseMethod