共用方式為


Application Programmer's View of Transactions

 

Applies To: Windows 10, Windows 7, Windows 8, Windows 8.1, Windows Server 2008, Windows Server 2008 R2, Windows Server 2012, Windows Server 2012 R2, Windows Server Technical Preview, Windows Vista

The application programmer's transaction model is simple—programs either succeed or fail. When the application program begins a transaction, it gets a transaction object. All subsequent work is associated with that transaction object. When the program reaches a consistent state, it calls the Commit method. If the commit succeeds, the transaction is durably committed. If the commit fails, the transaction aborts. If the application program can't successfully complete the transaction, it can call the Abort method to undo the transaction's effects.

If the program fails before it commits the transaction, the transaction manager aborts the transaction and informs each enlisted resource manager to rollback the transaction's effects. If either the computer or resource manager fails, the transaction is also aborted.

If the transaction successfully commits, the resource managers and the transaction manager ensure that the transaction's effects are durable, even if there are subsequent failures.

See Also

Commit Coordination
How Distributed Transactions Work
Resource Manager's Role in Transactions
Transaction Manager's Role in Transactions