コード例 #1
0
        //Change application!
        public byte[] ProcessRemoteChangeBatch(ConflictResolutionPolicy resolutionPolicy, ChangeBatch sourceChanges, CachedChangeDataRetriever changeDataRetriever, byte[] changeApplierInfo)
        {
            _metadataStore.BeginTransaction();

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

            NotifyingChangeApplier changeApplier = new NotifyingChangeApplier(_idFormats);

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

            changeApplier.ApplyChanges(
                resolutionPolicy,
                sourceChanges,
                changeDataRetriever,
                localChanges,
                _metadata.GetKnowledge(),
                _metadata.GetForgottenKnowledge(),
                this,
                null,                     // Note that we do not pass a sync session context
                syncCallbacks);

            _metadataStore.CommitTransaction();

            // Return the ChangeApplierInfo
            return(changeApplier.GetChangeApplierInfo());
        }
コード例 #2
0
        //Change application!
        public override void ProcessChangeBatch(ConflictResolutionPolicy resolutionPolicy, ChangeBatch sourceChanges,
                                                object changeDataRetriever, SyncCallbacks syncCallback, SyncSessionStatistics sessionStatistics)
        {
            _metadataStore.BeginTransaction();

            //Get all my local change versions from the metadata store
            IEnumerable <ItemChange> localChanges = _metadata.GetLocalVersions(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.ApplyChanges(resolutionPolicy, sourceChanges, changeDataRetriever as IChangeDataRetriever, localChanges, _metadata.GetKnowledge(),
                                       _metadata.GetForgottenKnowledge(), this, _currentSessionContext, syncCallback);

            _metadataStore.CommitTransaction();
        }