Results 1 to 2 of 2

Thread: MTS: Microsoft Transaction Server / VB

  1. #1

    Thread Starter
    New Member
    Join Date
    Sep 2000
    Posts
    2

    Unhappy

    I have ASP code which includes a function that will call a component in an MTS package via Server.CreateObject. The component in the MTS package has the transaction attributes set to "Does not support transactions". Would you still need to use the declaring and setting of the object context within this component(dim objctx as objectcontext and set objctx=GetobjectContext) if not supporting transactions? I didn't think so since there aren't any transactions or need to use SetAbort or SetComplete but I could be wrong.

    Now, if I have a second module that uses the statement:
    Dim loADSI As New Module1.Component to access the above component in the MTS package: Would it be necessary for both of them to be in the MTS package? Would it at least be necessary to change the 'As New' code in this second module to using 'CreateInstance'?

    I would appreciate any information anyone can provide...
    Thanks!

  2. #2
    Guru Clunietp's Avatar
    Join Date
    Oct 1999
    Location
    USA
    Posts
    1,844
    Hi Benny

    1st Q:
    Always use Setcomplete/Setabort, even if you don't currently use transactions. This allows the MTS wrapper to efficiently deactivate your objects and pool the threads. If you later want to use transactions, you won't have to modify any code. If you want to avoid a recompile later on and your object modifies data in a database, set it to USES TRANSACTIONS. This will allow it to use a transaction if one already exists, but if a transaction does not exist, it will not create one.


    2nd Q:
    Use early binding along with CreateObject.
    example
    dim objMyObject as ProjectDLL.MyClass
    set objMyObject = ObjectContext.CreateInstance("ProjectDLL.MyClass")

    This will give you better performance than late binding, but if the component you are calling uses transactions, it must be in its own context managed by MTS. CreateInstance facilitates this.

    Hope this helps

    Tom

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width