/// <summary>
        /// Verify that the specified <paramref name="aggregate"/> state has not been corrupted after a failed save attempt and update the check sum if the save was successful.
        /// </summary>
        /// <param name="aggregate">The modified <see cref="Aggregate"/> instance if <paramref name="commit"/> is not <value>null</value>; otherwise the original <see cref="Aggregate"/> instance if <paramref name="error"/> is not <value>null</value>.</param>
        /// <param name="commit">The <see cref="Commit"/> generated if the save was successful; otherwise <value>null</value>.</param>
        /// <param name="error">The <see cref="Exception"/> thrown if the save was unsuccessful; otherwise <value>null</value>.</param>
        public override void PostSave(Aggregate aggregate, Commit commit, Exception error)
        {
            if (error != null)
                aggregate.VerifyHash();

            if (commit != null)
                aggregate.UpdateHash();
        }
Esempio n. 2
0
        /// <summary>
        /// Verify that the specified <paramref name="aggregate"/> state has not been corrupted after a failed save attempt and update the check sum if the save was successful.
        /// </summary>
        /// <param name="aggregate">The modified <see cref="Aggregate"/> instance if <paramref name="commit"/> is not <value>null</value>; otherwise the original <see cref="Aggregate"/> instance if <paramref name="error"/> is not <value>null</value>.</param>
        /// <param name="commit">The <see cref="Commit"/> generated if the save was successful; otherwise <value>null</value>.</param>
        /// <param name="error">The <see cref="Exception"/> thrown if the save was unsuccessful; otherwise <value>null</value>.</param>
        public override void PostSave(Aggregate aggregate, Commit commit, Exception error)
        {
            if (error != null)
            {
                aggregate.VerifyHash();
            }

            if (commit != null)
            {
                aggregate.UpdateHash();
            }
        }
Esempio n. 3
0
 /// <summary>
 /// Verify that the specified <paramref name="aggregate"/> state has not been corrupted before proceeding with the save.
 /// </summary>
 /// <param name="aggregate">The aggregate to be modified by the current <paramref name="context"/>.</param>
 /// <param name="context">The current <see cref="CommandContext"/> containing the pending aggregate modifications.</param>
 public override void PreSave(Aggregate aggregate, CommandContext context)
 {
     aggregate.VerifyHash();
 }
Esempio n. 4
0
        /// <summary>
        /// Verify that the retrieved <paramref name="aggregate"/> state has not been corrupted before returning to the caller.
        /// </summary>
        /// <param name="aggregate">The loaded aggregate instance.</param>
        public override void PostGet(Aggregate aggregate)
        {
            Verify.NotNull(aggregate, nameof(aggregate));

            aggregate.VerifyHash();
        }
 /// <summary>
 /// Verify that the specified <paramref name="aggregate"/> state has not been corrupted before proceeding with the save.
 /// </summary>
 /// <param name="aggregate">The aggregate to be modified by the current <paramref name="context"/>.</param>
 /// <param name="context">The current <see cref="CommandContext"/> containing the pending aggregate modifications.</param>
 public override void PreSave(Aggregate aggregate, CommandContext context)
 {
     aggregate.VerifyHash();
 }
        /// <summary>
        /// Verify that the retrieved <paramref name="aggregate"/> state has not been corrupted before returning to the caller.
        /// </summary>
        /// <param name="aggregate">The loaded aggregate instance.</param>
        public override void PostGet(Aggregate aggregate)
        {
            Verify.NotNull(aggregate, nameof(aggregate));

            aggregate.VerifyHash();
        }