Session.SaveAsync(Object, CancellationToken) Method
Asynchronously saves the specified persistent object to a data store.
Namespace: DevExpress.Xpo
Assembly: DevExpress.Xpo.v24.2.dll
Declaration
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