Beispiel #1
0
 public void Update(WorkItemBase item)
 {
     if (item == null)
     {
         throw new ArgumentException("item is null");
     }
     if (item.WorkItemId == null)
     {
         throw new ArgumentException("WorkItemId can't be null inside Update");
     }
     try
     {
         using (UnifiedPolicySyncNotificationDataProvider dataProvider = this.GetDataProvider(item.TenantContext.TenantId))
         {
             UnifiedPolicyNotificationBase unifiedPolicyNotificationBase = UnifiedPolicyNotificationFactory.Create(item, dataProvider.MailboxOwner.Id);
             unifiedPolicyNotificationBase.ResetChangeTracking(true);
             unifiedPolicyNotificationBase.Version = Guid.NewGuid();
             dataProvider.Save(unifiedPolicyNotificationBase);
         }
     }
     catch (ObjectNotFoundException)
     {
     }
     catch (StorageTransientException innerException)
     {
         throw new SyncAgentTransientException("Failed to update sync workitem in persistent queue because of StorageTransientException", innerException);
     }
     catch (StoragePermanentException innerException2)
     {
         throw new SyncAgentPermanentException("Failed to update sync workitem in persistent queue because of StoragePermanentException", innerException2);
     }
     catch (TransientException innerException3)
     {
         throw new SyncAgentTransientException("Failed to update sync workitem in persistent queue because of TransientException", innerException3);
     }
     catch (DataSourceOperationException innerException4)
     {
         throw new SyncAgentTransientException("Failed to update sync workitem in persistent queue because of DataSourceOperationException", innerException4);
     }
     catch (DataValidationException innerException5)
     {
         throw new SyncAgentTransientException("Failed to update sync workitem in persistent queue because of DataValidationException", innerException5);
     }
 }
Beispiel #2
0
 public void Enqueue(WorkItemBase item)
 {
     if (item == null)
     {
         throw new ArgumentException("item is null");
     }
     try
     {
         using (UnifiedPolicySyncNotificationDataProvider dataProvider = this.GetDataProvider(item.TenantContext.TenantId))
         {
             UnifiedPolicyNotificationBase unifiedPolicyNotificationBase = UnifiedPolicyNotificationFactory.Create(item, dataProvider.MailboxOwner.Id);
             dataProvider.Save(unifiedPolicyNotificationBase);
             item.HasPersistentBackUp = true;
             item.WorkItemId          = unifiedPolicyNotificationBase.StoreObjectId.ToBase64String();
         }
     }
     catch (StorageTransientException innerException)
     {
         throw new SyncAgentTransientException("Failed to enqueue sync workitem into persistent queue because of StorageTransientException", innerException);
     }
     catch (StoragePermanentException innerException2)
     {
         throw new SyncAgentPermanentException("Failed to enqueue sync workitem into persistent queue because of StoragePermanentException", innerException2);
     }
     catch (TransientException innerException3)
     {
         throw new SyncAgentTransientException("Failed to enqueue sync workitem into persistent queue because of TransientException", innerException3);
     }
     catch (DataSourceOperationException innerException4)
     {
         throw new SyncAgentTransientException("Failed to enqueue sync workitem into persistent queue because of DataSourceOperationException", innerException4);
     }
     catch (DataValidationException innerException5)
     {
         throw new SyncAgentTransientException("Failed to enqueue sync workitem into persistent queue because of DataValidationException", innerException5);
     }
 }