/// <summary> /// Maps an attribute safely, using the given attribute mapping. Safe mapping /// attempts to map the attribute using the given mapping first. If this does /// not succeed, the standard mapping (EN) will be used for mapping.If no mapping /// is available in the standard mapping, the original attribute key is /// returned unchanged. This way, it is always ensured that this method /// returns a valid string for naming attributes. /// </summary> /// <returns>The safe mapping for the given attribute key.</returns> /// <param name="attributeKey">Key of the attribute to map.</param> /// <param name="mapping">Mapping to be used preferably.</param> public string MapSafely(string attributeKey, IXAttributeNameMap mapping) { string alias = null; if (mapping != null) { alias = mapping.Get(attributeKey); } if (alias == null) { alias = this.standardMapping.Get(attributeKey); } if (alias == null) { alias = attributeKey; } return(alias); }
/// <summary> /// Maps an attribute safely, using the given attribute mapping. Safe mapping /// attempts to map the attribute using the given mapping first. If this does /// not succeed, the standard mapping (EN) will be used for mapping. If no /// mapping is available in the standard mapping, the original attribute key /// is returned unchanged. This way, it is always ensured that this method /// returns a valid string for naming attributes. /// </summary> /// <returns>The safe mapping for the given attribute.</returns> /// <param name="attribute">Attribute to map.</param> /// <param name="mapping">Mapping to be used preferably.</param> public string MapSafely(XAttribute attribute, IXAttributeNameMap mapping) { return(this.MapSafely(attribute.Key, mapping)); }