/// <summary> /// Retrieves the best possible value for an attribute or virtual attribute (like EntityTitle) /// Automatically resolves the language-variations as well based on the list of preferred languages /// </summary> /// <param name="attributeName">Name of the attribute or virtual attribute</param> /// <param name="resolveHyperlinks"></param> /// <returns>An object OR a null - for example when retrieving the title and no title exists</returns> public object GetBestValue(string attributeName, bool resolveHyperlinks = false) { object result; if (LightAttributesForInternalUseOnlyForNow.ContainsKey(attributeName)) { result = LightAttributesForInternalUseOnlyForNow[attributeName]; } else { switch (attributeName.ToLower()) { case Constants.EntityFieldTitle: result = Title; break; default: return(GetInternalPropertyByName(attributeName)); } } if (resolveHyperlinks) { result = TryToResolveLink(result); } return(result); }
/// <summary> /// Shorhand accessor to retrieve an attribute /// </summary> /// <param name="attributeName"></param> /// <returns></returns> public object this[string attributeName] => LightAttributesForInternalUseOnlyForNow.ContainsKey(attributeName) ? LightAttributesForInternalUseOnlyForNow[attributeName] : null;