public IPublishedContent Get(IMember member) { var type = _contentTypeCache.Get(PublishedItemType.Member, member.ContentTypeId); return(new PublishedMember(member, type, _variationContextAccessor) .CreateModel(Current.PublishedModelFactory)); }
public IPublishedContent GetByProviderKey(object key) { return(_requestCache.GetCacheItem <IPublishedContent>( GetCacheKey("GetByProviderKey", key), () => { var provider = Core.Security.MembershipProviderExtensions.GetMembersMembershipProvider(); if (provider.IsUmbracoMembershipProvider() == false) { throw new NotSupportedException("Cannot access this method unless the Umbraco membership provider is active"); } var result = _memberService.GetByProviderKey(key); if (result == null) { return null; } var type = _contentTypeCache.Get(PublishedItemType.Member, result.ContentTypeId); return new PublishedMember(result, type, _umbracoContextAccessor).CreateModel(); })); }
public override PublishedContentType GetContentType(int id) { return(_contentTypeCache.Get(PublishedItemType.Media, id)); }
public IPublishedContentType GetContentType(int id) => _contentTypeCache.Get(PublishedItemType.Member, id);
public PublishedContentType GetContentType(int id) { return(_contentTypeCache.Get(PublishedItemType.Member, id)); }
public override IPublishedContentType GetContentType(int id) => _contentTypeCache.Get(PublishedItemType.Content, id);
public DictionaryPublishedContent( IReadOnlyDictionary <string, string> valueDictionary, Func <int, IPublishedContent> getParent, Func <int, XPathNavigator, IEnumerable <IPublishedContent> > getChildren, Func <DictionaryPublishedContent, string, IPublishedProperty> getProperty, IAppCache appCache, IVariationContextAccessor variationContextAccessor, PublishedContentTypeCache contentTypeCache, XPathNavigator nav, bool fromExamine) : base(variationContextAccessor) { if (valueDictionary == null) { throw new ArgumentNullException(nameof(valueDictionary)); } if (getParent == null) { throw new ArgumentNullException(nameof(getParent)); } if (getProperty == null) { throw new ArgumentNullException(nameof(getProperty)); } _getParent = new Lazy <IPublishedContent>(() => getParent(ParentId)); _getChildren = new Lazy <IEnumerable <IPublishedContent> >(() => getChildren(Id, nav)); _getProperty = getProperty; _appCache = appCache; LoadedFromExamine = fromExamine; ValidateAndSetProperty(valueDictionary, val => _id = Int32.Parse(val), "id", "nodeId", "__NodeId"); //should validate the int! ValidateAndSetProperty(valueDictionary, val => _key = Guid.Parse(val), "key", "__key", "__Key"); //ValidateAndSetProperty(valueDictionary, val => _templateId = int.Parse(val), "template", "templateId"); ValidateAndSetProperty(valueDictionary, val => _sortOrder = Int32.Parse(val), "sortOrder"); ValidateAndSetProperty(valueDictionary, val => _name = val, "nodeName"); ValidateAndSetProperty(valueDictionary, val => _urlName = val, "urlName"); ValidateAndSetProperty(valueDictionary, val => _documentTypeAlias = val, "nodeTypeAlias", ExamineFieldNames.ItemTypeFieldName); ValidateAndSetProperty(valueDictionary, val => _documentTypeId = Int32.Parse(val), "nodeType"); //ValidateAndSetProperty(valueDictionary, val => _writerId = int.Parse(val), "writerID"); ValidateAndSetProperty(valueDictionary, val => _creatorId = Int32.Parse(val), "creatorID", "writerID"); //this is a bit of a hack fix for: U4-1132 ValidateAndSetProperty(valueDictionary, val => _path = val, "path", "__Path"); ValidateAndSetProperty(valueDictionary, val => _createDate = ParseDateTimeValue(val), "createDate"); ValidateAndSetProperty(valueDictionary, val => _updateDate = ParseDateTimeValue(val), "updateDate"); ValidateAndSetProperty(valueDictionary, val => _level = Int32.Parse(val), "level"); ValidateAndSetProperty(valueDictionary, val => { int pId; ParentId = -1; if (Int32.TryParse(val, out pId)) { ParentId = pId; } }, "parentID"); _contentType = contentTypeCache.Get(PublishedItemType.Media, _documentTypeAlias); _properties = new Collection <IPublishedProperty>(); //handle content type properties //make sure we create them even if there's no value foreach (var propertyType in _contentType.PropertyTypes) { var alias = propertyType.Alias; _keysAdded.Add(alias); string value; const bool isPreviewing = false; // false :: never preview a media var property = valueDictionary.TryGetValue(alias, out value) == false || value == null ? new XmlPublishedProperty(propertyType, this, isPreviewing) : new XmlPublishedProperty(propertyType, this, isPreviewing, value); _properties.Add(property); } //loop through remaining values that haven't been applied foreach (var i in valueDictionary.Where(x => _keysAdded.Contains(x.Key) == false && // not already processed IgnoredKeys.Contains(x.Key) == false)) // not ignorable { if (i.Key.InvariantStartsWith("__")) { // no type for that one, dunno how to convert, drop it //IPublishedProperty property = new PropertyResult(i.Key, i.Value, PropertyResultType.CustomProperty); //_properties.Add(property); } else { // this is a property that does not correspond to anything, ignore and log Current.Logger.LogWarning("Dropping property '{PropertyKey}' because it does not belong to the content type.", i.Key); } } }