Exemple #1
0
        /// <summary>
        /// Processes the specified value.
        /// </summary>
        /// <param name="value">
        /// The value to process.
        /// </param>
        /// <returns>
        /// The processed value.
        /// </returns>
        /// <remarks>
        /// This method is necessary in order to facilitate unit tests.
        /// </remarks>
        public object ProcessSpecifiedValue(object value)
        {
            if (value is IPublishedContent)
            {
                value = base.ProcessValue();
            }

            if (value is ArchetypeModel)
            {
                var result = ((ArchetypeModel)value).ToPublishedContentSet();
                return(CollectionExtensionMethods.AsList(result));
            }

            if (value is ArchetypeFieldsetModel)
            {
                return(((ArchetypeFieldsetModel)value).ToPublishedContent());
            }

            if (value is IEnumerable)
            {
                return(CollectionExtensionMethods.AsList(value as dynamic));
            }
            else
            {
                return(value);
            }
        }
        /// <summary>
        /// Converts the supplied IEnumerable to a list.
        /// </summary>
        /// <returns>
        /// The list.
        /// </returns>
        public override object ProcessValue()
        {
            if (this.Value == null)
            {
                return(null);
            }
            var list = CollectionExtensionMethods.AsList(this.Value as dynamic);

            return(list);
        }