Ian Branch 128 Posted February 22, 2023 Hi Team, Philosophical discussion. Bit like which word processor is best. Is it better to have all the Database related components TEngine, TSession, TConnection, TTables, TQuerys, etc, in a datamodule or scattered around the forms.. Pros & Cons - Ready... Go!! Share this post Link to post
Anders Melander 1815 Posted February 22, 2023 It sounds like you already know the answer to that one. 3 Share this post Link to post
Lars Fosdal 1793 Posted February 22, 2023 We create all these in code. No visual components used. We have no sea of DB components floating in designers. It requires a bit more scaffolding code, but it can be generalized and made threadsafe. 8 Share this post Link to post
microtronx 38 Posted February 22, 2023 1 hour ago, Ian Branch said: Hi Team, Philosophical discussion. Bit like which word processor is best. Is it better to have all the Database related components TEngine, TSession, TConnection, TTables, TQuerys, etc, in a datamodule or scattered around the forms.. Pros & Cons - Ready... Go!! Hi Ian, on our mainapp we have one tDataModule with tEngine, tSession but we create all other tTables and tQuery etc. in runtime on each form. This is different when we have threads: for each thread, we create a seperate tSession Share this post Link to post
Alberto Fornés 22 Posted February 22, 2023 1 hour ago, Lars Fosdal said: We create all these in code. No visual components used. We have no sea of DB components floating in designers. It requires a bit more scaffolding code, but it can be generalized and made threadsafe. Yes, rapid development is not always the best solution for big projects. Share this post Link to post
Uwe Raabe 2064 Posted February 22, 2023 As ever so often, the pragmatic solution probably lies somewhere in between... Share this post Link to post
FPiette 385 Posted February 22, 2023 In small demo applications, I use a TDataModule with component dropped on it. For real world large application, I use a simple unit have the code that encapsulate database access and database components are created at runtime. The unit offers classes that give access to the data stored in the database in an abstracted way. More code but much better program if correctly designed. 2 Share this post Link to post
Tom Chamberlain 47 Posted February 22, 2023 In our 24+ year old system we have a central TDataModule with the connection and shared data access for things used everywhere like customer information retrieval. Then each form has form specific queries/datasets/command and datasource components dropped on them (no tables) for the form related data. We don't have a sea of DB components on most forms, but if I could go back 25 years knowing what I know now, I would do it all through objects and/or use some type of ORM and have no DB components anywhere. Now, where is my Tardis? Share this post Link to post