Exemplo n.º 1
0
        /// <summary>
        /// Creates a <see cref="TypeMapper"/> for the specified type.
        /// </summary>
        /// <param name="type">The type to create a <see cref="TypeMapper"/> object for.</param>
        /// <returns>A <see cref="TypeMapper"/> for the specified type.</returns>
        public TypeMapper Create(Type type)
        {
            if (!TypeMappers.TryGetValue(type, out TypeMapper typeMapper))
            {
                typeMapper = TypeMappers[type] = TypeMapper.Create(type);
            }

            return(typeMapper);
        }
Exemplo n.º 2
0
 /// <summary>
 /// Creates a <see cref="TypeMapper"/> for the specified object.
 /// </summary>
 /// <param name="o">The object to create a <see cref="TypeMapper"/> object for.</param>
 /// <returns>A <see cref="TypeMapper"/> for the specified object.</returns>
 public TypeMapper Create(object o)
 {
     if (o is ExpandoObject eo)
     {
         return(TypeMapper.Create(eo));
     }
     else
     {
         return(Create(o.GetType()));
     }
 }