Microsoft has made it simple to manage components via MTS Explorer. Figure 43.4 readily shows all packages that have been installed. Following are the steps of installing a component under MTS control. For this example, the Sample Bank package that comes with MTS sample code will be used (c:\Program Files\Mts\Samples\Packages\Sample Bank.PAK).
Before you install a new component in MTS, you must decide on which package you want the component to be a member. This example will show the install of a prebuilt package:
Open the MTS Explorer.
Open the My Computer icon and select the Packages Installed folder.
Right-click the Packages Installed folder, and select New, Package.
Select Install Pre-Built Package on the Package Wizard screen. This is for packages that were distributed to you, such as the Sample Banking package with MTS. Figure 43.5 shows these two options.
The other option on the Package Wizard screen is Create an Empty Package. This is used to install packages that you have created using VB, or other development tools.
Click on the Add button and browse for the package file you want. Again, in this example, it will be the Sample Bank package located in C:\Program Files\Mts\Samples\Packages\Sample Bank.PAK). Select this file and then click Next. Figure 43.6 shows the package that has been selected to be installed. Alternatively, only a component within this package could have been selected, such as only the Visual Basic components (and not the VJ, and so on components).
Just click Next on the Set Package Identity dialog box. This screen is used to specify what user identity the package will assume while performing its work. In this case, you want the default option of Interactive User.
The component files will be installed into an Install directory of your choice. You might choose the default value of C:\Program Files\Mts\Packages. Click the Next button to finish the install. Figure 43.7 shows a completed install of the Sample Bank package.
After the components have been installed, you can set properties such as what transaction support you want for these components. In this example, the component properties for the Bank.Account component that was just installed will be set to Requires a Transaction. The following steps accomplish this:
Open the Components folder in Sample Bank.
Select the Bank.Account component. Right-click the component and select Properties.
Select the Transaction tab.
Click Requires a Transaction (see Figure 43.8).
In Visual Basic 6.0, you can set the Transaction Support property during the development of a component by using the MTSTransactionMode property of the class.
The behavior of each of the supported transaction modes is as follows:
Requires a transaction?The component must execute within the context of a transaction, although it does not care where the context originates. If the caller has a transaction already, then the called component will use the existing transaction. If the caller does not have a transaction, then MTS automatically creates a new transaction for the component.
Requires a new transaction?The component must always establish its own transaction context. Regardless of whether the calling application has a transaction context, MTS automatically creates a new transaction context object for the component.
Supports transactions?The component does not care whether a transaction context is in place.
Does not support transactions?The component cannot support a transaction, and the CreateInstance method from within a context object will fail.