Last-Modified: Mon, 03 Aug 2026 22:01:45 GMT Expires: Thu, 31 Jul 2036 22:01:45 GMT ExtensionMethods « Tango.Logging « Visual_Studio « Software - Tango - Twine softwares
aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.Logging/ExtensionMethods
ModeNameSize
-rw-r--r--ExceptionExtensions.cs941logstatsplain
-rw-r--r--StringExtensions.cs687logstatsplain
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Tango.Synchronization
{
    /// <summary>
    /// Represents an <see cref="IDBComparer.Compare"/> result.
    /// </summary>
    public class Diff
    {
        private Action _action;

        /// <summary>
        /// Gets the action which will be taken in order to commit this difference.
        /// </summary>
        public DiffAction Action { get; private set; }

        /// <summary>
        /// Gets the difference description.
        /// </summary>
        public String Description { get; private set; }

        /// <summary>
        /// Gets the <see cref="Commit"/> SQL command.
        /// </summary>
        public String Command { get; private set; }

        /// <summary>
        /// Initializes a new instance of the <see cref="Diff"/> class.
        /// </summary>
        /// <param name="diffAction">The difference action type.</param>
        /// <param name="description">The action description.</param>
        /// <param name="action">The action delegate.</param>
        /// <param name="command">The SQL command.</param>
        public Diff(DiffAction diffAction, String description, Action action, String command)
        {
            Action = diffAction;
            Description = description;
            _action = action;
            Command = command;
        }

        /// <summary>
        /// Commits this difference to the target DB.
        /// </summary>
        public void Commit()
        {
            _action();
        }

        /// <summary>
        /// Returns a <see cref="System.String" /> that represents this instance.
        /// </summary>
        /// <returns>
        /// A <see cref="System.String" /> that represents this instance.
        /// </returns>
        public override string ToString()
        {
            return Command;
        }
    }
}