public void Delete(WorkItemBase item) { if (item == null) { throw new ArgumentException("item is null"); } try { VersionedId rootId = VersionedId.Deserialize(item.WorkItemId); using (UnifiedPolicySyncNotificationDataProvider dataProvider = this.GetDataProvider(item.TenantContext.TenantId)) { UnifiedPolicyNotificationBase[] array = (UnifiedPolicyNotificationBase[])dataProvider.Find <UnifiedPolicyNotificationBase>(null, rootId, false, null); if (array != null && array.Length > 0) { dataProvider.Delete(array[0]); } } } catch (ObjectNotFoundException) { } catch (StorageTransientException innerException) { throw new SyncAgentTransientException("Failed to delete sync workitem from persistent queue because of StorageTransientException", innerException); } catch (StoragePermanentException innerException2) { throw new SyncAgentPermanentException("Failed to delete sync workitem from persistent queue because of StoragePermanentException", innerException2); } catch (TransientException innerException3) { throw new SyncAgentTransientException("Failed to delete sync workitem from persistent queue because of TransientException", innerException3); } catch (DataSourceOperationException innerException4) { throw new SyncAgentPermanentException("Failed to delete sync workitem from persistent queue because of DataSourceOperationException", innerException4); } catch (DataValidationException innerException5) { throw new SyncAgentPermanentException("Failed to delete sync workitem from persistent queue because of DataValidationException", innerException5); } }
public WorkItemBase Get(ObjectId identity, Guid tenantId) { try { using (UnifiedPolicySyncNotificationDataProvider dataProvider = this.GetDataProvider(tenantId)) { UnifiedPolicyNotificationBase[] array = (UnifiedPolicyNotificationBase[])dataProvider.Find <UnifiedPolicyNotificationBase>(null, identity, false, null); if (array != null && array.Length > 0) { return(array[0].GetWorkItem()); } } } catch (ObjectNotFoundException) { } catch (StorageTransientException innerException) { throw new SyncAgentTransientException("Failed to get sync workitem in persistent queue because of StorageTransientException", innerException); } catch (StoragePermanentException innerException2) { throw new SyncAgentPermanentException("Failed to get sync workitem in persistent queue because of StoragePermanentException", innerException2); } catch (TransientException innerException3) { throw new SyncAgentTransientException("Failed to get sync workitem in persistent queue because of TransientException", innerException3); } catch (DataSourceOperationException innerException4) { throw new SyncAgentTransientException("Failed to get sync workitem in persistent queue because of DataSourceOperationException", innerException4); } catch (DataValidationException innerException5) { throw new SyncAgentTransientException("Failed to get sync workitem in persistent queue because of DataValidationException", innerException5); } return(null); }