예제 #1
0
 public override void ProcessFullEnumerationChangeBatch(
     ConflictResolutionPolicy resolutionPolicy, FullEnumerationChangeBatch sourceChanges,
     object changeDataRetriever, SyncCallbacks syncCallbacks,
     SyncSessionStatistics sessionStatistics)
 {
     throw new NotImplementedException();
 }
예제 #2
0
        public byte[] ProcessFullEnumerationChangeBatch(int resolutionPolicy, byte[] sourceChanges,
                                                        byte[] rawChangeDataRetriever, byte[] changeApplierInfo)
        {
            GenericRemoteSyncProvider <EntityObjectHierarchy> provider = GetSessionProvider();

            byte[] retVal = null;
            try
            {
                FullEnumerationChangeBatch sourceChangeBatch =
                    FullEnumerationChangeBatch.Deserialize(provider.IdFormats, sourceChanges);
                CachedChangeDataRetriever chachedDataRetriever =
                    SerializerHelper.BinaryDeserialize <CachedChangeDataRetriever>(rawChangeDataRetriever);
                retVal = provider.ProcessRemoteFullEnumerationChangeBatch((ConflictResolutionPolicy)resolutionPolicy, sourceChangeBatch,
                                                                          chachedDataRetriever, changeApplierInfo);
            }
            catch (SyncException e)
            {
                throw SoapErrorCreator.RaiseException(HttpContext.Current.Request.Url.ToString(),
                                                      new SyncronizationServiceError(SyncronizationServiceError.eServiceErrorType.SyncFramework, e),
                                                      true);
            }
            catch (Exception e)
            {
                throw SoapErrorCreator.RaiseException(HttpContext.Current.Request.Url.ToString(),
                                                      new SyncronizationServiceError(SyncronizationServiceError.eServiceErrorType.SyncProvider, e),
                                                      true);
            }

            return(retVal);
        }
예제 #3
0
        //If full enumeration is needed because  this provider is out of date due to tombstone cleanup, then this method will be called by the engine.
        public virtual byte[] ProcessRemoteFullEnumerationChangeBatch(
            ConflictResolutionPolicy resolutionPolicy,
            FullEnumerationChangeBatch sourceChanges,
            object changeDataRetriever,
            byte[] changeApplierInfo)
        {
            BeginTransaction();

            //Get all my local change versions from the metadata store
            IEnumerable <ItemChange> localChanges = _metaData.GetFullEnumerationLocalVersions(sourceChanges);

            //Create a changeapplier object to make change application easier (make the engine call me
            //when it needs data and when I should save data)
            NotifyingChangeApplier changeApplier = new NotifyingChangeApplier(this.IdFormats);

            // The following step is required because we are remote change application
            changeApplier.LoadChangeApplierInfo(changeApplierInfo);

            changeApplier.ApplyFullEnumerationChanges(
                resolutionPolicy,
                sourceChanges,
                changeDataRetriever as IChangeDataRetriever,
                localChanges,
                _metaData.GetKnowledge(),
                _metaData.GetForgottenKnowledge(),
                this,
                null,                                    // Note that we do not pass a sync session context
                new SyncCallbacks());

            CommitTransaction();
            // Return the ChangeApplierInfo
            return(changeApplier.GetChangeApplierInfo());
        }
        //If full enumeration is needed because  this provider is out of date due to tombstone cleanup, then this method will be called by the engine.
        public byte[] ProcessRemoteFullEnumerationChangeBatch(
            ConflictResolutionPolicy resolutionPolicy,
            FullEnumerationChangeBatch sourceChanges,
            CachedChangeDataRetriever changeDataRetriever,
            byte[] changeApplierInfo)
        {
            _metadataStore.BeginTransaction();

            //Get all my local change versions from the metadata store
            IEnumerable <ItemChange> localChanges = _metadata.GetFullEnumerationLocalVersions(sourceChanges);

            NotifyingChangeApplier changeApplier = new NotifyingChangeApplier(_idFormats);

            // The following step is required because we are remote change application
            changeApplier.LoadChangeApplierInfo(changeApplierInfo);

            changeApplier.ApplyFullEnumerationChanges(
                resolutionPolicy,
                sourceChanges,
                changeDataRetriever as IChangeDataRetriever,
                localChanges,
                _metadata.GetKnowledge(),
                _metadata.GetForgottenKnowledge(),
                this,
                null,                   // Note that we do not pass a sync session context
                new SyncCallbacks());

            _metadataStore.CommitTransaction();

            // Return the ChangeApplierInfo
            return(changeApplier.GetChangeApplierInfo());
        }
예제 #5
0
        /// <summary>
        /// Возвращает пакет изменений, который содержит метаданные элементов, имеющих значение идентификатора выше
        /// или равное указанной нижней границы, как часть полного перечисления.
        /// </summary>
        /// <param name="batchSize">Size of the batch.</param>
        /// <param name="lowerEnumerationBound">The lower enumeration bound.</param>
        /// <param name="destinationKnowledge">The destination knowledge.</param>
        /// <returns></returns>
        public override FullEnumerationChangeBatch GetFullEnumerationChangeBatch(uint batchSize, SyncId lowerEnumerationBound, SyncKnowledge destinationKnowledge)
        {
            // Increment the tick count.
            ulong tickCount = GetNextTickCount();

            // Update the knowledge with an updated local tick count.
            Replica.CurrentKnowledge.SetLocalTickCount(tickCount);

            // Copy all in range item metadata entries (as changes) in our batch
            // We use a sorted list as the engine requires we enumerate all in range changes
            // in id sorted order.
            List <ItemChange> changes = DetectChanges(destinationKnowledge, lowerEnumerationBound, batchSize);

            changes.Sort((x, y) => x.ItemId.CompareTo(y.ItemId));

            // Construct a ChangeBatch we can use to create a ChangeBatch instance
            FullEnumerationChangeBatch changeBatch = new FullEnumerationChangeBatch(IdFormats, destinationKnowledge,
                                                                                    Replica.ForgottenKnowledge, lowerEnumerationBound);

            // Add the changes
            if (changes.Count > 0)
            {
                changeBatch.BeginOrderedGroup(lowerEnumerationBound);
                changeBatch.AddChanges(changes);
                changeBatch.EndOrderedGroup(changes[changes.Count - 1].ItemId, Replica.CurrentKnowledge);
            }
            // Return the batch

            return(changeBatch);
        }
        //This is only called when the engine has detected that the destination is out of date due to Tombstone cleanup.
        public override FullEnumerationChangeBatch GetFullEnumerationChangeBatch(uint batchSize, SyncId lowerEnumerationBound, SyncKnowledge knowledgeForDataRetrieval, out object changeDataRetriever)
        {
            FullEnumerationChangeBatch batch = _metadata.GetFullEnumerationChangeBatch(batchSize, lowerEnumerationBound, knowledgeForDataRetrieval);

            changeDataRetriever = this; //this is where the transfer mechanism/protocol would go. For an in memory provider, this is sufficient
            return(batch);
        }
예제 #7
0
        public override IEnumerable <ItemChange> GetFullEnumerationLocalVersions(FullEnumerationChangeBatch sourceChanges)
        {
            if (sourceChanges == null)
            {
                throw new ArgumentNullException("sourceChanges");
            }
            foreach (ItemMetadata item in Replica.EntityMetadataItems)
            {
                ItemChange change = null;

                if ((item.GlobalId == sourceChanges.DestinationVersionEnumerationRangeLowerBound || item.GlobalId > sourceChanges.DestinationVersionEnumerationRangeLowerBound) &&
                    (item.GlobalId == sourceChanges.DestinationVersionEnumerationRangeUpperBound || item.GlobalId < sourceChanges.DestinationVersionEnumerationRangeUpperBound))
                {
                    // Found the corresponding item in the local metadata
                    // Get the local creation version and change (update) version from the metadata
                    change = new ItemChange(IdFormats, ReplicaId, item.GlobalId,
                                            item.IsDeleted ? ChangeKind.Deleted : ChangeKind.Update,      // If local item is a tombstone, mark it accordingly
                                            item.CreationVersion, item.ChangeVersion);
                }
                else
                {
                    // Remote item has no local counterpart
                    // This item is unknown to us
                    change = new ItemChange(IdFormats, ReplicaId, null,
                                            ChangeKind.UnknownItem,       // Mark the change as unknown
                                            SyncVersion.UnknownVersion, SyncVersion.UnknownVersion);
                }

                yield return(change);
            }
        }
        public override FullEnumerationChangeBatch GetFullEnumerationChangeBatch(uint batchSize, SyncId lowerEnumerationBound, SyncKnowledge knowledgeForDataRetrieval, out object changeDataRetriever)
        {
            FullEnumerationChangeBatch batch = _metadataStore.Metadata.GetFullEnumerationChangeBatch(batchSize, lowerEnumerationBound, knowledgeForDataRetrieval);

            changeDataRetriever = _changeApplier;
            return(batch);
        }
 public byte[] ProcessFullEnumerationChangeBatch(
     ConflictResolutionPolicy resolutionPolicy,
     FullEnumerationChangeBatch sourceChanges,
     Sync101.CachedChangeDataRetriever changeDataRetriever,
     byte[] changeApplierInfo)
 {
     return(base.Channel.ProcessFullEnumerationChangeBatch(
                resolutionPolicy,
                sourceChanges,
                changeDataRetriever,
                changeApplierInfo));
 }
예제 #10
0
 public byte[] ProcessFullEnumerationChangeBatch(
     ConflictResolutionPolicy resolutionPolicy,
     FullEnumerationChangeBatch sourceChanges,
     CachedChangeDataRetriever changeDataRetriever,
     byte[] changeApplierInfo)
 {
     return(provider.ProcessRemoteFullEnumerationChangeBatch(
                resolutionPolicy,
                sourceChanges,
                changeDataRetriever,
                changeApplierInfo));
 }
예제 #11
0
        /// <summary>
        /// When overridden in a derived class, gets a change batch that contains item metadata for items that have IDs greater than the specified lower bound, as part of a full enumeration.
        /// </summary>
        /// <param name="batchSize">The number of changes to include in the change batch.</param>
        /// <param name="lowerEnumerationBound">The lower bound for item IDs. This method returns changes that have IDs greater than or equal to this ID value.</param>
        /// <param name="knowledgeForDataRetrieval">If an item change is contained in this knowledge object, data for that item already exists on the destination replica.</param>
        /// <param name="changeDataRetriever">Returns an object that can be used to retrieve change data. It can be an <see cref="T:Microsoft.Synchronization.IChangeDataRetriever"/> object or a be provider-specific object.</param>
        /// <returns>
        /// A change batch that contains item metadata for items that have IDs greater than the specified lower bound, as part of a full enumeration.
        /// </returns>
        public override FullEnumerationChangeBatch GetFullEnumerationChangeBatch(uint batchSize, SyncId lowerEnumerationBound, SyncKnowledge knowledgeForDataRetrieval, out object changeDataRetriever)
        {
            byte[] rawLowerEnumBound            = lowerEnumerationBound.RawId;
            byte[] rawKnowledgeForDataRetrieval = knowledgeForDataRetrieval.Serialize();
            byte[] rawChangeDataRetriever;
            byte[] rawFullEnumerationChangeBatch =
                _syncService.GetFullEnumerationChangeBatch(batchSize,
                                                           rawLowerEnumBound,
                                                           rawKnowledgeForDataRetrieval,
                                                           out rawChangeDataRetriever);
            CachedChangeDataRetriever cachedRetriever =
                SerializerHelper.BinaryDeserialize <CachedChangeDataRetriever>(rawChangeDataRetriever);

            changeDataRetriever = cachedRetriever;
            return(FullEnumerationChangeBatch.Deserialize(IdFormats, rawFullEnumerationChangeBatch));
        }
예제 #12
0
        public override FullEnumerationChangeBatch GetFullEnumerationChangeBatch(
            uint batchSize,
            SyncId lowerEnumerationBound,
            SyncKnowledge knowledgeForDataRetrieval,
            out object changeDataRetriever)
        {
            CachedChangeDataRetriever cachedChangeDataRetriever;

            FullEnumerationChangeBatch fullEnumerationChangeBatch = this.client.GetFullEnumerationChangeBatch(
                batchSize,
                lowerEnumerationBound,
                knowledgeForDataRetrieval,
                out cachedChangeDataRetriever);

            changeDataRetriever = cachedChangeDataRetriever;

            return(fullEnumerationChangeBatch);
        }
        public override void ProcessFullEnumerationChangeBatch(
            ConflictResolutionPolicy resolutionPolicy,
            FullEnumerationChangeBatch sourceChanges,
            object changeDataRetriever,
            SyncCallbacks syncCallback,
            SyncSessionStatistics sessionStatistics)
        {
            CachedChangeDataRetriever cachedChangeDataRetriever = new CachedChangeDataRetriever(
                changeDataRetriever as IChangeDataRetriever,
                sourceChanges);

            byte[] newChangeApplierInfo = this.client.ProcessFullEnumerationChangeBatch(
                resolutionPolicy,
                sourceChanges,
                cachedChangeDataRetriever,
                this.syncSessionContext.ChangeApplierInfo);

            this.syncSessionContext.ChangeApplierInfo = newChangeApplierInfo;
        }
예제 #14
0
        public FullEnumerationChangeBatch GetFullEnumerationChangeBatch(
            uint batchSize,
            SyncId lowerEnumerationBound,
            SyncKnowledge knowledgeForDataRetrieval,
            out CachedChangeDataRetriever changeDataRetriever)
        {
            object dataRetriever;

            FullEnumerationChangeBatch changeBatch = provider.GetFullEnumerationChangeBatch(
                batchSize,
                lowerEnumerationBound,
                knowledgeForDataRetrieval,
                out dataRetriever);

            changeDataRetriever = new CachedChangeDataRetriever(
                dataRetriever as IChangeDataRetriever,
                changeBatch);

            return(changeBatch);
        }
예제 #15
0
        public override FullEnumerationChangeBatch GetFullEnumerationChangeBatch(uint batchSize, SyncId lowerEnumerationBound, SyncKnowledge knowledgeForDataRetrieval, out object changeDataRetriever)
        {
            FullEnumerationChangeBatch batch = _metaData.GetFullEnumerationChangeBatch(batchSize, lowerEnumerationBound, knowledgeForDataRetrieval);

            changeDataRetriever = this;             //this is where the transfer mechanism/protocol would go. For an in memory provider, this is sufficient
            //get total item for calculating estimated work
            if (!_fullEnumFirstCall)
            {
                uint allDeletedItems;
                _metaData.GetItemCount(out RemainingSessionWorkEstimate, out allDeletedItems);
                _fullEnumFirstCall = true;
            }

            //Calculate estimate work
            batch.RemainingSessionWorkEstimate = RemainingSessionWorkEstimate;
            batch.BatchWorkEstimate            = batch.IsLastBatch ? (uint)batch.Count() : batchSize;
            RemainingSessionWorkEstimate       = batch.IsLastBatch ? 0 : RemainingSessionWorkEstimate - batchSize;

            return(batch);
        }
예제 #16
0
        //This is only called when the engine has detected that the destination is out of date due to Tombstone cleanup.
        public override FullEnumerationChangeBatch GetFullEnumerationChangeBatch(uint batchSize, SyncId lowerEnumerationBound, SyncKnowledge knowledgeForDataRetrieval, out object changeDataRetriever)
        {
            if (!_fullEnumFirstCall)
            {
                _syncItemCount     = (uint)_store.Ids.Count;
                _fullEnumFirstCall = true;
            }
            FullEnumerationChangeBatch batch = _metadata.GetFullEnumerationChangeBatch(batchSize, lowerEnumerationBound, knowledgeForDataRetrieval);

            changeDataRetriever = this; //this is where the transfer mechanism/protocol would go. For an in memory provider, this is sufficient
            uint changesCount = 0;

            foreach (ItemChange itemChange in batch)
            {
                changesCount++;
            }
            batch.RemainingSessionWorkEstimate = _syncItemCount;
            batch.BatchWorkEstimate            = batch.IsLastBatch ? changesCount : batchSize;
            _syncItemCount = batch.IsLastBatch ? 0 : _syncItemCount - batchSize;
            return(batch);
        }
예제 #17
0
        public byte[] GetFullEnumerationChangeBatch(uint batchSize, byte[] lowerEnumerationBoundRaw,
                                                    byte[] rawKnowledgeForDataRetrieval,
                                                    out byte[] changeDataRetriever)
        {
            GenericRemoteSyncProvider <EntityObjectHierarchy> provider = GetSessionProvider();

            byte[] retVal = null;
            try
            {
                SyncKnowledge knowledgeForDataRetrieval = SyncKnowledge.Deserialize(provider.IdFormats,
                                                                                    rawKnowledgeForDataRetrieval);
                SyncId lowerEnumerationBound = new SyncId(lowerEnumerationBoundRaw, false);
                object dataRetriever;
                FullEnumerationChangeBatch changeBatch = provider.GetFullEnumerationChangeBatch(batchSize,
                                                                                                lowerEnumerationBound,
                                                                                                knowledgeForDataRetrieval,
                                                                                                out dataRetriever);
                CachedChangeDataRetriever cachedChangeDataRetriever =
                    new CachedChangeDataRetriever(dataRetriever as IChangeDataRetriever, changeBatch);
                changeDataRetriever = SerializerHelper.BinarySerialize(cachedChangeDataRetriever);
                retVal = changeBatch.Serialize();
            }
            catch (SyncException e)
            {
                throw SoapErrorCreator.RaiseException(HttpContext.Current.Request.Url.ToString(),
                                                      new SyncronizationServiceError(SyncronizationServiceError.eServiceErrorType.SyncFramework, e),
                                                      true);
            }
            catch (Exception e)
            {
                throw SoapErrorCreator.RaiseException(HttpContext.Current.Request.Url.ToString(),
                                                      new SyncronizationServiceError(SyncronizationServiceError.eServiceErrorType.SyncProvider, e),
                                                      true);
            }

            return(retVal);
        }
예제 #18
0
 /// <inheritdoc />
 public override void ProcessFullEnumerationChangeBatch(ConflictResolutionPolicy resolutionPolicy, FullEnumerationChangeBatch sourceChanges, object changeDataRetriever, SyncCallbacks syncCallbacks, SyncSessionStatistics sessionStatistics)
 {
   // anyone know how to implement ???
   throw new NotImplementedException();
 }
예제 #19
0
 public override IEnumerable <ItemChange> GetFilteredFullEnumerationLocalVersions(FullEnumerationChangeBatch sourceChanges, ReplicaMetadata.ItemFilterCallback filterCallback)
 {
     throw new NotImplementedException();
 }
예제 #20
0
 public override IEnumerable<ItemChange> GetFilteredFullEnumerationLocalVersions(FullEnumerationChangeBatch sourceChanges, ReplicaMetadata.ItemFilterCallback filterCallback)
 {
     throw new NotImplementedException();
 }
예제 #21
0
        /// <summary>
        /// Возвращает пакет изменений, который содержит метаданные элементов, имеющих значение идентификатора выше 
        /// или равное указанной нижней границы, как часть полного перечисления.
        /// </summary>
        /// <param name="batchSize">Size of the batch.</param>
        /// <param name="lowerEnumerationBound">The lower enumeration bound.</param>
        /// <param name="destinationKnowledge">The destination knowledge.</param>
        /// <returns></returns>
        public override FullEnumerationChangeBatch GetFullEnumerationChangeBatch(uint batchSize, SyncId lowerEnumerationBound, SyncKnowledge destinationKnowledge)
        {
            // Increment the tick count.
            ulong tickCount = GetNextTickCount();

            // Update the knowledge with an updated local tick count.
            Replica.CurrentKnowledge.SetLocalTickCount(tickCount);

            // Copy all in range item metadata entries (as changes) in our batch
            // We use a sorted list as the engine requires we enumerate all in range changes
            // in id sorted order.
            List<ItemChange> changes = DetectChanges(destinationKnowledge, lowerEnumerationBound, batchSize);
            changes.Sort((x,y) => x.ItemId.CompareTo(y.ItemId));

            // Construct a ChangeBatch we can use to create a ChangeBatch instance
            FullEnumerationChangeBatch changeBatch = new FullEnumerationChangeBatch(IdFormats, destinationKnowledge,
                                                                                    Replica.ForgottenKnowledge, lowerEnumerationBound);
            // Add the changes
            if (changes.Count > 0)
            {
                changeBatch.BeginOrderedGroup(lowerEnumerationBound);
                changeBatch.AddChanges(changes);
                changeBatch.EndOrderedGroup(changes[changes.Count - 1].ItemId, Replica.CurrentKnowledge);
            }
            // Return the batch

            return changeBatch;
        }
예제 #22
0
        public override void ProcessFullEnumerationChangeBatch(ConflictResolutionPolicy resolutionPolicy, FullEnumerationChangeBatch sourceChanges, object changeDataRetriever, SyncCallbacks syncCallback, SyncSessionStatistics sessionStatistics)
        {
            _metadataStore.BeginTransaction();

            IEnumerable<ItemChange> localChanges = _metadataStore.Metadata.GetFullEnumerationLocalVersions(sourceChanges);
            NotifyingChangeApplier changeApplier = new NotifyingChangeApplier(_idFormats);
            changeApplier.ApplyFullEnumerationChanges(resolutionPolicy, sourceChanges, changeDataRetriever as IChangeDataRetriever, localChanges, _metadataStore.Metadata.GetKnowledge(),
                _metadataStore.Metadata.GetForgottenKnowledge(), _changeApplier, _currentSessionContext, syncCallback);

            _metadataStore.CommitTransaction();
        }
예제 #23
0
        public override IEnumerable<ItemChange> GetFullEnumerationLocalVersions(FullEnumerationChangeBatch sourceChanges)
        {
            if (sourceChanges == null)
            {
                throw new ArgumentNullException("sourceChanges");
            }
            foreach (ItemMetadata item in Replica.EntityMetadataItems)
            {
                ItemChange change = null;

                if ((item.GlobalId == sourceChanges.DestinationVersionEnumerationRangeLowerBound || item.GlobalId > sourceChanges.DestinationVersionEnumerationRangeLowerBound)
                   && (item.GlobalId == sourceChanges.DestinationVersionEnumerationRangeUpperBound || item.GlobalId < sourceChanges.DestinationVersionEnumerationRangeUpperBound))
                {
                    // Found the corresponding item in the local metadata
                    // Get the local creation version and change (update) version from the metadata
                    change = new ItemChange(IdFormats, ReplicaId, item.GlobalId,
                        item.IsDeleted ? ChangeKind.Deleted : ChangeKind.Update,  // If local item is a tombstone, mark it accordingly
                        item.CreationVersion, item.ChangeVersion);
                }
                else
                {
                    // Remote item has no local counterpart
                    // This item is unknown to us
                    change = new ItemChange(IdFormats, ReplicaId, null,
                        ChangeKind.UnknownItem,   // Mark the change as unknown
                        SyncVersion.UnknownVersion, SyncVersion.UnknownVersion);
                }

                yield return change;
            }
        }
예제 #24
0
        /// <summary>
        /// When overridden in a derived class, processes a set of changes for a full enumeration by applying changes to the item store.
        /// </summary>
        /// <param name="resolutionPolicy">The conflict resolution policy to use when this method applies changes.</param>
        /// <param name="sourceChanges">A batch of changes from the source provider to be applied locally.</param>
        /// <param name="changeDataRetriever">An object that can be used to retrieve change data. It can be an <see cref="T:Microsoft.Synchronization.IChangeDataRetriever"/> object or a provider-specific object.</param>
        /// <param name="syncCallbacks">An object that receives event notifications during change application.</param>
        /// <param name="sessionStatistics">Tracks change statistics. For a provider that uses custom change application, this object must be updated with the results of the change application.</param>
        public override void ProcessFullEnumerationChangeBatch(ConflictResolutionPolicy resolutionPolicy, FullEnumerationChangeBatch sourceChanges, object changeDataRetriever, SyncCallbacks syncCallbacks, SyncSessionStatistics sessionStatistics)
        {
            CachedChangeDataRetriever cachedChangeDataRetriever = new CachedChangeDataRetriever(
                changeDataRetriever as IChangeDataRetriever,
                sourceChanges);

            byte[] rawSourceChanges             = sourceChanges.Serialize();
            byte[] rawCachedChangeDataRetriever = SerializerHelper.BinarySerialize(cachedChangeDataRetriever);
            byte[] newChangeApplierInfo         = _syncService.ProcessFullEnumerationChangeBatch(
                (int)resolutionPolicy,
                rawSourceChanges,
                rawCachedChangeDataRetriever,
                _syncSessionContext.ChangeApplierInfo);

            _syncSessionContext.ChangeApplierInfo = newChangeApplierInfo;
        }
예제 #25
0
        //If full enumeration is needed because  this provider is out of date due to tombstone cleanup, then this method will be called by the engine.
        public override void ProcessFullEnumerationChangeBatch(ConflictResolutionPolicy resolutionPolicy, FullEnumerationChangeBatch sourceChanges, object changeDataRetriever, SyncCallbacks syncCallback, SyncSessionStatistics sessionStatistics)
        {
            _metadataStore.BeginTransaction();

            //Get all my local change versions from the metadata store
            IEnumerable <ItemChange> localChanges = _metadata.GetFullEnumerationLocalVersions(sourceChanges);

            //Create a changeapplier object to make change application easier (make the engine call me
            //when it needs data and when I should save data)
            NotifyingChangeApplier changeApplier = new NotifyingChangeApplier(_idFormats);

            changeApplier.ApplyFullEnumerationChanges(resolutionPolicy, sourceChanges, changeDataRetriever as IChangeDataRetriever, localChanges, _metadata.GetKnowledge(),
                                                      _metadata.GetForgottenKnowledge(), this, _currentSessionContext, syncCallback);

            _metadataStore.CommitTransaction();
        }
예제 #26
0
        //If full enumeration is needed because  this provider is out of date due to tombstone cleanup, then this method will be called by the engine.
        public override void ProcessFullEnumerationChangeBatch(ConflictResolutionPolicy resolutionPolicy, FullEnumerationChangeBatch sourceChanges, object changeDataRetriever, SyncCallbacks syncCallback, SyncSessionStatistics sessionStatistics)
        {
            _metadataStore.BeginTransaction();

            //Get all my local change versions from the metadata store
            IEnumerable<ItemChange> localChanges = _metadata.GetFullEnumerationLocalVersions(sourceChanges);

            //Create a changeapplier object to make change application easier (make the engine call me
            //when it needs data and when I should save data)
            NotifyingChangeApplier changeApplier = new NotifyingChangeApplier(_idFormats);
            changeApplier.ApplyFullEnumerationChanges(resolutionPolicy, sourceChanges, changeDataRetriever as IChangeDataRetriever, localChanges, _metadata.GetKnowledge(),
                _metadata.GetForgottenKnowledge(), this, _currentSessionContext, syncCallback);

            _metadataStore.CommitTransaction();
        }
        public override void ProcessFullEnumerationChangeBatch(ConflictResolutionPolicy resolutionPolicy, FullEnumerationChangeBatch sourceChanges, object changeDataRetriever, SyncCallbacks syncCallback, SyncSessionStatistics sessionStatistics)
        {
            _metadataStore.BeginTransaction();

            IEnumerable <ItemChange> localChanges  = _metadataStore.Metadata.GetFullEnumerationLocalVersions(sourceChanges);
            NotifyingChangeApplier   changeApplier = new NotifyingChangeApplier(_idFormats);

            changeApplier.ApplyFullEnumerationChanges(resolutionPolicy, sourceChanges, changeDataRetriever as IChangeDataRetriever, localChanges, _metadataStore.Metadata.GetKnowledge(),
                                                      _metadataStore.Metadata.GetForgottenKnowledge(), _changeApplier, _currentSessionContext, syncCallback);

            _metadataStore.CommitTransaction();
        }
예제 #28
0
 public override void ProcessFullEnumerationChangeBatch(ConflictResolutionPolicy resolutionPolicy, FullEnumerationChangeBatch sourceChanges,
     object changeDataRetriever, SyncCallbacks syncCallback, SyncSessionStatistics sessionStatistics)
 {
     throw new NotImplementedException("The method or operation is not implemented.");
 }
예제 #29
0
        /// <summary>
        /// When overridden in a derived class, processes a set of changes for a full enumeration by applying changes to the item store.
        /// </summary>
        /// <param name="resolutionPolicy">The conflict resolution policy to use when this method applies changes.</param>
        /// <param name="sourceChanges">A batch of changes from the source provider to be applied locally.</param>
        /// <param name="changeDataRetriever">An object that can be used to retrieve change data. It can be an <see cref="T:Microsoft.Synchronization.IChangeDataRetriever"/> object or a provider-specific object.</param>
        /// <param name="syncCallbacks">An object that receives event notifications during change application.</param>
        /// <param name="sessionStatistics">Tracks change statistics. For a provider that uses custom change application, this object must be updated with the results of the change application.</param>
        public override void ProcessFullEnumerationChangeBatch(ConflictResolutionPolicy resolutionPolicy, FullEnumerationChangeBatch sourceChanges, object changeDataRetriever, SyncCallbacks syncCallbacks, SyncSessionStatistics sessionStatistics)
        {
            CachedChangeDataRetriever cachedChangeDataRetriever = new CachedChangeDataRetriever(
              changeDataRetriever as IChangeDataRetriever,
              sourceChanges);

            byte[] rawSourceChanges = sourceChanges.Serialize();
            byte[] rawCachedChangeDataRetriever = SerializerHelper.BinarySerialize(cachedChangeDataRetriever);
            byte[] newChangeApplierInfo = _syncService.ProcessFullEnumerationChangeBatch(
                (int)resolutionPolicy,
                rawSourceChanges,
                rawCachedChangeDataRetriever,
                _syncSessionContext.ChangeApplierInfo);

            _syncSessionContext.ChangeApplierInfo = newChangeApplierInfo;
        }