Back to Devexpress

UnitOfWork.ReloadChangedObjects() Method

xpo-devexpress-dot-xpo-dot-unitofwork-390d7eb7.md

latest3.5 KB
Original Source

UnitOfWork.ReloadChangedObjects() Method

Reloads the state of persistent objects modified within the current UnitOfWork from the data store.

Namespace : DevExpress.Xpo

Assembly : DevExpress.Xpo.v25.2.dll

NuGet Package : DevExpress.Xpo

Declaration

csharp
public void ReloadChangedObjects()
vb
Public Sub ReloadChangedObjects

Remarks

The ReloadChangedObjects method reloads the object state from the store, but since partial reloading might lead to an inconsistency, the recommended approach is to dispose of the current UnitOfWork and loaded objects, and load them from a new Session. This method should never be used within the NestedUnitOfWork.

To reload the state of an individual persistent object, use the XPBaseObject.Reload method.

csharp
try {
    unitOfWork.CommitChanges();
} catch(LockingException ex) {
    unitOfWork.ReloadChangedObjects();
}
vb
Try
    unitOfWork.CommitChanges()
Catch ex As LockingException
    unitOfWork.ReloadChangedObjects()
End Try

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

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.

XDL_how-to-convert-the-criteriaoperator-to-a-lambda-expression-to-use-it-for-iqueryable-e2596/CS/WindowsFormsApplication152/Form1.cs#L79

csharp
MessageBox.Show(exc.ToString());
    unitOfWork1.ReloadChangedObjects();
}

XDL_how-to-convert-the-criteriaoperator-to-a-lambda-expression-to-use-it-for-iqueryable-e2596/VB/WindowsFormsApplication152/Form1.vb#L58

vb
Call MessageBox.Show(exc.ToString())
    unitOfWork1.ReloadChangedObjects()
End Try

See Also

Reload()

RollbackTransaction()

AfterBeginTransaction

AfterCommitTransaction

AfterRollbackTransaction

UnitOfWork Class

UnitOfWork Members

DevExpress.Xpo Namespace