Back to Devexpress

Session.FailedCommitTransaction Event

xpo-devexpress-dot-xpo-dot-session-e97b4ba0.md

latest3.2 KB
Original Source

Session.FailedCommitTransaction Event

Occurs when the Commit Transaction operation fails due to database constraints or other circumstances.

Namespace : DevExpress.Xpo

Assembly : DevExpress.Xpo.v25.2.dll

NuGet Package : DevExpress.Xpo

Declaration

csharp
public event SessionOperationFailEventHandler FailedCommitTransaction
vb
Public Event FailedCommitTransaction As SessionOperationFailEventHandler

Event Data

The FailedCommitTransaction event's data class is SessionOperationFailEventArgs. The following properties provide information specific to this event:

PropertyDescription
ExceptionGets the exception thrown by a database when committing a transaction or changes made to persistent objects.
HandledSpecifies whether the default processing of an exception is prohibited.

Remarks

This event occurs, for instance, when an exception is thrown when performing the Commit Transaction operation (Session.CommitTransaction, ExplicitUnitOfWork.CommitTransaction, Session.CommitTransactionAsync, or ExplicitUnitOfWork.CommitTransactionAsync). The Exception parameter allows you to identify the current exception. To respond to the exception, use the Handled parameter.

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the FailedCommitTransaction event.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

XAF_generate-a-sequential-number-for-a-persistent-object-within-a-database-transaction/CS/XPO/SequenceGenerator/SequenceGenerator.Module/SequenceClasses/UserFriendlyIdPersistentObject.cs#L87

csharp
Session.AfterRollbackTransaction += Session_AfterRollBack;
    Session.FailedCommitTransaction += Session_FailedCommitTransaction;
}

See Also

Session Class

Session Members

DevExpress.Xpo Namespace