Ejemplo n.º 1
0
        public static string NodeTypeAlias(this IUwebshopEntity e)
        {
            if (e == null)
            {
                throw new ArgumentNullException("e");
            }
            if (!string.IsNullOrEmpty(e.TypeAlias))
            {
                return(e.TypeAlias);
            }
            // should never come beyond this line
            var p = e as uWebshopEntity;

            if (p != null && p.NodeTypeAlias != null)
            {
                return(p.NodeTypeAlias);
            }

            var entity = IO.Container.Resolve <ICMSEntityRepository>().GetByGlobalId(e.Id);

            if (entity != null && entity.NodeTypeAlias != null)
            {
                return(entity.NodeTypeAlias);
            }
            return(string.Empty);
        }
Ejemplo n.º 2
0
        public static string GetUmbracoPath(this IUwebshopEntity entity)
        {
            var tryCast = entity as uWebshopEntity;

            if (tryCast != null)
            {
                return(tryCast.Path);
            }
            // todo: speed up
            return(IO.Container.Resolve <ICMSEntityRepository>().GetByGlobalId(entity.Id).Path);
        }
Ejemplo n.º 3
0
        public static string GetDocTypeAlias(this IUwebshopEntity entity)
        {
            if (entity == null)
            {
                throw new ArgumentNullException("entity");
            }
            if (!string.IsNullOrEmpty(entity.TypeAlias))
            {
                return(entity.TypeAlias);
            }
            var tryCast = entity as uWebshopEntity;

            if (tryCast != null)
            {
                return(tryCast.NodeTypeAlias);
            }
            return(IO.Container.Resolve <ICMSEntityRepository>().GetByGlobalId(entity.Id).NodeTypeAlias);
        }