コード例 #1
0
        /// <summary>
        /// Applied the <paramref name="mapping"/> from the <paramref name="originalType"/> to a potentially new
        /// <see cref="Type"/>.
        /// </summary>
        /// <param name="originalType">The original <see cref="Type"/>.</param>
        /// <param name="mapping">The type mapping.</param>
        /// <returns>A new <see cref="Type"/> is a mapping has been made; otherwise the
        /// <paramref name="originalType"/>.</returns>
        /// <exception cref="ArgumentNullException">The <paramref name="originalType"/> or <paramref name="mapping"/>
        /// parameters are <see langword="null"/>.</exception>
        private static Type ApplyMapping(this Type originalType, ITypeMapping mapping)
        {
            if (originalType == null)
            {
                throw new ArgumentNullException(nameof(originalType));
            }
            if (mapping == null)
            {
                throw new ArgumentNullException(nameof(mapping));
            }

            Type newType = mapping.MapTo(originalType);

            if (originalType != newType)
            {
                ////TODO: Look into Tracing.
                ////Trace.TraceInformation(
                ////    "The type '{0}' was mapped to the type '{1}' by the mapping '{2}'.",
                ////    originalType,
                ////    newType,
                ////    mapping.Name);
            }

            return(newType);
        }
コード例 #2
0
        /// <summary>
        /// Applied the <paramref name="mapping"/> from the <paramref name="originalType"/> to a potentially new
        /// <see cref="Type"/>.
        /// </summary>
        /// <param name="originalType">The original <see cref="Type"/>.</param>
        /// <param name="mapping">The type mapping.</param>
        /// <returns>A new <see cref="Type"/> is a mapping has been made; otherwise the
        /// <paramref name="originalType"/>.</returns>
        /// <exception cref="ArgumentNullException">The <paramref name="originalType"/> or <paramref name="mapping"/>
        /// parameters are <see langword="null"/>.</exception>
        private static Type ApplyMapping(this Type originalType, ITypeMapping mapping)
        {
            if (originalType == null)
                throw new ArgumentNullException("originalType");
            if (mapping == null)
                throw new ArgumentNullException("mapping");

            Type newType = mapping.MapTo(originalType);
            if (originalType != newType)
            {
                Trace.TraceInformation(
                    "The type '{0}' was mapped to the type '{1}' by the mapping '{2}'.",
                    originalType,
                    newType,
                    mapping.Name);
            }

            return newType;
        }