コード例 #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);
        }
コード例 #2
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);
        }
コード例 #3
0
 /// <summary>
 /// When overridden in a derived class, gets the number of item changes that will be included in change batches, and the current knowledge for the synchronization scope.
 /// </summary>
 /// <param name="batchSize">The number of item changes that will be included in change batches returned by this object.</param>
 /// <param name="knowledge">The current knowledge for the synchronization scope, or a newly created knowledge object if no current knowledge exists.</param>
 public override void GetSyncBatchParameters(out uint batchSize, out SyncKnowledge knowledge)
 {
     byte[] rawKnowledge;
     batchSize = _syncService.GetSyncBatchParameters(out rawKnowledge);
     knowledge = SyncKnowledge.Deserialize(IdFormats, rawKnowledge);
 }