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

Session.Save(Object) Method

Saves the specified persistent object to a data store.

Namespace: DevExpress.Xpo

Assembly: DevExpress.Xpo.v21.2.dll


public void Save(
    object theObject


Name Type Description
theObject Object

An object which represents the persistent object to save.


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);

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.


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.

See Also