private string Identity(Umbraco.Core.Models.IContent content) { if (content.HasIdentity) { return(content.Key.ToString()); } return(content.Path + KeySeperator + content.SortOrder.ToString() + KeySeperator + content.Name + KeySeperator + content.CreateDate.Ticks.ToString()); }
private IEnumerable <Guid> Ancestors(Umbraco.Core.Models.IContent content) { var results = new List <Guid>(); foreach (var id in content.Path.Split(new char[] { ',' }).Select(x => int.Parse(x)).Where(x => x != Umbraco.Core.Constants.System.Root && x != content.Id)) { var attempt = ApplicationContext.Current.Services.EntityService.GetKeyForId(id, Umbraco.Core.Models.UmbracoObjectTypes.Document); if (attempt.Success) { results.Insert(0, attempt.Result); } else { var parent = ApplicationContext.Current.Services.ContentService.GetById(id); results.Insert(0, parent.Key); } } return(results); }