Пример #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Mapper{TSource,TTarget}"/> class.
        /// </summary>
        /// <param name="mapperFlags">Mapper flags.</param>
        /// <param name="configuration">The mapper configuration to use for mappings.</param>
        /// <exception cref="ArgumentNullException">Thrown when <paramref name="configuration"/> is null.</exception>
        protected Mapper(MapperFlags mapperFlags, MapperConfiguration <TSource, TTarget> configuration)
        {
            configuration.ThrowIfNull("configuration");

            _mapperFlags       = mapperFlags;
            _configuration     = configuration;
            _mapMethodDelegate = new Lazy <Action <TSource, TTarget> >(
                () =>
            {
                ConfigureMapper();

                return(_generator.GenerateMappingMethod(_configuration));
            });
        }
Пример #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Mapper{TSource,TTarget}"/> class.
 /// </summary>
 protected Mapper(MapperFlags mapperFlags)
     : this(mapperFlags, new MapperConfiguration <TSource, TTarget>())
 {
 }