Configuring TMTSDataModule

From RAD Studio
Jump to: navigation, search

Go Up to Setting Up the Data Module


To add a TMTSDataModule component to your application, choose File > New > Other and select Transactional Data Module from the Multitier page of the new items dialog. You will see the Transactional Data Module wizard.

Note: To add a Transactional Data Module, you need to previously add an ActiveX Library to the project, which can be found on the Activex page.

You must supply a class name for your remote data module. This is the base name of a descendant of TMTSDataModule that your application creates. It is also the base name of the interface for that class. For example, if you specify the class name MyDataServer, the wizard creates a new unit declaring TMyDataServer, a descendant of TMTSDataModule, which implements IMyDataServer, a descendant of IAppServer.

Note: You can add your own properties and methods to your new interface. For more information, see Extending the application server's interface.

You must specify the threading model in the Transactional Data Module wizard. Choose Single, Apartment, or Both.

  • If you choose Single, client requests are serialized so that your application services only one at a time. You do not need to worry about client requests interfering with each other.
  • If you choose Apartment, the system ensures that any instance of your remote data module services one request at a time, and calls always use the same thread. You must guard against thread conflicts if you use global variables or objects not contained in the remote data module. Instead of using global variables, you can use the shared property manager.
  • If you choose Both, MTS calls into the remote data module's interface in the same way as when you choose Apartment. However, any callbacks you make to client applications are serialized, so that you do not need to worry about them interfering with each other.

Note: The Apartment model under MTS or COM+ is different from the corresponding model under DCOM.

You must also specify the transaction attributes of your remote data module. You can choose from the following options:

  • Requires a transaction. When you select this option, every time a client uses your remote data module's interface, that call is executed in the context of a transaction. If the caller supplies a transaction, a new transaction does not need to be created.
  • Requires a new transaction. When you select this option, every time a client uses your remote data module's interface, a new transaction is automatically created for that call.
  • Supports transactions. When you select this option, your remote data module can be used in the context of a transaction, but the caller must supply the transaction when it invokes the interface.
  • Does not support transactions. When you select this option, your remote data module can't be used in the context of transactions.

See Also