Esempio n. 1
0
        /// <inheritdoc />
        public ICommittableOffsetBatch Updated(ICommittable offset)
        {
            switch (offset)
            {
            case ICommittableOffset committableOffset:
                return(UpdateWithOffset(committableOffset));

            case ICommittableOffsetBatch committableOffsetBatch:
                return(UpdateWithBatch(committableOffsetBatch));

            default:
                throw new AggregateException($"Unexpected offset to update committable batch offsets from: {offset.GetType().Name}");
            }
        }
Esempio n. 2
0
        protected internal void WriteChildCommits(SqlStringBuilder sql, Database db = null)
        {
            db = db ?? Database;
            foreach (string key in this.ChildCollections.Keys)
            {
                ICommittable c = this.ChildCollections[key];
                c.WriteCommit(sql, db);
            }

            sql.Executed += (s, d) =>
            {
                this.ChildCollections.Clear();
            };
        }
Esempio n. 3
0
        /// <summary>
        /// You should never call this directly, EntitySpaces calls this internally.
        /// </summary>
        /// <param name="commit">Any class that implements ICommittable</param>
        /// <returns>True if successful</returns>
        static public bool AddForCommit(ICommittable commit)
        {
            esTransactionScope current = GetCurrentTx();

            if (current != null)
            {
                if (current.commitList == null)
                {
                    current.commitList = new List <ICommittable>();
                }

                current.commitList.Add(commit);

                return(true);
            }
            else
            {
                return(false);
            }
        }
        /// <summary>
        /// You should never call this directly, EntitySpaces calls this internally.
        /// </summary>
        /// <param name="commit">Any class that implements ICommittable</param>
        /// <returns>True if successful</returns>
        static public bool AddForCommit(ICommittable commit)
        {
            esTransactionScope current = GetCurrentTx();
            if (current != null)
            {
                if (current.commitList == null)
                {
                    current.commitList = new List<ICommittable>();
                }

                current.commitList.Add(commit);

                return true;
            }
            else
            {
                return false;
            }

        }
Esempio n. 5
0
 public void Register(ICommittable participant)
 {
     _participants.Add(participant);
 }