Click or drag to resize

AskiaPortalCmnApiInitializeModule Method

Indicates which module is currently using the API.

Namespace:  AskiaPortalCmn
Assembly:  AskiaPortalCmn (in AskiaPortalCmn.dll) Version: 1.7.0-build068
Syntax
public static void InitializeModule(
	Guid moduleGuid,
	Version moduleVersion,
	string programName = null,
	bool forceOnSetupEvent = false
)

Parameters

moduleGuid
Type: SystemGuid
GUID of the module that currently use the API.
moduleVersion
Type: SystemVersion
Version of the module
programName (Optional)
Type: SystemString
Name of the program currently using the API
forceOnSetupEvent (Optional)
Type: SystemBoolean
Set True to enforce the trigger of the OnSetup event
Exceptions
Remarks
This is the entry-point of the application.
API developers must call this method before using the rest of the API.
Remarks
This method must be called only one time and as soon as possible in the application life cycle.
Consider to use (Application_Start) event in the Global.asax of web application or the Main() method of Windows application.
Remarks
You can call this method several only in test environment. (EnvironmentMode is equal Test)
Remarks

In the main module component, please use the event OnSetup to register or update the module.

If the module has already been register, this method will compare the version number.
If the specified version is greater than the registered version (in database), this method will raise the event OnSetup if available or throw an exception if not available.
If the specified version is lower than the registered version (in database), this method will do the following verification:

  • If one of the two first digits of the versions number are different, it will throw an exception.
  • If third digits of the versions number are different, it will send a warning event.
  • If fourth digits of the versions number are different, it will be accepted.

Remarks

If the OnSetup event is specified and if the parameter `forceOnSetupEvent` is set to `True`, then the OnSetup will always be triggered even if the version numbers are the same.

Examples

Initialize a web module (Global.asax)

using System;
using System.Web;
using AskiaPortalCmn;

namespace MyWebModule
{
    public class Global : HttpApplication
    {
        protected void Application_Start(object sender, EventArgs e)
        {
            Guid myWebModuleGuid = Guid.Parse("26f6ab8b-2fdb-4f4f-ad14-7507892846a5");
            Version myWebModuleVersion = new Version("1.0.0.0");
            AskiaPortalCmnApi.InitializeModule(myWebModuleGuid, myWebModuleVersion, "MyWebModule");
        }
    }
}
Examples

Initialize a windows module (Program.cs)

using System;
using AskiaPortalCmn;

namespace MyWindowsModule
{
    public class Program
    {
        static void Main(string[] args)
        {
            Guid myWinModuleGuid = Guid.Parse("6d26aeb0-e17d-46d2-a97f-f946c7d88c31");
            Version myWinModuleVersion = new Version("1.0.0.0");
            AskiaPortalCmnApi.InitializeModule(myWinModuleGuid, myWinModuleVersion, "MyWindowsModule");
        }
    }
}
See Also