Skip to main content
.NET 6.0+

Session.Save(Object) Method

Saves the specified persistent object to a data store.

Namespace: DevExpress.Xpo

Assembly: DevExpress.Xpo.v23.2.dll

NuGet Package: DevExpress.Xpo

Declaration

public void Save(
    object theObject
)

Parameters

Name Type Description
theObject Object

An object which represents the persistent object to save.

Remarks

Below is an example of using the Save method. Here, session is the Session instance.

Person personToUpdate = session.FindObject<Person>(CriteriaOperator.Parse("Name='Michael Suyama'"));
personToUpdate.Birthday = new DateTime(1986, 10, 31);
session.Save(personToUpdate);

The Save method also saves all the referenced objects that are aggregated (see the AggregatedAttribute topic for information) and any referenced newly created non-aggregated objects that don’t yet exist in the data store.

Note

The Save method saves the object immediately when the current persistent object is loaded using Session. If the UnitOfWork is used, the method marks the persistent object as modified and forces the UnitOfWork to include it into the further commit operation. UnitOfWork automatically collects new objects and tracks modified objects using the OnChanged method.

The following code snippets (auto-collected from DevExpress Examples) contain references to the Save(Object) 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.

See Also