/// <summary> /// Get the Root item for the tree (default implimentation uses first entity type) /// </summary> /// <param name="treeItem"></param> /// <returns></returns> protected virtual SyncLocalItem GetRootItem(SyncTreeItem treeItem) => new SyncLocalItem(Constants.System.RootString) { EntityType = EntityType, Name = EntityType, Udi = Udi.Create(EntityType) };
public virtual SyncLocalItem GetEntity(SyncTreeItem treeItem) { if (treeItem.IsRoot()) { return(GetRootItem(treeItem)); } var attempt = treeItem.Id.TryConvertTo <TIndexType>(); if (attempt.Success) { return(GetLocalEntity(attempt.Result)); } return(null); }
/// <summary> /// Is this the root item for the entity /// </summary> /// <remarks> /// this method assums the item is following Umbraco conventions for root (i.e "-1") /// </remarks> public static bool IsRoot(this SyncTreeItem item) => item.Id == Constants.System.RootString;
} = true; /// show in the tree. public virtual SyncTreeType GetTreeType(SyncTreeItem treeItem) => SyncTreeType.Settings;