The information in this article applies to:
SUMMARYUse of the VB New keyword to instantiate Microsoft Transaction Server (MTS) components may cause an unexpected behavior. The use of the New keyword in MTS sits in on the COM creation calls, but these methods go beneath COM to instantiate object, the instantiation can not be detected by MTS. The object then runs outside of the MTS environment rather than within. This can cause all sorts of erratic behaviors with MTS:
C++: Since a COM interface is at some point a C++ class, it is possible to call "New" on the underlying C++ class. This may give a slight performance improvement, but causes the preceding problems. Always use the COM instantiation functions (CoCreateInstance, etc.) to instantiate MTS components. Visual Basic (VB): The VB New keyword uses the COM instantiation functions in most cases and therefore behaves as expected. However, if "New" is used to instantiate an instance of a class in the same project (dll once compiled) then VB uses a non-COM method for performance reasons. This method is much like the C++ equivalent. If 'New' is used to instantiate an instance of a class in separate DLLs then new object is created in a new activity. NOTE: use ObjectContext's CreateInstance method to create one MTS component from another MTS component. REFERENCESFor more information on this please refer Chapter 9, The MTS Run-Time Environment in Programming Distributed Applications with COM and Microsoft Visual Basic 6.0 from Microsoft Press (http://mspress.microsoft.com/books/2137.htm) Additional query words:
Keywords : kbother |
Last Reviewed: June 28, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |