Freshers Aptitude technical questions
Freshers Job Alert
Bookmark and Share

Details/Methods of ObjectContext

You can use the ObjectContext object to either commit or abort a transaction, managed by Component Services, that has been initiated by a script contained in an ASP page.

When an .asp file contains the @TRANSACTION directive, the page runs in a transaction and does not finish processing until the transaction either succeeds completely or fails.

Syntax

ObjectContext . method

Methods

SetAbort

The SetAbort method declares that the transaction initiated by the script has not completed and the resources should not be updated.

SetComplete

The SetComplete method declares that the script is not aware of any reason for the transaction not to complete. If all components participating in the transaction also call SetComplete , the transaction will complete.

Events

OnTransactionAbort

OnTransactionCommit

Remarks

ObjectContext implements two methods of the COM ObjectContext object. The SetAbort method explicitly aborts the transaction. This causes Component Services to prevent any updates to resources that were contacted during the first phase of the transaction. When the transaction aborts, the script's OnTransactionAbort event will be processed.

Calling the SetComplete method does not necessarily mean that the transaction is complete. The transaction will only complete if all of the transactional components called by the script call SetComplete . In most instances, you will not need to call SetComplete within the script, as the script is assumed to be complete if it finishes processing without calling SetAbort .

ObjectContext exposes methods in addition to SetAbort and SetComplete . These other methods are not available to scripts in ASP scripts; however, they are available to components called by the script.