TAstaServerSocket.OnAddDataModule
Applies to
TAstaServerSocket
Declaration
property
OnAddDataModule: TAddDataModuleEvent;
Description
This allows you to add multiple data modules to ASTA servers for support of ASTA server side components
and to perform any intialization for the additional data module. Traditionally, a main data module will
contain a TDataBase type of component that will need to be used by the additional data module.
In order for ASTA to properly thread ASTA Servers, data modules need to be created by ASTA on demand and OnAddDataModule allows this to occur.
Example
procedure TForm1.AstaServerSocket1AddDataModule(Sender: TObject;
Session: TComponent; DMList: TList);
var
dm: TMyDataModule;
i: Integer;
begin
dm := TMyDataModule.Create(nil);
for i := 0 to dm.ComponentCount - 1 do
if dm.Components[i] is TQuery then
TQuery(Components[i]).DatabaseName :=
TMyMainDataModule(Sesssion).DatabaseName;
DMList.Add(dm);
end;