/// <summary> /// Maps source object to result type. /// </summary> /// <param name="mapper">The mapper instance.</param> /// <param name="resultType">The result type.</param> /// <param name="source">The source object.</param> /// <param name="tag">The object used to send additional paramaters for the mapping code.</param> /// <returns>The mapped object.</returns> public static object Map(this MapperInstance mapper, Type resultType, object source, object tag = null) { if (!TryExistingMappings(mapper, resultType, source, tag, out object targetObject)) { targetObject = mapper.DefaultMap(source, resultType, tag); } return(targetObject); }