Macro: String;
Macro: String;
The Macro property determines the name of the method, which will be executed on connecting to the database.
As the value of this property should be specified the name of the statistical procedure, having only one parameter with the ISecurityConnection type. The procedure must be implemented in the object, which is specified in the Module property. The name is specified in the following format: <ClassName>.<ProcedureName>, or <Namespace>.<ClassName>.<ProcedureName> if the realization is in the .NET assembly.
The procedure is performed right after connection and before of any other queries. Created connection is available in the procedure input parameter. Using interfaces of the Dal assembly, some additional settings can be configured.
Executing the example requires a database with the BD identifier in the repository. The repository should also contain a created module with the PrepareDB identifier. The module has a procedure that will be called after connecting to database.
Sub UserProc;
Var
MB: IMetabase;
DB: IDatabaseInitExecuteSetup;
Begin
MB := MetabaseClass.Active;
DB := MB.ItemById("BD").Edit As IDatabaseInitExecuteSetup;
DB.Module := MB.ItemById("PrepareDB");
DB.Macro := "PrepareDB.OnDBConnecting";
(DB As IMetabaseObject).Save;
End Sub UserProc;
After executing the example additional settings of the repository database will be determined. The specified procedure will be executed after connecting.
Executing the example requires a database with the BD identifier in the repository. The repository should also have a created .NET assembly with the PrepareDB identifier. The assembly contains a .NET module with implementation of the procedure that will be called after connecting to database.
Public Shared Sub Main(Params: StartParams);
Var
MB: IMetabase;
DB: IDatabaseInitExecuteSetup;
Begin
MB := Params.Metabase;
DB := MB.ItemById["BD"].Edit() As IDatabaseInitExecuteSetup;
DB.Module := MB.ItemById["PrepareDB"];
DB.Macro := "PrepareDB.PrepareDB.OnDBConnecting";
(DB As IMetabaseObject).Save();
End Sub;
After executing the example additional settings of the repository database will be determined. The specified procedure will be executed after connecting.
See also: