Windows Phone 7 Database Rapid Repository V2.0 Examining Operation Requests

Rapid Repository is a Windows Phone 7 Database and Silverlight Isolated Storage Database.

Download Rapid Repository from Microsoft Codeplex

Blog Tutorials

If you need to examine the pending operation requests or even remove pending requests before calling SaveChanges() you can access them through the following property:

Examine Operation Requests
  1. public void ExamineOperationRequests()
  2. {
  3.     List<OperationRequest> requests = RapidContext.CurrentContext.OperationRequests;
  4. }

 

If you need to delete a request or all off the requests you can use the following methods:

Operation Request Methods
  1. public void ExamineOperationRequests()
  2. {
  3.     List<OperationRequest> requests = RapidContext.CurrentContext.OperationRequests;
  4.  
  5.     RapidContext.CurrentContext.DeleteOperationRequest(requests.First());
  6.  
  7.     RapidContext.CurrentContext.DeleteAllOperationRequests();
  8. }

 

The operation request class has the following properties you can use for examination:

Operation Requests Properties
  1. /// <summary>
  2. /// Gets or sets the entity id.
  3. /// </summary>
  4. /// <value>The entity id.</value>
  5. public Guid EntityId { get; private set; }
  6.  
  7. /// <summary>
  8. /// Gets or sets the entity.
  9. /// </summary>
  10. /// <value>The entity.</value>
  11. public object Entity { get; private set; }
  12.  
  13. /// <summary>
  14. /// Gets or sets the type of the entity.
  15. /// </summary>
  16. /// <value>The type of the entity.</value>
  17. public Type EntityType { get; private set; }
  18.  
  19. /// <summary>
  20. /// Gets or sets the type of the operation.
  21. /// </summary>
  22. /// <value>The type of the operation.</value>
  23. public OperationRequestType OperationRequestType { get; private set; }

 

Summary

Although I don’t imagine this will be used often, it’s a feature that is there just in case, i imagine it will mostly be used in cases where compensation for transactions is required.

In the next version of Rapid Repository, there will be transactional support which should further remove the need for this feature, it will stay in though.

Sean McAlinden.

No Comments