I have this client application that sends thousands of items for deletion to my wcf service. Since the data is sent in bulk, even if I cancel the operation (with progress bar), all items are deleted. The behavior I want is to be able to cancel the delete operation in the service and retrieve items that are not deleted. Thank you.
What InstanceContextMode are you using?
What you want to do will work with InstanceContextMode Singleton or Session, but not PerCall.
I suppose that your method that initiates the delete in bulk operation is OneWay.
Create a bool field (initially false) in your service. Your loop that deletes records one by one checks that flag and stops if the flag is true.
Create another method in your service that sets that field to true. Call the new method from your website when you press the "Cancel Delete" button. The looop for deleting records will break.
Returning the records that were not deleted will be a bit tricky. Your list of records to delete will need to be a memebr of the service class also, so that the method that stops the delete has access to the list also. The method that deletes from the db shoulkd also remove the records from the list one by one so you can keep track of remaining items.
You could return immediately in the second method the list, but thia does not guarantee accurate results. What I would do is do a wait of 200 ms before returning. That way you know that the item removed from the list is really deleted in the db.
Hope this is clear...