How Can Business Connectivity Services Solutions Learn About Deletions in the External Data Source?

Applies to: SharePoint Server 2010

The client can learn about the deletions if using the operation mode as Online when making the method instance calls and receive an ObjectNotFoundException or ObjectDeletedException. However, if using the Cached mode, there is no way for the client application to know upfront that one or more entity instances have been deleted in the external application by another user or application.

During cache refresh, the sync process tries to execute all the queries and if all the queries were successful for a subscription and the subscription’s refresh interval has passed, it deletes all entity instances that were not returned by any of the queries as this means that they do not exist in the external application any more.

When the sync process executes an operation in the queue and if a call to the SpecificFinder throws an ObjectNotFoundException or ObjectDeletedException, it means that another user or another application deleted this entity instance in the external application. In that case, the sync process checks the queue for pending operations on that entity instance. If there are no pending operations, it marks the entity instance as deleted. If there is only a pending Delete operation, then it marks the operation as successful and marks the instance as deleted. If there are other pending operations, it marks the operations as failed and marks the entity instance as InError.