Session.GetObjectsToSave() Method
Returns a collection of objects that will be saved when the current transaction is committed.
Namespace: DevExpress.Xpo
Assembly: DevExpress.Xpo.v25.2.dll
NuGet Package: DevExpress.Xpo
Declaration
Returns
| Type | Description |
|---|---|
| ICollection | The collection of persistent objects that will be saved when the current transaction is committed. |
Remarks
For general information on saving persistent objects, see Persisting Objects.
Objects that have Deferred Deletion enabled are actually modified upon deletion. So, they appear in the collection returned by the Session.GetObjectsToSave method, not in the collection returned by the Session.GetObjectsToDelete method.
The Session.GetObjectsToSave and Session.GetObjectsToDelete methods do not create new collection instances and fill them with objects when called. Instead, these methods return references to internal collections whose content changes throughout the life cycle of a Session.
ICollection changedObjects = myUnitOfWork.GetObjectsToSave();
int count = changedObject.Count; // 'count' is an arbitrary number
myUnitOfWork.CommitChanges();
count = changedObject.Count; // here, 'count' always equals zero
Related GitHub Examples
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the GetObjectsToSave() 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.