public virtual void LoadAll(IItemData[] rootItemsData, IDeserializeFailureRetryer retryer, IConsistencyChecker consistencyChecker, Action <IItemData> rootLoadedCallback = null)
        {
            Assert.ArgumentNotNull(rootItemsData, "rootItems");
            Assert.IsTrue(rootItemsData.Length > 0, "No root items were passed!");

            if (DataProviderConfiguration.EnableTransparentSync)
            {
                CacheManager.ClearAllCaches();
                // BOOM! This clears all caches before we begin;
                // because for a TpSync configuration we could have TpSync items in the data cache which 'taint' the item comparisons and result in missed updates
            }

            bool disableNewSerialization = UnicornDataProvider.DisableSerialization;

            try
            {
                UnicornDataProvider.DisableSerialization = true;

                using (new EventDisabler())
                {
                    foreach (var rootItem in rootItemsData)
                    {
                        LoadTree(rootItem, retryer, consistencyChecker);
                        rootLoadedCallback?.Invoke(rootItem);
                    }

                    retryer.RetryAll(SourceDataStore, item => DoLoadItem(item, null), item => LoadTreeInternal(item, retryer, null));
                }
            }
            finally
            {
                UnicornDataProvider.DisableSerialization = disableNewSerialization;
            }
        }
        public virtual void LoadAll(IItemData[] rootItemsData, IDeserializeFailureRetryer retryer, IConsistencyChecker consistencyChecker, Action <IItemData> rootLoadedCallback = null)
        {
            Assert.ArgumentNotNull(rootItemsData, "rootItems");
            Assert.IsTrue(rootItemsData.Length > 0, "No root items were passed!");

            using (new EventDisabler())
            {
                foreach (var rootItem in rootItemsData)
                {
                    LoadTree(rootItem, retryer, consistencyChecker);
                    if (rootLoadedCallback != null)
                    {
                        rootLoadedCallback(rootItem);
                    }
                }
            }

            retryer.RetryAll(SourceDataStore, item => DoLoadItem(item, null), item => LoadTreeRecursive(item, retryer, null));
        }
Exemple #3
0
        public virtual void LoadAll(ISerializedItem[] rootItems, IDeserializeFailureRetryer retryer, IConsistencyChecker consistencyChecker, Action <ISerializedItem> rootLoadedCallback = null)
        {
            Assert.ArgumentNotNull(rootItems, "rootItems");
            Assert.IsTrue(rootItems.Length > 0, "No root items were passed!");

            using (new EventDisabler())
            {
                foreach (var rootItem in rootItems)
                {
                    LoadTree(rootItem, retryer, consistencyChecker);
                    if (rootLoadedCallback != null)
                    {
                        rootLoadedCallback(rootItem);
                    }
                }
            }

            retryer.RetryAll(SourceDataProvider, item => DoLoadItem(item, null), item => LoadTreeRecursive(item, retryer, null));

            SourceDataProvider.DeserializationComplete(rootItems[0].DatabaseName);
        }
        public virtual void LoadAll(IItemData[] rootItemsData, IDeserializeFailureRetryer retryer, IConsistencyChecker consistencyChecker, Action<IItemData> rootLoadedCallback = null)
        {
            Assert.ArgumentNotNull(rootItemsData, "rootItems");
            Assert.IsTrue(rootItemsData.Length > 0, "No root items were passed!");

            using (new EventDisabler())
            {
                foreach (var rootItem in rootItemsData)
                {
                    LoadTree(rootItem, retryer, consistencyChecker);
                    if (rootLoadedCallback != null) rootLoadedCallback(rootItem);
                }
            }

            retryer.RetryAll(SourceDataStore, item => DoLoadItem(item, null), item => LoadTreeRecursive(item, retryer, null));
        }
        /// <summary>
        /// Loads a preset from serialized items on disk.
        /// </summary>
        public virtual void LoadTree(ISerializedItem rootItem, IDeserializeFailureRetryer retryer, IConsistencyChecker consistencyChecker)
        {
            Assert.ArgumentNotNull(rootItem, "rootItem");
            Assert.ArgumentNotNull(retryer, "retryer");
            Assert.ArgumentNotNull(consistencyChecker, "consistencyChecker");

            _itemsProcessed = 0;
            var timer = new Stopwatch();
            timer.Start();

            Logger.BeginLoadingTree(rootItem);

            using (new EventDisabler())
            {
                // load the root item (LoadTreeRecursive only evaluates children)
                DoLoadItem(rootItem, consistencyChecker);

                // load children of the root
                LoadTreeRecursive(rootItem, retryer, consistencyChecker);

                retryer.RetryAll(SourceDataProvider, item => DoLoadItem(item, null), item => LoadTreeRecursive(item, retryer, null));
            }

            timer.Stop();

            SourceDataProvider.DeserializationComplete(rootItem.DatabaseName);
            Logger.EndLoadingTree(rootItem, _itemsProcessed, timer.ElapsedMilliseconds);
        }
        public virtual void LoadAll(IItemData[] rootItemsData, IDeserializeFailureRetryer retryer, IConsistencyChecker consistencyChecker, Action<IItemData> rootLoadedCallback = null)
        {
            Assert.ArgumentNotNull(rootItemsData, "rootItems");
            Assert.IsTrue(rootItemsData.Length > 0, "No root items were passed!");

            CacheManager.ClearAllCaches(); // BOOM! This clears all caches before we begin;
                                           // because for a TpSync configuration we could have TpSync items in the data cache which 'taint' the item comparisons and result in missed updates

            bool disableNewSerialization = UnicornDataProvider.DisableSerialization;
            try
            {
                UnicornDataProvider.DisableSerialization = true;

                using (new EventDisabler())
                {
                    foreach (var rootItem in rootItemsData)
                    {
                        LoadTree(rootItem, retryer, consistencyChecker);
                        rootLoadedCallback?.Invoke(rootItem);
                    }

                    retryer.RetryAll(SourceDataStore, item => DoLoadItem(item, null), item => LoadTreeInternal(item, retryer, null));
                }
            }
            finally
            {
                UnicornDataProvider.DisableSerialization = disableNewSerialization;
            }
        }
        public virtual void LoadAll(ISerializedItem[] rootItems, IDeserializeFailureRetryer retryer, IConsistencyChecker consistencyChecker, Action<ISerializedItem> rootLoadedCallback = null)
        {
            Assert.ArgumentNotNull(rootItems, "rootItems");
            Assert.IsTrue(rootItems.Length > 0, "No root items were passed!");

            using (new EventDisabler())
            {
                foreach (var rootItem in rootItems)
                {
                    LoadTree(rootItem, retryer, consistencyChecker);
                    if (rootLoadedCallback != null) rootLoadedCallback(rootItem);
                }
            }

            retryer.RetryAll(SourceDataProvider, item => DoLoadItem(item, null), item => LoadTreeRecursive(item, retryer, null));

            SourceDataProvider.DeserializationComplete(rootItems[0].DatabaseName);
        }
        public virtual void LoadAll(IItemData[] rootItemsData, IDeserializeFailureRetryer retryer, IConsistencyChecker consistencyChecker, Action<IItemData> rootLoadedCallback = null)
        {
            Assert.ArgumentNotNull(rootItemsData, "rootItems");
            Assert.IsTrue(rootItemsData.Length > 0, "No root items were passed!");

            // load the root item (LoadTreeInternal only evaluates children)
            bool disableNewSerialization = UnicornDataProvider.DisableSerialization;
            try
            {
                UnicornDataProvider.DisableSerialization = true;

                using (new EventDisabler())
                {
                    foreach (var rootItem in rootItemsData)
                    {
                        LoadTree(rootItem, retryer, consistencyChecker);
                        if (rootLoadedCallback != null) rootLoadedCallback(rootItem);
                    }

                    retryer.RetryAll(SourceDataStore, item => DoLoadItem(item, null), item => LoadTreeInternal(item, retryer, null));
                }
            }
            finally
            {
                UnicornDataProvider.DisableSerialization = disableNewSerialization;
            }
        }