Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

When to use GetObjectContext?

When to use GetObjectContext?

When to use GetObjectContext?

I am writing a number of components which will run in MTS.

I know that I need to call GetObjectContext / SetComplete / SetAbort in the public methods of these objects, but do I also need to do this in the private methods that the public methods call? What about functions/subroutines that are in normal bas modules but are called by the public/private methods?

Thanks for any help,

RE: When to use GetObjectContext?


There is slightly more to this then you are thinking. As part of your system design you need to think about the transactional desighn. For example If I want to update 2 tables I could do this in one transaction, so that if anything goes wrong with either update then niether is updated. or I could design it so that they are seperate so if something goes wrong in one update the other update is still completed.

Once you know where your transaction baoundaries are you can start implementing this in code. When you create an object in MTS call getObjectContext, in effect this is the start of your transaction. when the transaction boundary is reached you call SetComplete if it was successfull or setAbort if it fails. Any made between these two points will be commited or aborted at this point.


RE: When to use GetObjectContext?

SetComplete/SetAbort will tell the MTS executive whether the operation is successful by changing a flag in object context.
Even if your operation doesnot need transaction eg. getting data from DBMS,you can also call SetComplete/SetAbort:
  //get_data from db
Maybe it is not necessary but it will simplify your programming without any side effect.


Long live of freedom!

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close