Example #1
0
        /// <summary>
        /// Copy function.
        /// </summary>
        /// <param name="historyValue">HistoryValue.</param>
        public void CopyTo(HistoryValue historyValue)
        {
            if (historyValue == null)
            {
                throw new ArgumentNullException();
            }

            historyValue.Value = Value;
            historyValue.OldValue = OldValue;
            historyValue.Status = Status;
        }
Example #2
0
        /// <summary>
        /// Compare objects that derived from HistoryValue.
        /// </summary>
        /// <param name="obj1">Object 1.</param>
        /// <param name="obj2">Object 2.</param>
        /// <returns>true for equal
        ///     (null, null) => equal
        ///     (null, deleted) => equal
        ///     (deleted, deleted) => equal.
        /// </returns>
        public static bool Equals(HistoryValue obj1, HistoryValue obj2)
        {
            bool equal = false;

            if (obj1 != null)
            {
                if (obj2 != null)
                {
                    equal = obj1.Equals(obj2);
                }
                else
                {
                    if (obj1.Status == Lexicon.LexiconStatus.Deleted)
                    {
                        // deleted == null
                        equal = true;
                    }
                }
            }
            else if (obj2 != null)
            {
                if (obj2.Status == Lexicon.LexiconStatus.Deleted)
                {
                    // null == deleted
                    equal = true;
                }
            }
            else
            {
                // null == null
                equal = true;
            }

            return equal;
        }