.NET Framework 4.5.2+
.NET Framework 4.5.2+
.NET Standard 2.0+

Session.Reload(Object, Boolean) Method

Reloads the state of the specified persistent object and its aggregated objects from the data store, recursively.

Namespace: DevExpress.Xpo

Assembly: DevExpress.Xpo.v21.2.dll


public void Reload(
    object theObject,
    bool forceAggregatesReload


Name Type Description
theObject Object

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

forceAggregatesReload Boolean

true, to recursively reload the state of aggregated objects; otherwise, false.


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