public DynamicBackingItem(int Id) { if (Id == -1) { // passing in -1 needs to return a real node, the "root" node, which has no // properties (defaults apply) but can be used to access descendants, children, etc. this.content = new NodeFactory.Node(Id); return; } var n = LegacyNodeHelper.ConvertToNode(UmbracoContext.Current.ContentCache.GetById(Id)); this.content = n; this.Type = DynamicBackingItemType.Content; if (n.Id == 0 && Id != 0) { this.media = ExamineBackedMedia.GetUmbracoMedia(Id); this.Type = DynamicBackingItemType.Media; if (this.media == null) { this.Type = DynamicBackingItemType.Content; } return; } }
public DynamicBackingItem(int Id, DynamicBackingItemType Type) { if (Type == DynamicBackingItemType.Media) { this.media = ExamineBackedMedia.GetUmbracoMedia(Id); this.Type = Type; } else { this.content = CompatibilityHelper.ConvertToNode(UmbracoContext.Current.ContentCache.GetById(Id)); this.Type = Type; } }
public DynamicBackingItem(int Id, DynamicBackingItemType Type) { NodeFactory.Node baseNode = new NodeFactory.Node(Id); if (Type == DynamicBackingItemType.Media) { this.media = ExamineBackedMedia.GetUmbracoMedia(Id); this.Type = Type; } else { this.content = baseNode; this.Type = Type; } }
public DynamicBackingItem(int Id) { NodeFactory.Node baseNode = new NodeFactory.Node(Id); this.content = baseNode; this.Type = DynamicBackingItemType.Content; if (baseNode.Id == 0 && Id != 0) { this.media = ExamineBackedMedia.GetUmbracoMedia(Id); this.Type = DynamicBackingItemType.Media; if (this.media == null) { this.Type = DynamicBackingItemType.Content; } return; } }
public DynamicBackingItem(int Id) { var n = CompatibilityHelper.ConvertToNode(UmbracoContext.Current.ContentCache.GetById(Id)); this.content = n; this.Type = DynamicBackingItemType.Content; if (n.Id == 0 && Id != 0) { this.media = ExamineBackedMedia.GetUmbracoMedia(Id); this.Type = DynamicBackingItemType.Media; if (this.media == null) { this.Type = DynamicBackingItemType.Content; } return; } }