示例#1
0
        //------------------------------------------------------------------------------------
        /// <summary>
        /// Starts a background task to attempt to commit all currently queued changes to the
        /// back-end store.
        /// </summary>
        //------------------------------------------------------------------------------------
        public void CommitChanges(bool showProgress = true)
        {
            if (m_changedItems.Count > 0)
            {
                IsCommitInProgress = true;
                CommitChangesWorker commitWorker = new CommitChangesWorker();

                List <StoreItem> commitItems = m_changedItems.ToList();
                commitWorker.CommitItems(commitItems, showProgress);
            }
        }
示例#2
0
        //------------------------------------------------------------------------------------
        /// <summary>
        /// Commits any changes in the given item to the backing store immediately, without
        /// committing any other items that are on the current change list.
        ///
        /// To use this method, you must first call Item.BeginSaveImmediate before making any
        /// changes to the item you want to save.
        /// </summary>
        //------------------------------------------------------------------------------------
        public void SaveItemImmediate(StoreItem item)
        {
            if (!item.IsDirty || !item.IsInImmediateSave)
            {
                return;
            }

            item.IsInImmediateSave = false;
            if (item.IsNew)
            {
                item.PersistState = PersistStates.NewCommitted;
                AddToCache(item);
            }

            CommitChangesWorker commitWorker = new CommitChangesWorker();

            commitWorker.CommitItem(item);
        }