IdeaBlade.EntityModel Assembly > IdeaBlade.EntityModel Namespace > EntityManager Class : SaveChangesAsync Method |
'Declaration
<AsyncStateMachineAttribute(IdeaBlade.EntityModel.EntityManager+d__152)> Public Function SaveChangesAsync( _ Optional ByVal saveOptions As SaveOptions _ ) As Task
'Usage
Dim instance As EntityManager Dim saveOptions As SaveOptions Dim value As Task value = instance.SaveChangesAsync(saveOptions)
[AsyncStateMachine(IdeaBlade.EntityModel.EntityManager+d__152)] public Task SaveChangesAsync( SaveOptions saveOptions )
Exception | Description |
---|---|
EntityManagerSaveException | Thrown for save exceptions not handled by an EntityServerError handler |
System.OperationCanceledException | Thrown if the save was cancelled |
If the save fails an EntityManagerSaveException will be thrown.
If the save is cancelled an System.OperationCanceledException will be thrown.
The asynchronous save task itself cannot be cancelled. However, you can cancel the save process on the client before the save starts in a Saving event handler. You can also cancel the save process on the server in an EntityServerSaveInterceptor prior to executing the save to the data source.
public async void AsyncSaveSimple() { DomainModelEntityManager mgr = new DomainModelEntityManager(); Customer c1 = new Customer() { CompanyName = "Toys R Us" }; mgr.AddEntity(c1); Customer c2 = new Customer() { CompanyName = "Apple" }; mgr.AddEntity(c2); // Save all modified entities using default SaveOptions. await mgr.SaveChangesAsync(); }
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2