AskiaPortalCmnApiInitializeModule Method |
Namespace: AskiaPortalCmn
public static void InitializeModule( Guid moduleGuid, Version moduleVersion, string programName = null, bool forceOnSetupEvent = false )
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 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.
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"); } } }
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"); } } }