Esempio n. 1
0
        public byte[] ProcessChangeBatch(int resolutionPolicy, byte[] sourceChanges,
                                         byte[] rawChangeDataRetriever, byte[] changeApplierInfo)
        {
            GenericRemoteSyncProvider <EntityObjectHierarchy> provider = GetSessionProvider();

            byte[] retVal = null;
            try
            {
                ChangeBatch sourceChangeBatch =
                    ChangeBatch.Deserialize(provider.IdFormats, sourceChanges);
                CachedChangeDataRetriever chachedDataRetriever =
                    SerializerHelper.BinaryDeserialize <CachedChangeDataRetriever>(rawChangeDataRetriever);

                retVal = provider.ProcessRemoteChangeBatch((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);
        }
Esempio n. 2
0
        /// <summary>
        /// When overridden in a derived class, gets a change batch that contains item metadata for items that are not contained in the specified knowledge from the destination provider.
        /// </summary>
        /// <param name="batchSize">The number of changes to include in the change batch.</param>
        /// <param name="destinationKnowledge">The knowledge from the destination provider. This knowledge must be mapped by calling <see cref="M:Microsoft.Synchronization.SyncKnowledge.MapRemoteKnowledgeToLocal(Microsoft.Synchronization.SyncKnowledge)"/> on the source knowledge before it can be used for change enumeration.</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 provider-specific object.</param>
        /// <returns>
        /// A change batch that contains item metadata for items that are not contained in the specified knowledge from the destination provider. Cannot be a null.
        /// </returns>
        public override ChangeBatch GetChangeBatch(uint batchSize, SyncKnowledge destinationKnowledge, out object changeDataRetriever)
        {
            byte[] rawDestinationKnowledge = destinationKnowledge.Serialize();
            byte[] rawChangeDataRetriever;
            byte[] rawChangeBatch = _syncService.GetChangeBatch(batchSize, rawDestinationKnowledge,
                                                                out rawChangeDataRetriever);
            CachedChangeDataRetriever cachedRetriever =
                SerializerHelper.BinaryDeserialize <CachedChangeDataRetriever>(rawChangeDataRetriever);

            changeDataRetriever = cachedRetriever;

            return(ChangeBatch.Deserialize(IdFormats, rawChangeBatch));
        }