Implementing the module class - SmartPlant Foundation - IM Update 44 - Customization & Programming - Hexagon

SmartPlant Foundation Customization

Language
English
Product
SmartPlant Foundation
Search by Category
Customization & Programming
SmartPlant Foundation / SDx Version
10

Include the module class in the SPF.Server.Modules namespace. Set the inheritance of the module class to ModuleBase in the SPF.Server.Modules.Model namespace. At this point, your module class will probably appear similar to this:

Option Explicit On

Option Strict On

Imports SPF.Server.Modules.Model

Namespace SPF.Server.Modules

Public Class CustomModule

Inherits ModuleBase

Public Sub New(ByRef pobjSPFServer As SPFServer)

MyBase.New(pobjSPFServer)

End Sub

Protected Overrides Sub AddRequiredSchemaItems()

End Sub

End Class

End Namespace

You will notice the stub for AddRequiredSchemaItems. This is stubbed out automatically when you inherit from ModuleBase. The original thinking behind this method was that there were elements of the module that must be present to support the functionality in a module. Unfortunately for a variety of reasons, nothing has been implemented so the sub can stay empty.

Next, we need to add a constructor that will be used by the SmartPlant Foundation server to create the module. The signature is as follows:

Public Sub New(ByRef pobjSPFServer As SPFServer)

MyBase.New(pobjSPFServer)

End Sub

Optionally you may want to expose the CoreModule property through this class:

Public ReadOnly Property CoreModule() As CoreModule

Get

Return Me.Server.CoreModule

End Get

End Property

The module class is now implemented.

It is recommended that you implement methods using Server APIs.