How to share a data layer interface in COM +: Delphi/Windows SDK/API
Http://www.delphi2007.net/DelphiNetwork/html/delphi_20061216191901110.html
In COM + development, I want to build a common data service layer component consisting of a data access control such as mtsdatamodule and ADO. Each Business Object interacts with the database through it. However, when a business object accesses this data access component, an mtsdatamodule object instance is created. In this way, multiple mtsdatamodule objects are generated when multiple business objects are accessed, this will occupy a large amount of database resources.
Problem:
1. When developing with COM +, can the data access layer generate only one common mtsdatamodule (multiple adoconnect and data access controls are put above), and business objects only call this mtsdatamodule object, instead of multiple instances that generate mtsdatamodule?
2. Use the above idea to implement the database connection pool.
3. Thread model problems. There are two COM + objects, bo1 (STA) and bo2 (STA). When the client calls bo1, a single thread suite is generated on the server side, and bo1 is also placed in the same single thread suite, there is a method in bo1 that will create the bo2 object and call the bo2 method. Is bo2 and bo1 in the same suite? (If bo2 is MTA, is it the same)
Please help. the problem persists. Thank you.
Have you ever encountered this problem? Let's make a move.