Skip to main content
.NET 6.0+

Session.Reload(Object) Method

Reloads the state of the specified persistent object from the data store.

Namespace: DevExpress.Xpo

Assembly: DevExpress.Xpo.v23.2.dll

NuGet Package: DevExpress.Xpo

Declaration

public void Reload(
    object theObject
)

Parameters

Name Type Description
theObject Object

An object which represents the persistent object whose state needs to be reloaded.

Remarks

Use the Reload method to refresh a persistent object’s state. A CannotLoadObjectsException is thrown if the specified persistent object is permanently deleted from the data store. This method removes the passed object from the list of objects to be persisted via the Session.CommitTransaction method.

The Reload 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 Session and current object, and load it from a new Session. This method should never be used within the NestedUnitOfWork.

The Reload method does nothing if the specified persistent object is a new object. To ensure that the persistent object is not a new object, use the Session.IsNewObject property.

See Also