All docs
V21.1
21.1
20.2
20.1
19.2
The page you are viewing does not exist in version 19.2. This link will take you to the root page.
19.1
The page you are viewing does not exist in version 19.1. This link will take you to the root page.
18.2
The page you are viewing does not exist in version 18.2. This link will take you to the root page.
18.1
The page you are viewing does not exist in version 18.1. This link will take you to the root page.
17.2
The page you are viewing does not exist in version 17.2. This link will take you to the root page.
.NET Framework 4.5.2+
.NET Framework 4.5.2+
.NET Standard 2.0+

Session.SaveAsync(Object, CancellationToken) Method

Asynchronously saves the specified persistent object to a data store.

Namespace: DevExpress.Xpo

Assembly: DevExpress.Xpo.v21.1.dll

Declaration

public Task SaveAsync(
    object theObject,
    CancellationToken cancellationToken = default(CancellationToken)
)

Parameters

Name Type Description
theObject Object

An object which represents the persistent object to save.

Optional Parameters

Name Type Default Description
cancellationToken CancellationToken

null

A CancellationToken object that delivers a cancellation notice to the running operation.

Returns

Type Description
Task

A Task that saves the specified persistent object to a data store.

Remarks

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

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

The SaveAsync 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.

See Also