コード例 #1
0
 public AggregateOperationResult DeleteCustomSyncState(SyncStateInfo syncStateInfo)
 {
     this.CheckDisposed("DeleteCustomSyncState");
     this.syncLogger.Information <int>(ExTraceGlobals.SyncTracer, (long)this.GetHashCode(), "[SyncStateStorage.DeleteCustomSyncState] Hashcode = {0}", this.GetHashCode());
     ArgumentValidator.ThrowIfNull("syncStateInfo", syncStateInfo);
     return(this.InternalDeleteSyncState(syncStateInfo.UniqueName));
 }
コード例 #2
0
 public CustomSyncState CreateCustomSyncState(SyncStateInfo syncStateInfo)
 {
     this.CheckDisposed("CreateCustomSyncState");
     this.syncLogger.Information <int>(ExTraceGlobals.SyncTracer, (long)this.GetHashCode(), "SyncStateStorage::CreateCustomSyncState. Hashcode = {0}", this.GetHashCode());
     if (syncStateInfo == null)
     {
         throw new ArgumentNullException("syncStateInfo");
     }
     return(CustomSyncState.CreateSyncState(this, syncStateInfo, this.folder, this.syncLogger));
 }
コード例 #3
0
        public CustomSyncState GetCustomSyncState(SyncStateInfo syncStateInfo, params PropertyDefinition[] additionalPropsToFetch)
        {
            this.CheckDisposed("GetCustomSyncState");
            this.syncLogger.Information <int>(ExTraceGlobals.SyncTracer, (long)this.GetHashCode(), "SyncStateStorage::GetCustomSyncState. Hashcode = {0}", this.GetHashCode());
            this.GetMailboxSession();
            CustomSyncState result = null;

            try
            {
                result = CustomSyncState.GetSyncState(this, this.folder, syncStateInfo, this.syncLogger, additionalPropsToFetch);
            }
            catch (ObjectNotFoundException arg)
            {
                this.syncLogger.TraceDebug <string, ObjectNotFoundException>(ExTraceGlobals.SyncTracer, (long)this.GetHashCode(), "[SyncStateStorage.GetCustomSyncState] Hark! SyncState {0} was not found.  Exception: {1}", syncStateInfo.UniqueName, arg);
            }
            return(result);
        }
コード例 #4
0
 public CustomSyncState GetCustomSyncState(SyncStateInfo syncStateInfo)
 {
     base.CheckDisposed();
     return(this.syncStateStorage.GetCustomSyncState(syncStateInfo, new PropertyDefinition[0]));
 }
コード例 #5
0
 public AggregateOperationResult DeleteCustomSyncState(SyncStateInfo syncStateInfo)
 {
     base.CheckDisposed();
     return(this.syncStateStorage.DeleteCustomSyncState(syncStateInfo));
 }
コード例 #6
0
 public CustomSyncState CreateCustomSyncState(SyncStateInfo syncStateInfo)
 {
     base.CheckDisposed();
     return(this.syncStateStorage.CreateCustomSyncState(syncStateInfo));
 }
コード例 #7
0
 protected FolderHierarchySyncState(SyncStateStorage syncStateStorage, StoreObject storeObject, SyncStateMetadata syncStateMetadata, SyncStateInfo syncStateInfo, bool newSyncState, ISyncLogger syncLogger = null) : base(syncStateStorage, storeObject, syncStateMetadata, syncStateInfo, newSyncState, syncLogger)
 {
 }
コード例 #8
0
        protected static StoreObject GetSyncStateStoreObject(SyncStateStorage syncStateStorage, Folder syncStateParentFolder, SyncStateInfo syncStateInfo, byte[] identBytes, ISyncLogger syncLogger, params PropertyDefinition[] propsToReturn)
        {
            FolderSyncStateMetadata folderSyncStateMetadata = FolderSyncState.GetFolderSyncStateMetadata(syncStateStorage, syncStateParentFolder.Session as MailboxSession, syncStateInfo.UniqueName, syncLogger);

            if (folderSyncStateMetadata == null)
            {
                return(null);
            }
            StoreObject storeObject = null;

            if (folderSyncStateMetadata.StorageType != StorageType.Folder)
            {
                if (folderSyncStateMetadata.StorageType != StorageType.Item)
                {
                    if (folderSyncStateMetadata.StorageType != StorageType.DirectItem)
                    {
                        goto IL_85;
                    }
                }
                try
                {
                    storeObject = Microsoft.Exchange.Data.Storage.Item.Bind(syncStateParentFolder.Session, folderSyncStateMetadata.ItemSyncStateId, SyncState.AppendAdditionalProperties(propsToReturn));
                    ((Item)storeObject).OpenAsReadWrite();
                    return(storeObject);
                }
                catch
                {
                    storeObject.Dispose();
                    throw;
                }
IL_85:
                throw new InvalidOperationException("Unsupported storage type for sync state");
            }
            storeObject = Folder.Bind(syncStateParentFolder.Session, folderSyncStateMetadata.FolderSyncStateId, SyncState.AppendAdditionalProperties(propsToReturn));
            return(storeObject);
        }
コード例 #9
0
 protected FolderSyncState(SyncStateStorage syncStateStorage, StoreObject storeObject, FolderSyncStateMetadata syncStateMetadata, SyncStateInfo syncStateInfo, ISyncProviderFactory syncProviderFactory, bool newSyncState, ISyncLogger syncLogger = null) : base(syncStateStorage, storeObject, syncStateMetadata, syncStateInfo, newSyncState, syncLogger)
 {
     this.syncProviderFactory = syncProviderFactory;
 }
コード例 #10
0
 protected CustomSyncState(SyncStateStorage syncStateStorage, StoreObject storeObject, SyncStateMetadata syncStateMetadata, SyncStateInfo syncStateInfo, bool syncStateIsNew) : base(syncStateStorage, storeObject, syncStateMetadata, syncStateInfo, syncStateIsNew, null)
 {
 }
コード例 #11
0
        internal static CustomSyncState GetSyncState(SyncStateStorage syncStateStorage, Folder syncStateParentFolder, SyncStateInfo syncStateInfo, ISyncLogger syncLogger, params PropertyDefinition[] propertiesToFetch)
        {
            if (syncLogger == null)
            {
                syncLogger = TracingLogger.Singleton;
            }
            SyncStateMetadata syncStateMetadata    = null;
            StoreObject       syncStateStoreObject = SyncState.GetSyncStateStoreObject(syncStateStorage, syncStateParentFolder, syncStateInfo, syncLogger, out syncStateMetadata, propertiesToFetch);

            if (syncStateStoreObject == null)
            {
                return(null);
            }
            return(new CustomSyncState(syncStateStorage, syncStateStoreObject, syncStateMetadata, syncStateInfo, false));
        }
コード例 #12
0
 internal static CustomSyncState GetSyncState(SyncStateStorage syncStateStorage, Folder syncStateParentFolder, SyncStateInfo syncStateInfo, ISyncLogger syncLogger = null)
 {
     return(CustomSyncState.GetSyncState(syncStateStorage, syncStateParentFolder, syncStateInfo, syncLogger, null));
 }
コード例 #13
0
        internal static CustomSyncState CreateSyncState(SyncStateStorage syncStateStorage, SyncStateInfo syncStateInfo, Folder syncStateParentFolder, ISyncLogger syncLogger = null)
        {
            if (syncLogger == null)
            {
                syncLogger = TracingLogger.Singleton;
            }
            StoreObject storeObject = SyncState.CreateSyncStateStoreObject(syncStateStorage, syncStateInfo, syncStateParentFolder, null, null, syncLogger);

            if (syncStateStorage.DeviceMetadata.TryRemove(syncStateInfo.UniqueName, syncLogger) != null)
            {
                syncLogger.TraceDebug <DeviceIdentity, string>(ExTraceGlobals.SyncTracer, 0L, "[CustomSyncState.CreateSyncState] Removed stale cached sync state metadata for device {0}, sync state {1}", syncStateStorage.DeviceMetadata.Id, syncStateInfo.UniqueName);
            }
            SyncStateMetadata syncStateMetadata = (storeObject is Item) ? new SyncStateMetadata(syncStateStorage.DeviceMetadata, syncStateInfo.UniqueName, syncStateStorage.SaveOnDirectItems ? null : storeObject.ParentId, storeObject.Id.ObjectId) : new SyncStateMetadata(syncStateStorage.DeviceMetadata, syncStateInfo.UniqueName, storeObject.Id.ObjectId, null);

            return(new CustomSyncState(syncStateStorage, storeObject, syncStateMetadata, syncStateInfo, true));
        }