コード例 #1
0
        private MappingConfigContinuation <TSource, TTarget> SetDerivedTargetType <TDerivedTarget>()
        {
            var derivedTypePair = DerivedTypePair
                                  .For <TDerivedSource, TTarget, TDerivedTarget>(_configInfo);

            _configInfo.MapperContext.UserConfigurations.DerivedTypes.Add(derivedTypePair);

            return(new MappingConfigContinuation <TSource, TTarget>(_configInfo));
        }
コード例 #2
0
        /// <summary>
        /// Map the derived source type being configured to the derived target type specified by the type argument.
        /// </summary>
        /// <typeparam name="TDerivedTarget">
        /// The derived target type to create for the configured derived source type.
        /// </typeparam>
        /// <returns>
        /// A MappingConfigContinuation to enable further configuration of mappings from and to the source and
        /// target type being configured.
        /// </returns>
        public MappingConfigContinuation <TSource, TTarget> To <TDerivedTarget>()
            where TDerivedTarget : TTarget
        {
            var derivedTypePair = DerivedTypePair
                                  .For <TDerivedSource, TTarget, TDerivedTarget>(_configInfo);

            _configInfo.MapperContext.UserConfigurations.DerivedTypes.Add(derivedTypePair);

            return(new MappingConfigContinuation <TSource, TTarget>(_configInfo));
        }