public CachedChangeDataRetriever(
			IChangeDataRetriever changeDataRetriever,
			ChangeBatchBase sourceChanges)
        {
            _idFormats = changeDataRetriever.IdFormats;
            _cachedData = new Dictionary<SyncId, SyncTransferData>();

            // Look at each change in the source batch
            foreach (ItemChange itemChange in sourceChanges)
            {
                if (itemChange.ChangeKind != ChangeKind.Deleted)
                {
                    // This is not delete, so there is some data associated
                    // with this change.

                    // Create a UserLoadChangeContext to retriever this data.
                    UserLoadChangeContext loadChangeContext = new UserLoadChangeContext(
                        _idFormats,
                        itemChange);

                    // Retrieve the data (we know that our provider uses data of type ItemData.
                    SyncTransferData itemData = changeDataRetriever.LoadChangeData(loadChangeContext) as SyncTransferData;

                    // Cache it
                    _cachedData.Add(itemChange.ItemId, itemData);
                }
            }
        }
Exemple #2
0
        public CachedChangeDataRetriever(
            IChangeDataRetriever changeDataRetriever,
            ChangeBatchBase sourceChanges)
        {
            this.idFormats  = changeDataRetriever.IdFormats;
            this.cachedData = new Dictionary <SyncId, Sync101.ItemData>();

            // Look at each change in the source batch
            foreach (ItemChange itemChange in sourceChanges)
            {
                if (itemChange.ChangeKind != ChangeKind.Deleted)
                {
                    // This is not delete, so there is some data associated
                    // with this change.

                    // Create a UserLoadChangeContext to retriever this data.
                    UserLoadChangeContext loadChangeContext = new UserLoadChangeContext(
                        idFormats,
                        itemChange);

                    // Retrieve the data (we know that our provider uses data of type ItemData.
                    ItemData itemData = changeDataRetriever.LoadChangeData(
                        loadChangeContext) as ItemData;

                    // Cache it
                    cachedData.Add(itemChange.ItemId, itemData);
                }
            }
        }
Exemple #3
0
        public CachedChangeDataRetriever(IChangeDataRetriever changeDataRetriever, ChangeBatchBase sourceChanges)
        {
            idFormats  = changeDataRetriever.IdFormats;
            cachedData = new Dictionary <SyncId, ISyncDataObject>();
            var changeItems = sourceChanges.Where(o => o.ChangeKind != ChangeKind.Deleted).Select(o => new UserLoadChangeContext(idFormats, o));

            cachedData = (changeDataRetriever as PosDbSyncProvider).LoadChangeDatas(changeItems);
        }