DonaldShimoda Posted August 14, 2017 Share Posted August 14, 2017 How can i reuse a vcl datamodule to be created one instance for session? Seems like now is running a unique isntance for all the server. Best regards. Link to comment Share on other sites More sharing options...
asapltda Posted August 14, 2017 Share Posted August 14, 2017 +1 Link to comment Share on other sites More sharing options...
mika Posted August 15, 2017 Share Posted August 15, 2017 Why are you not using uniGUI datamodule? Link to comment Share on other sites More sharing options...
GerhardV Posted August 15, 2017 Share Posted August 15, 2017 You can use the search functionality on this forum to look for "datamodule", below are two results: http://forums.unigui.com/index.php?/topic/7884-multiple-datamodules/?hl=datamodule http://forums.unigui.com/index.php?/topic/5663-tdatamodule-to-use-or-not-to-use/?p=28979 Link to comment Share on other sites More sharing options...
davidizadar Posted August 15, 2017 Share Posted August 15, 2017 Both in VCL and uniGUI applications, creating a data module when the application or session start is only a good practice for small applications. Medium and large applications work best when data modules are created on demand. If a form needs a data module, it can create it in OnCreate, and release it in OnDestroy. If you create a uniGUI data module, you are asking for automatic lifetime management of it for each session. All of them will be created when the session starts, and all of them will be released when the session is closed. But remember that data modules usually take a lot of resources. Link to comment Share on other sites More sharing options...
Tokay Posted August 16, 2017 Share Posted August 16, 2017 As far as I know, if you manually create them, they will be created in a single copy: Application.CreateForm(TDataModule3, DataModule3); Application.CreateForm(TWebDataModule, WebDataModule); Link to comment Share on other sites More sharing options...
DonaldShimoda Posted August 16, 2017 Author Share Posted August 16, 2017 Why are you not using uniGUI datamodule? because the big deal here is tryong to reuse stuff you already have for other vcl applications. We have many datamodules already defined. Link to comment Share on other sites More sharing options...
DonaldShimoda Posted August 16, 2017 Author Share Posted August 16, 2017 You can use the search functionality on this forum to look for "datamodule", below are two results: http://forums.unigui.com/index.php?/topic/7884-multiple-datamodules/?hl=datamodule http://forums.unigui.com/index.php?/topic/5663-tdatamodule-to-use-or-not-to-use/?p=28979 Yes, thanks , i do. As you can see theres no answers there to my question. Do you read the search results? Link to comment Share on other sites More sharing options...
DonaldShimoda Posted August 16, 2017 Author Share Posted August 16, 2017 Both in VCL and uniGUI applications, creating a data module when the application or session start is only a good practice for small applications. Medium and large applications work best when data modules are created on demand. If a form needs a data module, it can create it in OnCreate, and release it in OnDestroy. If you create a uniGUI data module, you are asking for automatic lifetime management of it for each session. All of them will be created when the session starts, and all of them will be released when the session is closed. But remember that data modules usually take a lot of resources. yes, i know. The idea is to be created in each new sesion. How to do? Link to comment Share on other sites More sharing options...
DonaldShimoda Posted August 16, 2017 Author Share Posted August 16, 2017 The correct answer is from Farshad, just registering the data modeul at unit initialization do the job. Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now