Skip to content

Latest commit

 

History

History
109 lines (92 loc) · 4.82 KB

nf-comsvcs-iobjectcontext-disablecommit.md

File metadata and controls

109 lines (92 loc) · 4.82 KB
UID title description helpviewer_keywords old-location tech.root ms.assetid ms.date ms.keywords req.header req.include-header req.target-type req.target-min-winverclnt req.target-min-winversvr req.kmdf-ver req.umdf-ver req.ddi-compliance req.unicode-ansi req.idl req.max-support req.namespace req.assembly req.type-library req.lib req.dll req.irql targetos req.typenames req.redist ms.custom f1_keywords dev_langs topic_type api_type api_location api_name
NF:comsvcs.IObjectContext.DisableCommit
IObjectContext::DisableCommit (comsvcs.h)
Declares that the object's transactional updates are in an inconsistent state and cannot be committed in their present state.
DisableCommit
DisableCommit method [COM+]
DisableCommit method [COM+]
IObjectContext interface
IObjectContext interface [COM+]
DisableCommit method
IObjectContext.DisableCommit
IObjectContext::DisableCommit
_cos_IObjectContext_DisableCommit
comsvcs/IObjectContext::DisableCommit
cos.iobjectcontext_disablecommit
cos\iobjectcontext_disablecommit.htm
cos
e83d1223-9b8e-4a92-b98d-9d2b6ed34721
12/05/2018
DisableCommit, DisableCommit method [COM+], DisableCommit method [COM+],IObjectContext interface, IObjectContext interface [COM+],DisableCommit method, IObjectContext.DisableCommit, IObjectContext::DisableCommit, _cos_IObjectContext_DisableCommit, comsvcs/IObjectContext::DisableCommit, cos.iobjectcontext_disablecommit
comsvcs.h
Windows
Windows 2000 Professional [desktop apps only]
Windows 2000 Server [desktop apps only]
Windows
19H1
IObjectContext::DisableCommit
comsvcs/IObjectContext::DisableCommit
c++
APIRef
kbSyntax
COM
ComSvcs.h
IObjectContext.DisableCommit

IObjectContext::DisableCommit

-description

Declares that the object's transactional updates are in an inconsistent state and cannot be committed in their present state.

-returns

This method can return the following values.

Return code Description
S_OK
The method completed successfully. The object's transactional updates cannot be committed until the object calls either EnableCommit or SetComplete.
E_UNEXPECTED
An unexpected error occurred. This can happen if one object passes its IObjectContext pointer to another object and the other object calls DisableCommit using this pointer. An IObjectContext pointer is not valid outside the context of the object that originally obtained it.
CONTEXT_E_NOCONTEXT
The current object does not have a context associated with it. This is probably because it was not created with one of the COM+ CreateInstance methods.

-remarks

You can use the DisableCommit method to prevent a transaction from committing prematurely between method calls in a stateful object. When an object invokes DisableCommit, it indicates that its work is inconsistent and that it cannot complete its work until it receives further method invocations from the client. It also indicates that it needs to maintain its state to perform that work. This prevents COM+ from deactivating the object and reclaiming its resources on return from a method call. When an object has called DisableCommit, if a client attempts to commit the transaction before the object has called EnableCommit or SetComplete, the transaction aborts.

For example, suppose you have a GeneralLedger component that updates a database. A client makes multiple calls to a GeneralLedger object to post entries to various accounts. There's an integrity constraint that says the debits must equal the credits when the final method invocation returns, or the transaction must abort. The GeneralLedger object has an initialization method in which the client informs it of the sequence of calls the client is going to make, and the GeneralLedger object calls DisableCommit. The object maintains its state between calls so that, after the final call in the sequence is made, the object can make sure the integrity constraint is satisfied before allowing its work to be committed.

-see-also

IObjectContext