Пример #1
0
        /// <summary>
        /// глубокое сравнение контентов с учетом циклов
        /// </summary>
        /// <param name="other"></param>
        /// <param name="visitedContents">родительские контенты, Key текущего, Value - other</param>
        /// <returns></returns>
        internal bool RecursiveEquals(Content other, ReferenceDictionary <Content, Content> visitedContents)
        {
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            if (visitedContents.ContainsKey(this))
            {
                return(ReferenceEquals(visitedContents[this], other));
            }

            visitedContents.Add(this, other);

            return(ContentId == other.ContentId &&
                   IsReadOnly == other.IsReadOnly &&
                   LoadAllPlainFields == other.LoadAllPlainFields &&
                   PublishingMode == other.PublishingMode &&
                   Fields.Count == other.Fields.Count &&
                   Fields.All(x => other.Fields
                              .Any(y => y.FieldId == x.FieldId && x.RecursiveEquals(y, visitedContents))));
        }