예제 #1
0
        protected virtual IMapper <TSource, TTarget> CreateMapper <TSource, TTarget>(
            Type targetType)
        {
            Guard.CheckArgumentNotNull(targetType, "targetType");
            if (targetType.GetConstructor(new Type[] { typeof(MapperConstructionInfo) }) != null)
            {
                var info = new MapperConstructionInfo(this);
                return((IMapper <TSource, TTarget>)Activator
                       .CreateInstance(targetType, new object[] { info }));
            }

            return((IMapper <TSource, TTarget>)Activator.CreateInstance(targetType));
        }
예제 #2
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="ConfigurationMapper{TSource,TTarget}" /> class.
 /// </summary>
 /// <param name="constructionInfo">Mapper construction information.</param>
 public ConfigurationMapper(MapperConstructionInfo constructionInfo)
     : base(constructionInfo)
 {
 }
예제 #3
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="CompositeMapper{TSource,TTarget}" /> class.
 /// </summary>
 /// <param name="constructionInfo">
 ///     Mapper construction information.
 /// </param>
 /// <param name="innerMappers">
 ///     The inner mappers.
 /// </param>
 public CompositeMapper(MapperConstructionInfo constructionInfo, params IMapper <TSource, TTarget>[] innerMappers)
     : base(constructionInfo)
 {
     Initialize(innerMappers);
     TypeMapping = new TypeMappingInfo <TSource, TTarget>(MappingOverwriteBehavior.SkipOverwrite);
 }
예제 #4
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="AttributeMapper{TSource,TTarget}" /> class.
 /// </summary>
 /// <param name="constructionInfo">Mapper construction information.</param>
 public AttributeMapper(MapperConstructionInfo constructionInfo)
     : base(constructionInfo)
 {
 }
예제 #5
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="ManualMapper{TSource,TTarget}" /> class.
 /// </summary>
 /// <param name="constructionInfo">Mapper construction information.</param>
 public ManualMapper(MapperConstructionInfo constructionInfo)
     : base(constructionInfo)
 {
     TypeMapping = new TypeMappingInfo <TSource, TTarget>();
 }
예제 #6
0
 public Mapper2(MapperConstructionInfo constructionInfo)
 {
     this.ConstructionInfo = constructionInfo;
 }
예제 #7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ConventionMapper{TSource,TTarget}"/> class.
 /// </summary>
 /// <param name="constructionInfo">Mapper construction information.</param>
 public ConventionMapper(MapperConstructionInfo constructionInfo)
     : base(constructionInfo)
 {
 }
예제 #8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="BaseMapper{TSource,TTarget}"/> class.
 /// </summary>
 /// <param name="constructionInfo">
 /// Contains additional mapper construction information.
 /// </param>
 protected BaseMapper(MapperConstructionInfo constructionInfo)
     : this()
 {
     Guard.CheckArgumentNotNull(constructionInfo, "constructionInfo");
     this.ParentRepository = constructionInfo.ParentRepo;
 }