IMsUserMethodTemplate.Assembly

Syntax

Assembly: IMetabaseObjectDescriptor;

Description

The Assembly property determines the development environment unit containing a custom class that implements model execution method.

Comments

The unit plugged in the template must contain a class inherited from IMsUserTransformImplementation that has a complete implementation of the given interface methods.

Example

Executing the example requires that the repository contains a database with the BD identifier and the USER_METHOD unit that contains a custom method template.

Add links to the Dal, Metabase, Ms system assemblies.

Sub UserProc;
Var
    MB: IMetabase;
    CrInfo: IMetabaseObjectCreateInfo;
    MObj: IMetabaseObject;
    Kont: IMsModelSpace;
    Templates: IMsUserMethodTemplates;
    Template: IMsUserMethodTemplate;
    TemplateParams: IMsUserMethodTemplateParams;
    TemplateParam: IMsUserMethodTemplateParam;
Begin
    MB := MetabaseClass.Active;
    CrInfo := MB.CreateCreateInfo;
    CrInfo.ClassID := MetabaseObjectClass.KE_CLASS_MODELSPACE;
    CrInfo.Id := "KONT_MODEL";
    CrInfo.Name := "New modeling container";
    CrInfo.Parent := MB.Root;
    MObj := MB.CreateObject(CrInfo).Edit;
    Kont := MObj As IMsModelSpace;
    //Set database
    Kont.Database := MB.ItemById("BD").Bind As IDatabase;
    //Set period
    Kont.StartDate := DateTime.ComposeDay(200011);
    Kont.EndDate := DateTime.AddYears(Kont.StartDate, 10);
    //Custom method template
    Templates := Kont.UserMethodTemplates;
    Template := Templates.Add;
    Template.Assembly := MB.ItemById("USER_METHOD");
    Template.ClassName := "My_Method";
    //Template parameters
    TemplateParams := Template.Params;
    TemplateParam := TemplateParams.Add;
    TemplateParam.Binding := """UI=""FloatEdit""";
    TemplateParam.Name := "First parameter";
    TemplateParam := TemplateParams.Add;
    TemplateParam.Binding := """UI=""FloatEdit""";
    TemplateParam.Name := "Second parameters";
    MObj.Save;
End Sub UserProc;

After executing the example a modeling container is created in the root directory of repository. The calendar period for this container is set to 10 years, one template is created in the list of templates of the custom methods. Two parameters are created for the template.

See also:

IMsUserMethodTemplate|IMsUserTransformImplementation