Exemplo n.º 1
0
        /// <summary>
        /// Processes the items.
        /// </summary>
        /// <returns></returns>
        public IEnumerable <T> ProcessItems()
        {
            foreach (IContent child in _getItems())
            {
                var obj = _service.CreateType(
                    _type,
                    child,
                    _isLazy,
                    _inferType) as T;

                if (obj == null)
                {
                    continue;
                }
                yield return(obj);
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// Casts and item to a strongly typed. .
 /// </summary>
 /// <typeparam name="T">Type to return</typeparam>
 /// <param name="content">The content.</param>
 /// <param name="service">The service.</param>
 /// <param name="isLazy">if set to <c>true</c> [is lazy].</param>
 /// <param name="inferType">if set to <c>true</c> [infer type].</param>
 /// <returns>
 /// A strongly typed class representation of the item
 /// </returns>
 public static T GlassCast <T>(this IContent content, IUmbracoService service, bool isLazy = false, bool inferType = false) where T : class
 {
     return(service.CreateType <T>(content, isLazy, inferType));
 }