DbContext::SaveChangesAsync Method (CancellationToken)
[This page is specific to the Entity Framework version 6. The latest version is available as the 'Entity Framework' NuGet package. For more information about Entity Framework, see msdn.com/data/ef.]
Asynchronously saves all changes made in this context to the underlying database.
Assembly: EntityFramework (in EntityFramework.dll)
[SuppressMessageAttribute(L"Microsoft.Usage", L"CA1801:ReviewUnusedParameters", MessageId = L"cancellationToken")] public: virtual Task<int>^ SaveChangesAsync( CancellationToken cancellationToken )
Parameters
- cancellationToken
- Type: System.Threading::CancellationToken
A CancellationToken to observe while waiting for the task to complete.
Return Value
Type: System.Threading.Tasks::Task<Int32>A task that represents the asynchronous save operation. The task result contains the number of objects written to the underlying database.
| Exception | Condition |
|---|---|
| InvalidOperationException | Thrown if the context has been disposed. |
Show: