IdeaBlade DevForce 2010 Help Reference
SaveChangesAsync(Action<EntitySaveOperation>,Object) Method
See Also  Example Send Feedback
IdeaBlade.EntityModel Assembly > IdeaBlade.EntityModel Namespace > EntityManager Class > SaveChangesAsync Method : SaveChangesAsync(Action<EntitySaveOperation>,Object) Method



userCallback
Callback invoked when asynchronous operation completes
userState
Token identifying the asynchronous operation
Perform an asynchronous EntityManager.SaveChanges operation.

Syntax

Visual Basic (Declaration) 
Public Overloads Function SaveChangesAsync( _
   ByVal userCallback As Action(Of EntitySaveOperation), _
   Optional ByVal userState As Object _
) As EntitySaveOperation
Visual Basic (Usage)Copy Code
Dim instance As EntityManager
Dim userCallback As Action(Of EntitySaveOperation)
Dim userState As Object
Dim value As EntitySaveOperation
 
value = instance.SaveChangesAsync(userCallback, userState)
C++/CLI 
public:
EntitySaveOperation^ SaveChangesAsync( 
   Action<EntitySaveOperation^>^ userCallback,
   Object^ userState
) 

Parameters

userCallback
Callback invoked when asynchronous operation completes
userState
Token identifying the asynchronous operation

Example

C#Copy Code
public 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.
  // Use a lambda expression which takes the EntitySaveOperation.
  // The userstate token is left null since it's optional.
  mgr.SaveChangesAsync(op => {
    SaveResult sr = op.SaveResult;
    MessageBox.Show(sr.Ok.ToString());
  }, null);
}

Remarks

Provide a userCallback if you want to be notified when the operation completes. The EntitySaveOperation passed to the userCallback will contain the results of the save operation. Use the userState to uniquely identify this call. You can cancel a pending asynchronous call using EntitySaveOperation.Cancel().

Requirements

Target Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family

See Also

© 2013 All Rights Reserved.