Example #1
0
 /// <summary>
 /// Called in order to commit this change.
 /// </summary>
 protected virtual void OnCommit(CommitReason reason)
 {
     if (this.CommitCallback != null)
     {
         ChangeCommittedEventArgs <T> args = new ChangeCommittedEventArgs <T>(this.Owner, this.CachedValue, this, reason);
         this.CommitCallback(args);
     }
 }
Example #2
0
        /// <summary>
        /// Commits this change.
        /// </summary>
        /// <param name="reason">The reason of the commit.</param>
        public void Commit(CommitReason reason)
        {
            foreach (var c in this.changes)
            {
                c.Item1.Commit(reason);
            }

            this.OnCommitted(new CommittedEventArgs(reason));
        }
Example #3
0
        /// <summary>
        /// Commits this change.
        /// </summary>
        public void Commit(CommitReason reason)
        {
            reason.EnsureIsDefined();
            Ensure.That(reason)
            .Named("reason")
            .If(v => v == CommitReason.None)
            .Then((v, n) =>
            {
                throw new ArgumentException("Unsupported CommitReason value.", n);
            });

            this.OnCommit(reason);
            this.OnCommitted(new CommittedEventArgs(reason));
        }
		/// <summary>
		/// Initializes a new instance of the <see cref="CommittedEventArgs"/> class.
		/// </summary>
		/// <param name="reason">The reason.</param>
		public CommittedEventArgs( CommitReason reason )
		{
			this.Reason = reason;
		}
        /// <summary>
        /// Called when change(s) have been committed from the <c>IChange</c> instance.
        /// </summary>
        /// <param name="change">The committed change.</param>
        /// <param name="reason">The reason of the commit.</param>
        protected virtual void OnChangeCommitted( IChange change, CommitReason reason )
        {
            this.OnUnwire( change );

            switch ( reason )
            {
                case CommitReason.AcceptChanges:

                    lock ( SyncRoot )
                    {
                        this.backwardChangesStack.Remove( change );
                    }

                    break;

                case CommitReason.None:
                    throw new ArgumentOutOfRangeException( "reason" );

                default:
                    throw new EnumValueOutOfRangeException();
            }
        }
Example #6
0
 internal static void CallCommited(ILogger logger, CommitReason commitReason)
 {
     _callCommited(logger, commitReason, null);
 }
Example #7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CommittedEventArgs"/> class.
 /// </summary>
 /// <param name="reason">The reason.</param>
 public CommittedEventArgs(CommitReason reason)
 {
     this.Reason = reason;
 }
Example #8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ChangeCommittedEventArgs&lt;T&gt;"/> class.
 /// </summary>
 /// <param name="entity">The entity.</param>
 /// <param name="cachedValue">The cached value.</param>
 /// <param name="source">The source.</param>
 /// <param name="reason">The reason.</param>
 public ChangeCommittedEventArgs(Object entity, T cachedValue, IChange source, CommitReason reason)
     : base(entity, cachedValue, source)
 {
     this.Reason = reason;
 }