Пример #1
0
        protected virtual void FlushTempStorage()
        {
            List <EntityContext> nextFlushEntities = new List <EntityContext>();

            do
            {
                foreach (EntityContext entityContext in nextFlushEntities)
                {
                    List <IPersistentStorage> storage      = _setup.GetPersistentStorages(entityContext.Description);
                    IFlushStrategy            flushTrigger = _setup.GetFlushTrigger(entityContext.Description);

                    flushTrigger.SetNextFlushCount(entityContext);
                    flushTrigger.SetNextReleaseCount(entityContext);

                    if (entityContext.Description.InsertToPersistentStorageBeforeUse)
                    {
                        _setup.TemporaryStorage.GenerateStorageIds(entityContext, storage);
                    }

                    _setup.TemporaryStorage.FlushToPersistent(entityContext, storage);
                }

                _setup.TemporaryStorage.WaitAllTasks();

                nextFlushEntities = _entityContexts.Values
                                    .Where(x => x.EntityProgress.ReleasedCount < x.EntityProgress.CurrentCount)
                                    .ToList();
            } while (nextFlushEntities.Count > 0);

            _setup.TemporaryStorage.WaitAllTasks();
        }
        //methods
        public virtual bool Execute()
        {
            List <IPersistentStorage> persistentStorages = _setup.GetPersistentStorages(_entityContext.Description);

            _setup.TemporaryStorage.GenerateStorageIds(_entityContext, persistentStorages);

            return(true);
        }
Пример #3
0
        //methods
        public virtual bool Execute()
        {
            List <IPersistentStorage> persistentStorages = _setup.GetPersistentStorages(EntityContext.Description);

            _setup.TemporaryStorage.FlushToPersistent(EntityContext, persistentStorages)
            .ContinueWith(prev =>
            {
                _setup.Supervisor.EnqueueCommand(
                    new CheckFlushRequiredCommand(EntityContext, _setup, _flushCandidatesRegistry));
            });

            return(true);
        }