Ejemplo n.º 1
0
        public byte[] GetChangeBatch(uint batchSize, byte[] rawDestinationKnowledge,
                                     out byte[] changeDataRetriever)
        {
            GenericRemoteSyncProvider <EntityObjectHierarchy> provider = GetSessionProvider();

            byte[] retVal = null;
            try
            {
                SyncKnowledge             destinationKnowledge = SyncKnowledge.Deserialize(provider.IdFormats, rawDestinationKnowledge);
                object                    dataRetriever;
                ChangeBatch               changeBatch = provider.GetChangeBatch(batchSize, destinationKnowledge, out dataRetriever);
                CachedChangeDataRetriever cachedChangeDataRetriever =
                    new CachedChangeDataRetriever(dataRetriever as IChangeDataRetriever, changeBatch);
                string debugCachedRetr = SerializerHelper.XmlSerialize(cachedChangeDataRetriever);
                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);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// When overridden in a derived class, processes a set of changes by detecting conflicts and 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 ProcessChangeBatch(ConflictResolutionPolicy resolutionPolicy, ChangeBatch 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.ProcessChangeBatch(
                (int)resolutionPolicy,
                rawSourceChanges,
                rawCachedChangeDataRetriever,
                _syncSessionContext.ChangeApplierInfo);

            _syncSessionContext.ChangeApplierInfo = newChangeApplierInfo;
        }
Ejemplo n.º 3
0
        /// <summary>
        /// When overridden in a derived class, processes a set of changes by detecting conflicts and 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 ProcessChangeBatch(ConflictResolutionPolicy resolutionPolicy, ChangeBatch 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.ProcessChangeBatch(
                (int)resolutionPolicy,
                rawSourceChanges,
                rawCachedChangeDataRetriever,
                _syncSessionContext.ChangeApplierInfo);

            _syncSessionContext.ChangeApplierInfo = newChangeApplierInfo;
        }